Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Release 2.7.0

This release addresses:

* Add support for HadUK Grid processes


# Release 2.6.0

This release addresses:

* Performance improvements for writing CSV files
* Work around for files with lat, ong of 0, 0
* Work around for files with lat, long of 0, 0


# Release 2.5.0
Expand All @@ -17,7 +24,7 @@ This release addresses:

This release addresses:

* Add option for users to get data as shapesiles for map products
* Add option for users to get data as shape files for map products
* Add option for users to set y-axis scale for plume plots


Expand Down
3 changes: 2 additions & 1 deletion ukcp_dp/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cartopy.crs as ccrs


VERSION = "2.6.0"
VERSION = "2.7.0"


def enum(**named_values):
Expand Down Expand Up @@ -180,6 +180,7 @@ def enum(**named_values):
COLLECTION_GCM = "land-gcm"
COLLECTION_RCM = "land-rcm"
COLLECTION_RCM_MIN_YEAR = 1980
COLLECTION_RCM_CORDEX = "land-eurocordex"
COLLECTION_RCM_GWL = "land-rcm-gwl"
COLLECTION_MARINE = "marine-sim"
COLLECTION_MARINE_MIN_YEAR = 2007
Expand Down
32 changes: 32 additions & 0 deletions ukcp_dp/data_extractor/_data_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from iris.util import unify_time_units

import cf_units
import numpy as np
from ukcp_dp.constants import (
COLLECTION_PROB,
InputType,
Expand Down Expand Up @@ -155,6 +156,7 @@ def _get_anomaly_cube(self, file_list, climatology_file_list):
self.input_data.get_value(InputType.TEMPORAL_AVERAGE_TYPE),
self.input_data.get_value(InputType.TIME_PERIOD),
self.input_data.get_value(InputType.COLLECTION),
self.input_data.get_value(InputType.VARIABLE),
)

return anomaly
Expand Down Expand Up @@ -266,6 +268,36 @@ def _get_cube(self, file_list, climatology=False, overlay_probability_levels=Fal
iris.experimental.equalise_cubes.equalise_attributes(cubes)
unify_time_units(cubes)

if collection == COLLECTION_RCM:
# we need to update the type of ensemble_member_id in order to be able to
# process Met Office and CORDEX data together
for cube in cubes:
for aux_coord in cube.aux_coords:
if aux_coord.var_name == "ensemble_member_id":
if aux_coord.dtype == np.dtype("<U27"):
# replace string23 with string46 to match CORDEX
cube.remove_coord(aux_coord)
value = aux_coord.points.astype(np.dtype("<U46"))
ensemble_coord = iris.coords.AuxCoord(
value,
units=aux_coord.units,
long_name=aux_coord.long_name,
var_name="ensemble_member_id",
)
cube.add_aux_coord(ensemble_coord, 0)
break

# the UKCP regional seasonal data has month_number, lets remove it to
# match CORDEX
if (
self.input_data.get_value(InputType.TEMPORAL_AVERAGE_TYPE)
== TemporalAverageType.SEASONAL
):
try:
cube.remove_coord("month_number")
except iris.exceptions.CoordinateNotFoundError:
pass

try:
cube = cubes.concatenate_cube()
except iris.exceptions.ConcatenateError as ex:
Expand Down
11 changes: 7 additions & 4 deletions ukcp_dp/data_extractor/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_anomaly(
temporal_average_type,
time_period,
collection,
variable,
):
"""
Generate a cube containing the anomaly values.
Expand All @@ -39,6 +40,7 @@ def get_anomaly(
type
@param time_period(str): the name of a month or season or 'all'
@param collection(str): the collection
@param variable(str): the variable
"""
if temporal_average_type == TemporalAverageType.MONTHLY:
periods = _get_selected_month_numbers(time_period)
Expand Down Expand Up @@ -75,10 +77,11 @@ def get_anomaly(
except iris.exceptions.CoordinateNotFoundError:
pass
if collection == COLLECTION_CPM:
try:
cube_absoute_period.remove_coord("yyyymm")
except iris.exceptions.CoordinateNotFoundError:
pass
if variable == "wsgmax10m":
try:
cube_absoute_period.remove_coord("yyyymm")
except iris.exceptions.CoordinateNotFoundError:
pass
try:
cube_climatology_period.remove_coord("year")
except iris.exceptions.CoordinateNotFoundError:
Expand Down
Loading