1 clim_recal.utils.data

clim_recal.utils.data

1.1 Attributes

Name Description
BoundsTupleType GeoPandas bounds: (minx, miny, maxx, maxy).
DEFAULT_INTERPOLATION_METHOD Default method to infer missing estimates in a time series.
GlasgowCoordsEPSG27700 Glasgow box coordinates in 27700 grid.
LondonCoordsEPSG27700 London box coordinates in 27700 grid.
MONTH_DAY_XARRAY_LEAP_YEAR_DROP A set of month and day tuples dropped for xarray.day_360 leap years.
MONTH_DAY_XARRAY_NO_LEAP_YEAR_DROP A set of month and day tuples dropped for xarray.day_360 non leap years.
ManchesterCoordsEPSG27700 Manchester box coordinates in 27700 grid.
ScotlandCoordsEPSG27700 Scotland box coordinates in 27700 grid.
THREE_CITY_CENTRE_COORDS City centre (lon, lat) tuple coords of Glasgow, Manchester and London.
XArrayEngineType Engine types supported by xarray as str.

1.2 Classes

Name Description
BoundingBoxCoords A region name and its bounding box coordinates.
DataLicense Class for standardising data license references.
MetaData Manage info on source material.
MethodOptions Supported options for methods.
RegionOptions Supported options for variables.
RunOptions Supported options for variables.
VariableOptions Supported variables options and related configuration.

1.2.1 BoundingBoxCoords

clim_recal.utils.data.BoundingBoxCoords(self, name, xmin, xmax, ymin, ymax, epsg=BRITISH_NATION_GRID_COORDS_NUMBER)

A region name and its bounding box coordinates.

1.2.1.1 Attributes

Name Description
rioxarry_epsg Return self.epsg in rioxarray str format.

1.2.1.2 Methods

Name Description
as_rioxarray_dict Return coords as dict
as_rioxarray_tuple Return in xmin, xmax, ymin, ymax order.
1.2.1.2.1 as_rioxarray_dict

clim_recal.utils.data.BoundingBoxCoords.as_rioxarray_dict()

Return coords as dict

1.2.1.2.2 as_rioxarray_tuple

clim_recal.utils.data.BoundingBoxCoords.as_rioxarray_tuple()

Return in xmin, xmax, ymin, ymax order.

1.2.2 DataLicense

clim_recal.utils.data.DataLicense(self, name, url, version)

Class for standardising data license references.

1.2.3 MetaData

clim_recal.utils.data.MetaData(self, name, slug, region=None, description=None, date_created=None, authors=None, url=None, info_url=None, doi=None, path=None, license=lambda: OpenGovernmentLicense(), dates=None, date_published=None, unit=None, cite_as=None)

Manage info on source material.

1.2.4 MethodOptions

clim_recal.utils.data.MethodOptions()

Supported options for methods.

1.2.4.1 Methods

Name Description
all Return a tuple of all options
default Default method option.
1.2.4.1.1 all

clim_recal.utils.data.MethodOptions.all()

Return a tuple of all options

1.2.4.1.2 default

clim_recal.utils.data.MethodOptions.default()

Default method option.

1.2.5 RegionOptions

clim_recal.utils.data.RegionOptions()

Supported options for variables.

1.2.5.1 Methods

Name Description
all Return a tuple of all options
bounding_box dict for accessing bounding boxes of included Regions.
default Default option.
1.2.5.1.1 all

clim_recal.utils.data.RegionOptions.all()

Return a tuple of all options

1.2.5.1.2 bounding_box

clim_recal.utils.data.RegionOptions.bounding_box(region_name)

dict for accessing bounding boxes of included Regions.

1.2.5.1.3 default

clim_recal.utils.data.RegionOptions.default()

Default option.

1.2.6 RunOptions

clim_recal.utils.data.RunOptions()

Supported options for variables.

1.2.6.1 Notes

Options TWO and THREE are not available for UKCP2.2.

1.2.6.2 Methods

Name Description
all Return a tuple of all options
default Default option.
preferred Return the preferred runs determined by initial results.
preferred_and_first Return the preferred and first runs.
1.2.6.2.1 all

clim_recal.utils.data.RunOptions.all()

Return a tuple of all options

1.2.6.2.2 default

clim_recal.utils.data.RunOptions.default()

Default option.

1.2.6.2.3 preferred

clim_recal.utils.data.RunOptions.preferred()

Return the preferred runs determined by initial results.

1.2.6.2.3.1 Notes

See R/misc/Identifying_Runs.md for motivation and results.

1.2.6.2.4 preferred_and_first

clim_recal.utils.data.RunOptions.preferred_and_first()

Return the preferred and first runs.

1.2.7 VariableOptions

clim_recal.utils.data.VariableOptions()

Supported variables options and related configuration.

1.2.7.1 Methods

Name Description
all Return a tuple of all options
cpm_value Return CPM value equivalent of variable.
cpm_values Return CPM values equivalent of variable.
default Default option.
default_resample_method Default resampling method.
resampling_method Return resampling method for variable.
1.2.7.1.1 all

clim_recal.utils.data.VariableOptions.all()

Return a tuple of all options

1.2.7.1.2 cpm_value

clim_recal.utils.data.VariableOptions.cpm_value(variable)

Return CPM value equivalent of variable.

1.2.7.1.2.1 Parameters
Name Type Description Default
variable str VariableOptions attribute to query value of. required
1.2.7.1.2.2 Examples
>>> VariableOptions.cpm_value('rainfall')
'pr'
>>> VariableOptions.cpm_value('tasmin')
'tasmin'
1.2.7.1.3 cpm_values

clim_recal.utils.data.VariableOptions.cpm_values(variables=None)

Return CPM values equivalent of variable.

1.2.7.1.3.1 Parameters
Name Type Description Default
variables Iterable[str] | None VariableOptions attributes to query values of. None
1.2.7.1.3.2 Examples
>>> VariableOptions.cpm_values(['rainfall', 'tasmin'])
('pr', 'tasmin')
1.2.7.1.4 default

clim_recal.utils.data.VariableOptions.default()

Default option.

1.2.7.1.5 default_resample_method

clim_recal.utils.data.VariableOptions.default_resample_method()

Default resampling method.

1.2.7.1.6 resampling_method

clim_recal.utils.data.VariableOptions.resampling_method(variable)

Return resampling method for variable.

For details see: https://rasterio.readthedocs.io/en/stable/api/rasterio.enums.html#rasterio.enums.Resampling

1.2.7.1.6.1 Parameters
Name Type Description Default
variable str | None VariableOptions attribute to query resampling method from. required
1.2.7.1.6.2 Returns
Type Description
Value to access related resampling method.
1.2.7.1.6.3 Examples
>>> VariableOptions.resampling_method('rainfall')
<Resampling.average: 5>
>>> VariableOptions.resampling_method('tasmin')
<Resampling.min: 9>
>>> VariableOptions.resampling_method(None)
<Resampling.average: 5>
Back to top