class foxes.input.states.FieldDataNC(foxes.core.States)[source]

Heterogeneous ambient states on a regular horizontal grid in NetCDF format.

Attributes

data_source: str or xarray.Dataset

The data or the file search pattern, should end with suffix ‘.nc’. One or many files.

ovars: list of str

The output variables

var2ncvar: dict

Mapping from variable names to variable names in the nc file

fixed_vars: dict

Uniform values for output variables, instead of reading from data

states_coord: str

The states coordinate name in the data

x_coord: str

The x coordinate name in the data

y_coord: str

The y coordinate name in the data

h_coord: str

The height coordinate name in the data

load_mode: str

The load mode, choices: preload, lazy, fly. preload loads all data during initialization, lazy lazy-loads the data using dask, and fly reads only states index and weights during initialization and then opens the relevant files again within the chunk calculation

weight_ncvar: str

Name of the weight data variable in the nc file(s)

bounds_error: bool

Flag for raising errors if bounds are exceeded

fill_value: number

Fill value in case of exceeding bounds, if no bounds error

time_format: str

The datetime parsing format string

interp_nans: bool

Linearly interpolate nan values

interpn_pars: dict, optional

Additional parameters for scipy.interpolate.interpn

bounds_extra_space: float or str

The extra space, either float in m, or str for units of D, e.g. ‘2.5D’

Public members

FieldDataNC(data_source, output_vars, var2ncvar={}, ...)[source]

Constructor.

property data_source

The data source

output_point_vars(algo)[source]

The variables which are being modified by the model.

load_data(algo, verbosity=0)[source]

Load and/or create all model data that is subject to chunking.

set_running(algo, data_stash, sel=None, isel=None, verbosity=0)[source]

Sets this model status to running, and moves all large data to stash.

unset_running(algo, data_stash, sel=None, isel=None, verbosity=0)[source]

Sets this model status to not running, recovering large data from stash

size()[source]

The total number of states.

index()[source]

The index list

weights(algo)[source]

The statistical weights of all states.

calculate(algo, mdata, fdata, tdata)[source]

The main model calculation.

reset(algo=None, states_sel=None, states_loc=None, verbosity=0)[source]

Reset the states, optionally select states

classmethod new(states_type, *args, **kwargs)[source]

Run-time states factory.

output_coords()[source]

Gets the coordinates of all output arrays

ensure_variables(algo, mdata, fdata, tdata)[source]

Add variables to tdata, initialized with NaN

run_calculation(algo, *data, out_vars, **calc_pars)[source]

Starts the model calculation in parallel, via xarray’s apply_ufunc.

__repr__()[source]

Return repr(self).

property model_id

Unique id based on the model type.

var(v)[source]

Creates a model specific variable name.

property initialized

Initialization flag.

sub_models()[source]

List of all sub-models

initialize(algo, verbosity=0, force=False)[source]

Initializes the model.

property running

Flag for currently running models

finalize(algo, verbosity=0)[source]

Finalizes the model.

get_data(variable, target, lookup='smfp', mdata=None, ...)[source]

Getter for a data entry in the model object or provided data sources