#NEWLINE# def to_shapefile( self , filename , kstpkper = None , totim = None , mflay = None , attrib_name = 'lf_data' ) : #NEWLINE# #INDENT# "\n         Export model output data to a shapefile at a specific location\n          in LayerFile instance.\n\n         Parameters\n         ----------\n         filename : str\n             Shapefile name to write\n         kstpkper : tuple of ints\n             A tuple containing the time step and stress period (kstp, kper).\n             These are zero-based kstp and kper values.\n         totim : float\n             The simulation time.\n         mflay : integer\n            MODFLOW zero-based layer number to return.  If None, then layer 1\n            will be written\n         attrib_name : str\n             Base name of attribute columns. (default is 'lf_data')\n\n         Returns\n         ----------\n         None\n\n         See Also\n         --------\n\n         Notes\n         -----\n\n         Examples\n         --------\n         >>> import flopy\n         >>> hdobj = flopy.utils.HeadFile('test.hds')\n         >>> times = hdobj.get_times()\n         >>> hdobj.to_shapefile('test_heads_sp6.shp', totim=times[-1])\n         " #NEWLINE# plotarray = np . atleast_3d ( self . get_data ( kstpkper = kstpkper , totim = totim , mflay = mflay ) . transpose ( ) ) . transpose ( ) #NEWLINE# if ( attrib_name != None ) : #NEWLINE# #INDENT# attrib_dict = { #NEWLINE# #INDENT# ( attrib_name + '{0:03d}' . format ( mflay ) ) : plotarray [ 0 , : , : ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# attrib_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for k in range ( plotarray . shape [ 0 ] ) : #NEWLINE# #INDENT# name = ( attrib_name + '{0:03d}' . format ( k ) ) #NEWLINE# attrib_dict [ name ] = plotarray [ k ] #NEWLINE# #UNINDENT# #UNINDENT# from flopy.export.shapefile_utils import write_grid_shapefile #NEWLINE# write_grid_shapefile ( filename , self . sr , attrib_dict )