Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By default, Metview will apply any scale_factor and add_offset attributes for the current variable. This behaviour can be toggled using the function netcdf_auto_scale_values().

Missing values (Metview 5)

By default, Metview will check the _FillValue attribute of the current variable and will not include any such values in its calculations. This behaviour can be toggled using the function netcdf_preserve_missing_values().

Working with multi-variable NetCDF files

...

Users can list the variables held in a netcdf variable by means of the function variables() :

     var_list = variables(netcdf)

...

To set one of the existing variables to be the current variable, use function setcurrent(), which takes the index (starting at 1) of the desired variable:

...

If you need to have access to the data values of a netcdf current variable, you can use function values() :

     val_list = values(netcdf)

...

An alternative method for accessing individual values is to the use the function value() :

    val = value(netcdf, n)

which returns the nth value from the current netcdf variable.

...

Variables which are detected to be of 'time' type (e.g. attribute standard_name='time', plus other checks) are, by default, retrieved by the value() and values() functions as a date or a list of dates. This behaviour can be toggled calling the function netcdf_auto_translate_times() with an argument of 1 or 0 to activate/deactivate the translation to dates. If deactivated, the value() and values() functions will instead return a number or a vector of raw numbers as they are encoded in the variable.

...

If Metview performs a computation on a variable which results in its values overflowing the data type used to pack the values in the netCDF variable (e.g. adding 3000 to the values of a Byte variable), and the variable has scale_factor and add_offset attributes, Metview will compute new scale_factor and add_offset attributes so that the values can be packed within the data type, making best use of its data range. In this case, the _FillValue may be modified too.
This rescaling will not be performed if these attributes are not defined for the current variable, or if Metview has been instructed to ignore them (via the netcdf_auto_scale_values() function).
The automatic rescaling behaviour can be toggled on or off via the netcdf_auto_rescale_values_to_fit_packed_type() function. If disabled, and the computed values overflow the data type, the macro will fail.

...