Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self,x,y,z,cells,nfaces,mask,method='nearest',grdfile=None):
self.method=method
# Initialise the trisearch array
GridSearch.__init__(self,x,y,cells,nfaces=nfaces,force_inside=True)
if self.method == 'linear':
Grid.__init__(self,grdfile)
self.datatmp = np.zeros(mask.shape,dtype=np.double)
self.z = np.sort(z)
self.z[-1]=10.0 # Set the surface layer to large
self.Nkmax = z.size-1
self.mask3d = mask
self.maskindex = -1*np.ones(self.mask3d.shape,dtype=np.int32)
rr=0
for ii in range(self.mask3d.shape[0]):
for jj in range(self.mask3d.shape[1]):
if self.mask3d[ii,jj]:
self.maskindex[ii,jj]=rr
rr+=1
def __init__(self,suntanspath,basename,numprocs,outvars=None):
tic=time.clock()
print '########################################################'
print ' Initializing python SUNTANS NetCDF joining script...'
print '########################################################'
# Step 1) Read the main grid
#print 'Loading suntans grid points...'
Grid.__init__(self,suntanspath)
self.numprocs = numprocs
self.suntanspath=suntanspath
self.basename=basename
# Step 2) Build a dictionary of the variable names, attributes and dimensions in the first ncfile
proc=0
self.ncfile='%s/%s.%d'%(suntanspath,basename,proc)
self.variables, self.dims, self.globalatts = nc_info(self.ncfile)
# If outvars have been set only write those variables and the grid variables
if not outvars==None:
self.outvars=gridvars+outvars
self.outvars=outvars
newvariables = [vv for vv in self.variables if vv['Name'] in self.outvars]
def __init__(self,suntanspath,**kwargs):
self.__dict__.update(kwargs)
Grid.__init__(self,suntanspath)
# Initialise the trisearch object
self.tsearch = TriSearch(self.xp,self.yp,self.cells)
def on_load_grid(self, event):
dlg = wx.DirDialog(
self,
message="Open SUNTANS grid from folder...",
defaultPath=os.getcwd(),
style= wx.DD_DEFAULT_STYLE)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
# Initialise the class
self.flash_status_message("Opening SUNTANS grid from folder: %s" % path)
Grid.__init__(self,path)
# Plot the Grid
self.axes,self.collection = self.plotmesh(ax=self.axes,edgecolors='y')
# redraw the figure
self.canvas.draw()
def __init__(self,suntanspath,timestep,**kwargs):
self.__dict__.update(**kwargs)
self.suntanspath = suntanspath
Grid.__init__(self,suntanspath)
# Get the time timestep
self.time = datetime.strptime(timestep,'%Y%m%d.%H%M%S')
# Initialise the output array
self.initArrays()
def __init__(self,ncfile):
self.ncfile=ncfile
Grid.__init__(self,ncfile,gridvars=untrim_gridvars,griddims=untrim_griddims)