virtualargofleet.Velocity#
- Velocity(model: str = 'GLOBAL_ANALYSIS_FORECAST_PHY_001_024', *args: object, **kwargs: object) object #
Function to return a
VelocityField
instance for known productsNote that you can provide a
VelocityField
orVelocityField.fieldset
to aVirtualFleet
instance.- Parameters:
model (str) –
- Indicate which model to use by its string definition. Possible values are:
custom
if you want to set your own model definitionGLORYS12V1
,PSY4QV3R1
,GLOBAL_ANALYSIS_FORECAST_PHY_001_024
MEDSEA_ANALYSISFORECAST_PHY_006_013
ARMOR3D
,MULTIOBS_GLO_PHY_TSUV_3D_MYNRT_015_012
- Return type:
Examples
Import the module and define the root folder to data:
>>> from virtualargofleet import Velocity >>> root = "/home/datawork-lops-oh/somovar/WP1/data/GLOBAL-ANALYSIS-FORECAST-PHY-001-024"
And then define a velocity field with one of the following 3 methods:
1/ with a
custom
product:>>> filenames = {'U': root + "/20201210*.nc", >>> 'V': root + "/20201210*.nc"} >>> variables = {'U':'uo','V':'vo'} >>> dimensions = {'time': 'time', 'depth':'depth', 'lat': 'latitude', 'lon': 'longitude'} >>> VELfield = Velocity(model='custom', src=filenames, variables=variables, dimensions=dimensions)
2/ with a
xarray.Dataset
:>>> ds = xr.open_mfdataset(glob.glob("%s/20201210*.nc" % root)) >>> VELfield = Velocity(model='GLOBAL_ANALYSIS_FORECAST_PHY_001_024', src=ds)
3/ with a file path pattern:
>>> VELfield = Velocity(model='GLORYS12V1', src="%s/20201210*.nc" % root)