Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_empty(ncells=0, aux_names=None, structured=True):
# get an empty recarray that corresponds to dtype
dtype = ModflowGage.get_default_dtype()
return create_empty_recarray(ncells, dtype, default_value=-1.0E+10)
def get_empty(ncells=0, nbdtim=1, structured=True, head=False):
# get an empty recarray that corresponds to dtype
dtype = ModflowFhb.get_default_dtype(nbdtim=nbdtim,
structured=structured, head=head)
return create_empty_recarray(ncells, dtype, default_value=-1.0E+10)
def get_empty(ncells=0, aux_names=None, structured=True):
"""
Get an empty recarray that corresponds to hfb dtype and has
been extended to include aux variables and associated
aux names.
"""
dtype = ModflowHfb.get_default_dtype(structured=structured)
if aux_names is not None:
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
return create_empty_recarray(ncells, dtype, default_value=-1.0E+10)
def get_empty(ncells=0, nss=0, aux_names=None, structured=True):
# get an empty recarray that corresponds to dtype
dtype, dtype2 = ModflowStr.get_default_dtype(structured=structured)
if aux_names is not None:
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
return (
create_empty_recarray(ncells, dtype=dtype, default_value=-1.0E+10),
create_empty_recarray(nss, dtype=dtype2, default_value=0))
def get_empty(ncells=0, nss=0, aux_names=None, structured=True):
# get an empty recarray that corresponds to dtype
dtype, dtype2 = ModflowStr.get_default_dtype(structured=structured)
if aux_names is not None:
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
return (
create_empty_recarray(ncells, dtype=dtype, default_value=-1.0E+10),
create_empty_recarray(nss, dtype=dtype2, default_value=0))
def get_empty_segment_data(nsegments=0, aux_names=None, default_value=0.):
# get an empty recarray that corresponds to dtype
dtype = ModflowSfr2.get_default_segment_dtype()
if aux_names is not None:
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
d = create_empty_recarray(nsegments, dtype, default_value=default_value)
return d
raise TypeError(msg)
elif isinstance(particleids, (list, tuple)):
particleids = np.array(particleids, dtype=np.int32)
if isinstance(particleids, np.ndarray):
if particleids.shape[0] != partlocs.shape[0]:
msg = '{}:'.format(self.name) + \
'shape of particleids ' + \
'({}) '.format(particleids.shape[0]) + \
'is not equal to the shape ' + \
'of partlocs ({}).'.format(partlocs.shape[0])
raise ValueError(msg)
# create empty particle
ncells = partlocs.shape[0]
self.dtype = self._get_dtype(structured, particleid)
particledata = create_empty_recarray(ncells, self.dtype,
default_value=0)
# fill particle
if structured:
particledata['k'] = partlocs['k']
particledata['i'] = partlocs['i']
particledata['j'] = partlocs['j']
else:
particledata['node'] = partlocs['node']
particledata['localx'] = localx
particledata['localy'] = localy
particledata['localz'] = localz
particledata['timeoffset'] = timeoffset
particledata['drape'] = drape
if particleid:
particledata['id'] = particleids
structured : bool
Boolean indicating if a structured (True) or unstructured (False)
model (default is True).
default_value : float
Default value for float variables (default is 0).
Returns
-------
r : np.recarray
Recarray of default dtype of shape itmp
"""
dtype = ModflowMnw2.get_default_spd_dtype(structured=structured)
if aux_names is not None:
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
return create_empty_recarray(itmp, dtype, default_value=default_value)
-------
recarray : numpy recarray
Examples
--------
>>> import flopy.modpath as fmp
>>> pd = fmp.ParticleGroup.get_particledata_empty(ncells=21,
... particleid=True)
"""
# get an empty recarray that corresponds to dtype
dtype = ParticleGroup.get_particledata_dtype(structured=structured,
particleid=particleid)
return create_empty_recarray(ncells, dtype, default_value=0)