Skip to content

Commit 6048425

Browse files
#930: test run ukcm2a amip (#936)
* #930: update tmp dir space * #930: update chunking to limit filesize * #930: handle 2+ realms in global attr * #930: rename table to primary table * #930: Fix missing time coord * #930: fix missing time axis value error for clim vars * #930: update max file size for 6hr * #930: update daily sizing info
1 parent 23bced0 commit 6048425

5 files changed

Lines changed: 37 additions & 24 deletions

File tree

cdds/cdds/common/plugins/cmip7/data/model/UKCM2a-0-HH.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"ap6": "P3M",
3030
"ap7": "P3M",
3131
"ap8": "P1Y",
32-
"ap9": "P1Y",
32+
"ap9": "P6M",
3333
"apt": "P3M",
3434
"ind": "P1Y",
3535
"inm": "P5Y",
@@ -58,10 +58,10 @@
5858
"ap5": 200000,
5959
"apm": 200000,
6060
"apu": 200000,
61-
"ap6": 200000,
62-
"ap7": 200000,
63-
"ap8": 200000,
64-
"ap9": 200000,
61+
"ap6": 300000,
62+
"ap7": 300000,
63+
"ap8": 400000,
64+
"ap9": 400000,
6565
"apt": 200000,
6666
"ind": 200000,
6767
"inm": 200000,
@@ -83,29 +83,30 @@
8383
},
8484
"day": {
8585
"default": 5,
86-
"19-960-1280": 1,
87-
"19-961-1280": 1,
86+
"19-960-1280": 0.5,
87+
"19-961-1280": 0.5,
8888
"8-960-1280": 1,
8989
"8-961-1280": 1,
90-
"27-960-1280": 1,
90+
"27-960-1280": 0.5,
9191
"4-960-1280": 1,
9292
"5-960-1280": 1,
9393
"7-960-1280": 1,
94-
"7-7-960-1280": 1,
94+
"7-7-960-1280": 0.5,
9595
"4320-3604": 1,
9696
"40-960-1280": 1,
97-
"85-960-1280": 1,
98-
"85-961-1280": 1,
99-
"86-960-1280": 1
97+
"85-960-1280": 0.25,
98+
"85-961-1280": 0.25,
99+
"86-960-1280": 0.25
100100
},
101101
"6hr": {
102-
"default": 1
102+
"default": 1,
103+
"7-960-1280": 0.5
103104
},
104105
"3hr": {
105106
"default": 1
106107
},
107108
"1hr": {
108-
"default": 1
109+
"default": 0.5
109110
}
110111
},
111112
"subdaily_streams": [

cdds/cdds/qc/dataset/cmip7.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ def check_filename(self, ds, filename):
8383
valid_filename = False
8484
messages.append(f"Invalid variant_label {variant_label}")
8585

86-
table = self.global_attributes_cache.getncattr("realm", ds)
86+
primary_table = self.global_attributes_cache.getncattr("realm", ds).split(" ")[0]
8787
variable = filename_parts[0] + "_" + filename_parts[1]
88-
if table in self._mip_tables.tables:
89-
if variable not in (self._mip_tables.get_variables(table)):
88+
if primary_table in self._mip_tables.tables:
89+
if variable not in (self._mip_tables.get_variables(primary_table)):
9090
valid_filename = False
9191
messages.append(f"Invalid variable {variable} in the filename {filename}")
9292
else:
9393
valid_filename = False
94-
messages.append(f"Invalid table_id Global Attribute {table} in file {filename}")
94+
messages.append(f"Invalid table_id Global Attribute {primary_table} in file {filename}")
9595

9696
if len(filename_parts) > 8 and filename_parts[8]:
9797
try:

cdds/cdds/qc/dataset/dataset.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ def variable_time_axis(self, var_key, atmos_timestep):
188188
time_axis[filepath] = nc_file.variables["time"][:].data
189189
if "time_bnds" in nc_file.variables:
190190
time_bnds[filepath] = nc_file.variables["time_bnds"][:].data
191+
# Time variable can have bounds in the climatology_bnds variable in CMIP7 for some data sets, add them.
192+
if "climatology_bnds" in nc_file.variables:
193+
time_bnds[filepath] = nc_file.variables["climatology_bnds"][:].data
194+
self._logger.info("Adding bounds from climatology_bnds to time_bnds")
191195
frequency_code = self.global_attributes_cache.getncattr("frequency", nc_file)
192196
variable_id = self.global_attributes_cache.getncattr("variable_id", nc_file)
193197
if frequency_code == 'subhrPt':

cdds/cdds/qc/runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,8 @@ def get_ignored_messages(self):
643643
"Cell Boundaries: Bounds variable vertices_latitude and parent variable latitude have the following "
644644
"matching attributes ['units']. It is recommended that only the parent variable of the bounds variable "
645645
"contains these attributes": "non-mandatory",
646+
'Climatological Statistics: The \"time: method within years/days over years/days\" format is not correct':
647+
"removed to allow production of tas and sfcWind in CMIP7",
646648
(
647649
"the coordinate variable 'latitude' lie outside the bounding box of the "
648650
"associated boundary variable 'vertices_latitude'"

mip_convert/mip_convert/new_variable.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# (C) British Crown Copyright 2015-2025, Met Office.
1+
# (C) British Crown Copyright 2015-2026, Met Office.
22
# Please see LICENSE.md for license details.
33
# pylint: disable=no-member, eval-used, wildcard-import
44
# pylint: disable=unused-wildcard-import
@@ -231,7 +231,7 @@ def slices_over(self, period):
231231
# Slice the 'input variable(s)', since they have not yet been processed.
232232
message = '-'.join([str(items) for items in date_time])
233233
self.logger.debug('Creating data for "{}"'.format(message))
234-
sliced_input_variables = self._slice_input_variables(date_time)
234+
sliced_input_variables = self._slice_input_variables(date_time, date_times)
235235
yield Variable(sliced_input_variables, self._variable_metadata)
236236
else:
237237
# Slice the 'MIP output variable'.
@@ -844,10 +844,10 @@ def _data_dimension(self, coord, axis_direction):
844844
raise ValueError(message)
845845
return data_dimension
846846

847-
def _slice_input_variables(self, date_time):
847+
def _slice_input_variables(self, date_time, date_times):
848848
input_variables = {}
849-
if len(date_time) > 1 and date_time[1] != 12:
850-
# don't attach New Year midnight to other months
849+
if (len(date_time) > 1 and date_time[1] != 12) and date_time != date_times[-1]:
850+
# don't attach New Year midnight to months that are not december or the final chunk in the slice,
851851
new_year_midnight = False
852852
else:
853853
new_year_midnight = True
@@ -1228,10 +1228,16 @@ def _mip_table_requested_bounds(bounds):
12281228

12291229
def _setup_time_constraint(date_time, with_new_year_midnight=True):
12301230
def time_constraint(cell):
1231+
"""Runs only if with_new_year_midnight evaluates to True. Checks the current cell point and confirms if it
1232+
signifies a new year (e.g. 1980-01-01) or a new month (e.g. 1980-04-01). If so, it returns that value and
1233+
ensures that the data point is kept, hence maintaining time contiguity between slices."""
1234+
new_month = PartialDateTime(date_time[0], date_time[1] + 1, 1, 0, 0, 0, 0) if len(date_time) > 1 else ""
12311235
return (PartialDateTime(*date_time) == cell.point or
1232-
PartialDateTime(date_time[0] + 1, 1, 1, 0, 0, 0, 0) == cell.point)
1236+
PartialDateTime(date_time[0] + 1, 1, 1, 0, 0, 0, 0) == cell.point or
1237+
new_month == cell.point)
12331238

12341239
def time_constraint2(cell):
1240+
# Returns the original input cell point if with_new_year_midnight evaluates to false.
12351241
return PartialDateTime(*date_time) == cell.point
12361242

12371243
return time_constraint if with_new_year_midnight else time_constraint2

0 commit comments

Comments
 (0)