Resource handlers#

class vortex.data.handlers.Handler(rd, **kw)[source]#

The resource handler object gathers a provider, a resource and a container for any specific resource.

Other parameters given at construct time are stored as options.

get(alternate=False, **extras)[source]#

Method to retrieve the resource through the provider and feed the current container.

The behaviour of this method depends on the insitu and alternate options:

  • When insitu is True, the LocalTracker object associated with the active context is checked to determine whether the resource has already been fetched or not. If not, another try is made (but without using any non-cache store).

  • When insitu is False, an attempt to get the resource is systematically made except if alternate is defined and the local container already exists.

Example

rhandlers = vortex.input(
    kind='gridpoint',
    term=1,
    geometry='eurw1s40',
    nativefmt='grib',
    model='arome',
    cutoff='production',
    date=['2024060121', '2024060122'],
    origin='historic',
    vapp='arome',
    vconf='pefrance',
    member=[1,2,5],
    experiment='myexp',
    block='forecast',
    local='gribfile_[member].grib',
    format='grib',
)

for rh in rhandlers:
    rh.get()
locate(**extras)[source]#

Try to figure out what would be the physical location of the resource.

Returns:

A semiclon separated string listing the various locations where the resource can be found.

>>> rh = vortex.input(
...     vapp="arpege",
...     vconf="4dvarfr",
...     cutoff="production",
...     date="202506160000",
...     term=1,
...     geometry="global1798",
...     model="arpege",
...     block="forecast",
...     kind="modelstate",
...     experiment="oper",
...     local="myfile",
... )
>>> print("\n".join(rh.locate().split(";")))
/home/user/.vortex.d/arpege/4dvarfr/OPER/20250616T0000P/forecast/historic.arpege.tl1798-c22+0001:00.fa
user@archive:/data/archive/arpege/4dvarfr/OPER/2025/06/16/T0000P/forecast/historic.arpege.tl1798-c22+0001:00.fa
put(**extras)[source]#

Method to store data from the current container through the provider.

Hook functions may be applied before the put in the designated store. We will ensure that a given hook function (identified by its name) is not applied more than once to the local container.

Conversely, the low-level stores are made aware of the previous successful put. That way, a local container is not put twice to the same destination.

rhandlers = vortex.output(
    kind='gridpoint',
    term=1,
    geometry='eurw1s40',
    nativefmt='grib',
    model='arome',
    cutoff='production',
    date=['2024060121', '2024060122'],
    origin='historic',
    vapp='arome',
    vconf='pefrance',
    member=[1,2,5],
    experiment='myexp',
    block='forecast',
    local='gribfile_[member].grib',
    format='grib',
)

for rh in rhandlers:
    rh.put()
property resource#

Getter for resource property.

Example

>>> rh = vortex.input(
...     vapp="arpege",
...     vconf="4dvarfr",
...     cutoff="production",
...     date="202506160000",
...     term=1,
...     geometry="global1798",
...     model="arpege",
...     block="forecast",
...     kind="modelstate",
...     experiment="oper",
...     local="myfile",
... )
>>> print(rh.resource)
<vortex.nwp.data.modelstates.Historic object at 0x7b430874a620 | model='arpege' date='2025-06-16T00:00:00Z' cutoff='production' geometry='<vortex.data.geometries.GaussGeometry | tag='global1798' id='ARPEGE TL1798c2.2 stretched-rotated geometry' tl=1798 c=2.2>' term='01:00' subset='None'>