2.5.3.1.4. vacumm.data.model.swan
– SWAN wave model¶
-
class
SWAN
(dataset=None, time=None, lon=None, lat=None, level=None, ncobj_specs=None, nopat=False, patfreq=None, patfmtfunc=None, sort=True, check=True, **kwargs)[source]¶ Bases:
vacumm.data.misc.dataset.OceanSurfaceDataset
Dataset
class to read the SWAN wave model outputsRead the
Dataset
for more information-
apply_config
(config, **kwargs)¶ Apply passed configuration (usually internal call from load_config)
Call
apply_config()
and load datasets (if config has a Catalog section)
-
classmethod
apply_default_config
(config=None, encoding=None)¶ This will turn on debug mode of various features (config, objects stats) if the loglevel of nested Logger configuration is debug.
Set the default log level for the newly created objects based on nested Logger configuration.
Subclasses may override this to apply/update according to the new config
Params: - config: The new config loaded by
load_default_config()
.
Note
- overriding this method will obviously shunt its default beahvior, you’ll then have to call original method if needed
- config: The new config loaded by
-
arakawa_grid_type
= None¶
-
auto_generic_var_names
= ['sst', 'sss', 'ssh', 'usurf', 'vsurf']¶
-
close
()¶
-
config
¶ Current configuration
-
critical
= <bound class method SWAN.wrapper>¶
-
debug
= <bound class method SWAN.wrapper>¶
-
classmethod
describe
(obj, **kwargs)¶
-
description
= 'SWAN wave model'¶
-
domain
= 'wave'¶
-
error
= <bound class method SWAN.wrapper>¶
-
exception
= <bound class method SWAN.wrapper>¶
-
classmethod
exception_trace
()¶ Return a huge detailed exception traceback
-
finalize_object
(var, genname=None, format=<built-in function format>, squeeze=False, order=None, asvar=None, torect=True, atts=None, lon=None, lat=None, curvsel=None, at=None, **kwargs)¶ Finalize a variable or an axis
Params: - genname, optional: Generic name to format the variable.
- format, optional: Format the variable and its axes with
format_var()
? - atts, optional: Set these attributes to the variable.
- squeeze, optional: If not False, squeeze singletons axes using
squeeze_variable()
. - order, optional: If not None, change the axes order of the variable. It must contains letters like ‘txyz-‘.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar_<param>: Param passed to
grow_variables()
. - torect, optinal: Try to convert curvilinear grid to rectangular
grid using
curv2rect()
. - lon/lat, optional: Additional spatial selection.
- curvsel, optional:
CurvedSelector
instance. - at/toloc: Interpolate the variable to another location on the grid
using
toloc()
. Note that thearakawa_grid_type
must be defined.
-
classmethod
from_config
(config, *args, **kwargs)¶ Create a cls instance using args and kwargs and load config.
The nested named argument (in kwargs) is extracted before creating the instance and then passed to load_config.
Params: - config: A configuration file (str) or object (ConfigObj).
- args and kwargs: Passed to the object constructor, without parmeters described above.
Return: - The created object of class cls
-
classmethod
func_name
(iframe=0)¶
-
get
(varname, **kwargs)¶ Generic way to get a variable
It first tries to find a
get_*
method, then callget_variable()
if no method is found.
-
get_axis
(name, select=None, select2=None, dataset=None, warn=True, getid=False, searchmode=None, format=True)¶ Retreive a 1D or 2D axis.
Params: - name: Generic axis name.
- select optional: Selection along this axis. Only slices are accepted for 2D axes.
- select2 optional: Selection on the other dimension for 2D axes.
- dataset optional: find axis based on this dataset.
- getid, optional: If True, only return the id (netcdf name) or None.
- warn, optional: Display a warning in case of problem.
- searchmode, optional: Search order (see
ncfind_obj()
). - format, optional: Format the axis using
format_axis()
?
Return: - cdms2 axis or None if not found, or id
-
classmethod
get_class_logger
()¶ Return the
Logger
instance bound to this class.
-
get_config
(copy=True)¶ Get the instance’s config
-
classmethod
get_config_manager
(reload=False, encoding=None)¶ Get the configuration manager for this class (cls). This manager and its underlying configuration specification must not be dynamically changed as it is fixed at design time.
Note
this method is also the config manager lazy loader
-
classmethod
get_config_section_name
()¶ Return (and define) the class specification section name
-
classmethod
get_config_spec
()¶ Load the config specs as ConfigObj object
It merges the specs of the current class and those of parents classes
-
classmethod
get_config_spec_file
()¶ Return (and define) the class specification file path
-
get_config_str
()¶ Get the instance’s config as a string
-
get_corio
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the coriolis parameter [s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_corio_f
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the coriolis parameter at F location [s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_corio_t
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the coriolis parameter at T location [s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_corio_u
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the coriolis parameter at U location [s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_corio_v
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the coriolis parameter at V location [s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_ctime
(*args, **kwargs)¶ Get time axis as a list of
cdtime.comptime
It is a simple shortcut to:
>>> ds.get_time().asComponentTime()
Params: All arguments are passed to get_time()
-
classmethod
get_default_config
(encoding=None)¶ Get the default configuration (copy)
-
classmethod
get_default_config_str
(encoding=None)¶ Get the default configuration as a string
-
get_dx
(**kwargs)¶ Get the grid resolution along X
It can be stored as an variable or computed from coordinates.
-
get_dx_u
(**kwargs)¶ Get the grid resolution along X at U location
-
get_dx_v
(**kwargs)¶ Get the grid resolution along X at V location
-
get_dy
(**kwargs)¶ Get the grid resolution along Y
It can be stored as an variable or computed from coordinates.
-
get_dy_u
(**kwargs)¶ Get the grid resolution along Y at U location
-
get_dy_v
(**kwargs)¶ Get the grid resolution along Y at V location
-
get_grid
(**kwargs)¶
-
get_grid_f
(**kwargs)¶
-
get_grid_f_old
(lon=None, lat=None, format=True, warn=True)¶ Get grid at F location
-
get_grid_t
(**kwargs)¶
-
get_grid_t_old
(lon=None, lat=None, format=True, warn=True)¶ Get grid at T location
-
get_grid_u
(**kwargs)¶
-
get_grid_u_old
(lon=None, lat=None, format=True, warn=True)¶ Get grid at U location
-
get_grid_v
(**kwargs)¶
-
get_grid_v_old
(lon=None, lat=None, format=True, warn=True)¶ Get grid at V location
-
get_hsection
(varname, depth, time=None, lat=None, lon=None, timeavg=False, warn=True, **kwargs)¶ Get a horizontal section of a variable for a specified depth
Params: - varname: Generic var name.
- depth: Target depth.
- timeavg, optional: Time average of results.
- depth_<param>, optional: Param is passed to
get_depth()
. - interp_<param>, optional: Param is passed to
interp1d()
.
-
get_lat
(lat=None, lon=None, **kwargs)¶ Get latitude axis
-
get_lat_f
(lat=None, lon=None, **kwargs)¶ Get latitude axis at F location
-
get_lat_t
(lat=None, lon=None, **kwargs)¶ Get latitude axis at T location
-
get_lat_u
(lat=None, lon=None, **kwargs)¶ Get latitude axis at U location
-
get_lat_v
(lat=None, lon=None, **kwargs)¶ Get latitude axis at V location
-
get_latitude
(lat=None, lon=None, **kwargs)¶ Get latitude axis
-
get_level
(level=None, **kwargs)¶ Get level axis, based on
get_axis()
-
get_logger
= <bound class method SWAN.get_logger>¶
-
get_loglevel
= <bound class method SWAN.wrapper>¶
-
get_lon
(lon=None, lat=None, **kwargs)¶ Get longitude axis
-
get_lon_f
(lon=None, lat=None, **kwargs)¶ Get longitude axis at F location
-
get_lon_t
(lon=None, lat=None, **kwargs)¶ Get longitude axis at T location
-
get_lon_u
(lon=None, lat=None, **kwargs)¶ Get longitude axis at U location
-
get_lon_v
(lon=None, lat=None, **kwargs)¶ Get longitude axis at V location
-
get_longitude
(lon=None, lat=None, **kwargs)¶ Get longitude axis
-
classmethod
get_parent_config_spec
()¶ Get the merged config specifications of all parents
-
get_resol
(degrees=False, at='t', mode=None, warn=True, **kwargs)¶ Get the horizontal grid resolutions
Params: - degrees, optional: In degrees or meters?
- local, optional: Get resolution at each point?
Return: dx,dy
See also:
-
get_selector
(time=None, lon=None, lat=None, level=None, merge=True, only=None, split=False, **kwargs)¶ Get a cdms2.selectors.Selector from specified time/lat/lon/level selection
Params: - time/lon/lat/level, optional: Refine or set the selector with these components.
- only, optional: Work only on one component, like “time” or “t”.
- merge, optional: Merge with selector created at initialization time (stored
in attribute
selector
.) - split, optional: return a splitted selector (see
split_selector()
)
-
get_seltimes
(time=None)¶ Get a zero to two elements time selector specifications
It is the addition of non global and local time selection specs
-
get_shape
(dims='tzyx', warn=True)¶ Get the dataset shape from known generic dims
Params: - dims, optional: Letters that select the generic dimensions to consider.
Return: A tuple of the size of dimensions. If a requested dim is not found, None is returned for its size.
-
get_ssh
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface height [m]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_sss
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface salinity [PSU]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_sst
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface temperature [degrees_celsius]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_time
(time=None, var=None, ids=None, warn=True, **kwargs)¶ Load time axis in a best time serie fashion.
Params: - time: time selector
-
get_time_res
()¶ Get the estimated time resolution, based on the two first time coordinates
Return: - resolution as datetime.timedelta
-
get_timeid
(warn=False)¶ Get the time id
-
get_transect
(varname, lons, lats, times=None, method='bilinear', subsamp=3, getcoords=False, timeavg=False, outaxis=None, time=None, lon=None, lat=None, level=None, warn=True, **kwargs)¶ Get a transect between two points
It uses
transect()
.Params: varname: Generic var name.
lons/lats: Specification of transect, either
- Coordinates of first and last point in degrees as
tuples in the form
(lon0,lon1)
and(lat0,lat1)
. The array of coordinates is generated usingtransect_specs()
. - Or explicit array of coordinates (as scalars, lists or arrays).
- Coordinates of first and last point in degrees as
tuples in the form
times, optional: For time transect too.
subsamp, optional: Subsampling with respect to grid cell.
method, optional: Interpolation method (see
grid2xy()
).getcoords, optional: Also get computed coordinates.
outaxis, optional: Output axis.
- A cdms2 axis.
None
or'auto'
: Longitudes or latitudes depending on the range.'lon'
or'x'
: Longitudes.'lat'
or'y'
: Latitudes.'dist'
or'd'
: Distance in km.
timeavg, optional: Time average of results.
Return: tvar
ortvar,tlons,tlats
-
get_usurf
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along X [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_usurf_t
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along X at T location [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_usurf_u
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along X at U location [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_usurf_v
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along X at V location [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_variable
(varname, time=None, lon=None, lat=None, level=None, atts=None, squeeze=False, order=None, asvar=None, torect=True, depthup=None, verbose=None, warn=True, searchmode='is', format=True, at=None, grid=None, **kwargs)¶ Load a variable in a best time serie fashion.
Params: - varname: Either a generic variable name listed in
CF_VAR_SPECS
, a netcdf name with a ‘+’ a prefix, a tuple of netcdf variable names or dictionnary of specification names with a search argument ofncfind_var()
(tuple of netcdf names or dictionary). - time/lon/lat/level: Selector components.
- squeeze: If true, call
squeeze_variable()
on the returned variable. - order: If not None, specify the output variable axes order.
- depthup: Make depths up.
- torect: Make grid rectangular if possible.
- at/toloc: Interpolate the variable to another location on the grid
using
toloc()
. Note that thearakawa_grid_type
must be defined. - format: Format the variable and its axes using
format_var()
? - warn: Display a warning message if the variable can”t be retreived.
- Other kwargs are passed to
ncread_files()
.
Return: cdms2 variable or None if not found
Example: >>> get_variable('ssh', lon=(-10,0)) >>> get_variable('+xe') >>> get_variable(dict(search={'standard_name':'sea_surface_height_above_sea_level'}))
- varname: Either a generic variable name listed in
-
get_variable_names
()¶ Get the list of netcdf variable names of the first file
-
get_vsurf
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along Y [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_vsurf_t
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along Y at T location [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_vsurf_u
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along Y at U location [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
get_vsurf_v
(time=None, level=None, lat=None, lon=None, squeeze=False, order=None, asvar=None, at=None, format=None, torect=True, verbose=None, warn=None, mode=None, **kwargs)¶ Read the sea surface velocity along Y at V location [m s-1]
Params: - time/level/lat/lon, optional: For selection (tuples or slices).
- squeeze, optional: Squeeze singleton dimensions
(see
squeeze_variable()
, likeTrue
,z
or['x','y']
). - mode, optional: Retreiving mode
"var"
: Get from netcdf variable only."stag"
: Get it from another grid location.
- asvar, optional: Grow variable to match the
asvar
variable, usinggrow_variables()
. - asvar, optional: Reshape as this variable.
- at, optional: Interpolate to this grid location using
Datatset.toloc()
. - format, optional: Format the variable and its axes using
format_var()
. - torect, optional: If possible, convert a curvilinear grid to
a rectilinar grid using
curv2rect()
. - order, optional: Change order of axes (like
'xty'
). - Other keywords are passed to
ncread_files()
.
-
info
= <bound class method SWAN.wrapper>¶
-
classmethod
init_class
(name, bases, dct)¶ Redefine this method if you need class initialization
-
is_debug
= <bound class method SWAN.wrapper>¶
-
is_verbose
= <bound class method SWAN.wrapper>¶
-
classmethod
kwfilter
(kwargs, filters=None, *args, **kwa)¶ Shortcut to
vacumm.misc.misc.kwfilter()
with a filters argument which defaults to this class lowercase name.
-
load_config
(config=None, nested=None, apply=True, cfgpatch=None, encoding=None, **kwargs)¶ Load / update the instance configuration
Params: - config: A configuration file (str) or object (ConfigObj) or
None to load defaults, or an
ArgumentParser
object. - nested: Load from a nested config section instead of the whole config.
- If True, use the section name returned by
get_config_section_name()
Else if a string, use the section name defined by the nested string
- cfgpatch: A manual patch to apply to the config once loaded.
- Other options are passed to
arg_parse()
.
Return: A
ConfigObj
object orConfigObj
,options tuple if anArgumentParser
object has been passed- config: A configuration file (str) or object (ConfigObj) or
None to load defaults, or an
-
load_dataset
(dataset, time=None, **kwargs)¶ Load dataset files.
Params: - dataset: can be either:
- an instance or list of strings (filepath/filepattern/url) that
will be passed to
list_forecast_files()
. - an instance of
Catalog
- an instance or list of strings (filepath/filepattern/url) that
will be passed to
- time: used with
Catalog.find_datasets()
when dataset is a string (or list of strings). - Extra keywords are passed to
list_forecast_files()
(viaCatalog.find_datasets()
).
Keyword parameters: - append: keep previously loaded datasets if True
Return: The list of (newly) loaded datasets
Example: >>> d.load_dataset('../../data/model/mars/champs_%Y%m_BOBI.nc', ('2004-01-01', '2004-04-01'), patfreq=(2,'month'), verbose=True) [2013-01-14 09:42:43 CET Catalog INFO] Searching datasets using pattern: ['../../data/model/mars/champs_%Y%m_BOBI.nc'], time: ('2004-01-01', '2004-04-01') Guessing file list using: filepattern: ../../data/model/mars/champs_%Y%m_BOBI.nc time selector: ('2004-01-01', '2004-03-31') Found 2 files [2013-01-14 09:42:43 CET Catalog INFO] Found 2 datasets [2013-01-14 09:42:43 CET Dataset INFO] Loading datasets: [2013-01-14 09:42:43 CET Dataset INFO] - ../../data/model/mars/champs_200401_BOBI.nc [2013-01-14 09:42:43 CET Dataset INFO] - ../../data/model/mars/champs_200403_BOBI.nc
-
classmethod
load_default_config
(config=None, nested=None, apply=True, encoding=None)¶ Load / update the class (unique) default configuration
-
logger
¶ A
Logger
instance. You can use this object for all logging operations related to this class
-
name
= 'swan'¶
-
ncobj_specs
= {}¶
-
notice
= <bound class method SWAN.wrapper>¶
-
notset
= <bound class method SWAN.wrapper>¶
-
options
¶ Options loaded from the commandline parser or None
-
classmethod
pformat
(obj, indent=2, width=80, depth=None)¶ Pretty print an object
-
plot_hsection
(varname, depth, time=None, lat=None, lon=None, timeavg=False, title='%(long_name)s at %(depth)im', mask_land=False, **kwargs)¶ Plot a horizontal section of a variable for a specified depth
Section is computed with
get_hsection()
.Params: - varname: Generic var name.
- depth: Target depth.
- timeavg, optional: Time average of results.
- depth_<param>, optional: Param is passed to
get_depth()
. - interp_<param>, optional: Param is passed to
interp1d()
. - Other arguments are passed to
map2()
.
-
plot_transect
(varname, lons, lats, times=None, method='bilinear', timeavg=False, subsamp=3, outaxis=None, time=None, lon=None, lat=None, level=None, title='%(long_name)s along transect', minimap=None, **kwargs)¶ Plot a transect between two points
Params: - varname: Generic var name.
- lons/lats/times: Specification of transect (see
get_transect()
). - title, optional: Title of the figure.
- minimap, optional: If True, add a minimap showing the transect on a map; if False, display nothing; if None, display if no minimap already displayed.
- minimap_<param>, optional: Passed to
add_map_lines()
. - Some params are passed to
get_transect()
. - Other params are passed to the plot function
curve2()
for 1D plots and,hov2()
orsection2()
for 2D plots.
-
save_config
(outfile=None, nested=None)¶
-
classmethod
set_class_logger
(logger)¶ Set the
Logger
instance bound to this class.
-
set_logger
= <bound class method SWAN.set_logger>¶
-
set_loglevel
= <bound class method SWAN.wrapper>¶
-
shape
¶ Generic shape of the dataset
-
classmethod
squeeze_variable
(var, spec=True)¶ Squeeze a variable, preserving remaining axis
See also: vacumm.misc.misc.squeeze_variable()
-
static
stack_trace
(iframe=0)¶
-
toloc
(var, loc, fromloc=None, copy=False, **kwargs)¶ Interpolate a variable to another location
It has no effect if the current
Dataset
instance has no validarakawa_grid_type
defined (None
).Params: - var: A CDAT array.
- loc: A physical location (see
vacumm.data.misc.arakawa.ARAKAWA_LOCATIONS
). - fromloc, optional: Originating location. If
None
it is guessed from its attributes (id, standard_name and long_name), and default toDEFAULT_LOCATION
). - Extra keywords are passed to
vacumm.data.misc.arakawa.ArakawaGrid.loc2loc()
.
-
torect
(var, curvsel=None)¶ Place a variable on rectangular grid if possible using
curv2rect()
Params: - var: CDAT variable or grid.
-
classmethod
trace
(iframe=0, iftty=True)¶ Start pdb debugger
Params: - iframe: frame index entry point of the debugger, relative to the caller
- iftty: if True, disable this call in a non interactive execution
Note
- For debugging purpose only: do not let trace calls in a production environment, even if an interactive test is done !
-
verbose
= <bound class method SWAN.wrapper>¶
-
warning
= <bound class method SWAN.wrapper>¶
-