pyshqg.preprocessing.reference_data module

Submodule dedicated to the reference data.

pyshqg.preprocessing.reference_data._data_file(name)

Returns the full data file name.

Parameters:

name (str) – The name of the file.

Returns:

full_name – The full name of the file.

Return type:

pathlib.Path

pyshqg.preprocessing.reference_data._open_zarr_data(name, load)

Opens the zarr archive.

Parameters:
  • name (str) – The name of the file.

  • load (bool) – Whether to load data in memory.

Returns:

ds – The opened dataset.

Return type:

xarray.Dataset

pyshqg.preprocessing.reference_data._add_padding(x)

Adds padding to a numpy array.

Parameters:

x (np.ndarray, shape (..., Nlat, Nlon)) – Array defined in the grid.

Returns:

x – Padded array in the grid.

Return type:

np.ndarray, shape (…, Nlat+2, Nlon)

pyshqg.preprocessing.reference_data.load_reference_data(grid_truncature, padding=True, load=True)

Loads the reference data.

Parameters:
  • grid_truncature (int) – The grid truncature of the data to load.

  • padding (bool) – Whether to add padding to the data.

  • load (bool) – Whether to load data into memory.

Returns:

ds – The reference data.

Return type:

xarray.Dataset

pyshqg.preprocessing.reference_data.interpolate_data(ds, lat, lon, methods)

Interpolates the reference data.

Parameters:
  • ds (xarray.Dataset) – The reference data.

  • lat (numpy.ndarray, shape (Nlat,)) – The latitude nodes.

  • lon (numpy.ndarray, shape (Nlon,)) – The longitude nodes.

  • methods (dict of str to str) – For each variable, the interpolation method to use.

Returns:

ds – The interpolated reference data.

Return type:

xarray.Dataset

pyshqg.preprocessing.reference_data.load_test_data(internal_truncature, grid_truncature, load=True)

Loads the test data.

Parameters:
  • internal_truncature (int) – The internal truncature of the test data.

  • grid_truncature (int) – The grid truncature of the test data.

  • load (bool) – Whether to load data into memory.

Returns:

ds – The test data.

Return type:

xarray.Dataset