Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Coupled_Drivers/dr_env_lib/common_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
COMMON_ENVIRONMENT_VARS_INIT_FIN = {
'models': {'desc': ('A space separated list of all the components in this'
' run'),
'trigger': [[lambda my_val: 'cice' in my_val or 'nemo' in my_val,
'trigger': [[ my_val == 'cice' or my_val == 'nemo',
['CALENDAR', 'MODELBASIS', 'TASKSTART',
'LAST_DUMP_HOURS']],
[lambda my_val: 'cice' in my_val \
or 'nemo' in my_val or 'cpmip' in 'my_val',
[my_val == 'cice' \
or my_val == 'nemo' or my_val == 'cpmip' ,
['TASKLENGTH']],
[lambda my_val: 'um' in my_val or 'nemo' in my_val,
[my_val == 'um' or my_val == 'nemo',
['CPL_RIVER_COUNT']]]},
'RUNID': {},
'DATAM': {},
Expand Down
14 changes: 7 additions & 7 deletions Postprocessing/platforms/moo.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _collection(self):
if model_id == 'a': # Atmosphere output
if self._file_id.endswith('.nc'):
fn_facets = self._file_id.split('_')
if re.match('^[pm][a-z0-9](-.*)?$', fn_facets[-1]):
if re.match(r'^[pm][a-z0-9](-.*)?$', fn_facets[-1]):
# Use stream id for collection if provided in filename
stream_id = fn_facets[-1][1]
else:
Expand All @@ -179,20 +179,20 @@ def _collection(self):
ext = '.nc.file'
else:
file_id = self._file_id[:2]
if re.search('[mp][1-9|a-z]', file_id):
if re.search(r'[mp][1-9a-z]', file_id):
if self.convertpp:
ext = '.pp'
else:
ext = '.file'
elif re.search('v[1-5|a-j|lmsvy]', file_id):
elif re.search(r'v[1-5a-jlmsvy]', file_id):
ext = '.pp'
elif re.search('n[1-9|a-m|s-z]', file_id):
elif re.search(r'n[1-9a-ms-z]', file_id):
ext = '.nc.file'
elif re.search('b[a-j|mxy]', file_id):
elif re.search(r'b[a-jmxy]', file_id):
ext = '.file'
elif re.search('d[amsy]', file_id):
elif re.search(r'd[amsy]', file_id):
ext = '.file'
elif re.search('r[a-m|qstuvwxz]', file_id):
elif re.search(r'r[a-mqstuvwxz]', file_id):
ext = '.file'

elif model_id in 'io': # NEMO/CICE means and restart dumps
Expand Down
10 changes: 5 additions & 5 deletions Postprocessing/unittests/test_verify_expected.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def test_expected_unicicles_dumps_final(self):
expect = ['PREFIXc_19960101_bisicles-AIS_restart.hdf5',
'PREFIXc_19960101_glint-GrIS_restart.nc',
'PREFIXc_19970101_bisicles-AIS_restart.hdf5',
'PREFIXc_19970101_glint-GrIS_restart.nc'
'PREFIXc_19970101_glint-GrIS_restart.nc',
'PREFIXc_19980101_bisicles-AIS_restart.hdf5',
'PREFIXc_19980101_glint-GrIS_restart.nc']

Expand Down Expand Up @@ -1097,13 +1097,13 @@ def test_expected_atmos_ppff(self):
'PREFIXa.p11998aug.pp', 'PREFIXa.p11998sep.pp'],
'amd.pp': ['PREFIXa.md19950811_00.pp', 'PREFIXa.md19950811_10.pp',
'PREFIXa.md19981029_18.pp', 'PREFIXa.md19981030_04.pp'],
'anb.nc.file': [r'atmos_prefixa_\d+[hdmsyx]_19950811-19951111_'
'anb.nc.file': [r'atmos_prefixa_\d+[hdmsyx]_19950811-19951111_'+
r'[a-zA-Z0-9\-]*\.nc$',
r'atmos_prefixa_\d+[hdmsyx]_19951111-19960211_'
r'atmos_prefixa_\d+[hdmsyx]_19951111-19960211_'+
r'[a-zA-Z0-9\-]*\.nc$',
r'atmos_prefixa_\d+[hdmsyx]_19980211-19980511_'
r'atmos_prefixa_\d+[hdmsyx]_19980211-19980511_'+
r'[a-zA-Z0-9\-]*\.nc$',
r'atmos_prefixa_\d+[hdmsyx]_19980511-19980811_'
r'atmos_prefixa_\d+[hdmsyx]_19980511-19980811_'+
r'[a-zA-Z0-9\-]*\.nc$']
}
expected = self.files.expected_diags()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
'''
*****************************COPYRIGHT******************************
(C) Crown copyright 2021-2025 Met Office. All rights reserved.
(C) Crown copyright 2021-2026 Met Office. All rights reserved.

Use, duplication or disclosure of this code is subject to the restrictions
as set forth in the licence. If no licence has been raised with this copy
Expand Down Expand Up @@ -88,7 +88,7 @@ def test_correct_values(self, mock_stderr):
'''Test that with correct values we return nothing, and stderror is
not called'''
for val in [-1, 0, 1, 2, 3]:
self.assertIsNone(generate_nam_s1.check_nlogprt_val2(val))
assert generate_nam_s1.check_nlogprt_val2(val) == None
mock_stderr.assert_not_called()

@mock.patch('generate_nam_s1.sys.stderr.write')
Expand Down
34 changes: 17 additions & 17 deletions Utilities/ozone_redistribution/unittests/test_ozone.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,26 +244,26 @@ def test_skip_redistribution(self):

expected_cmds = [
# Nullify further ozone tasks this cycle
'cylc broadcast u-aa000 -n redistribute_ozone -p 19950101T0000Z '
'-s script="echo [INFO] No redistribution required in the '
'cylc broadcast u-aa000 -n redistribute_ozone -p 19950101T0000Z '+
'-s script="echo [INFO] No redistribution required in the '+
'first year of simulation" -s post-script=""',
'cylc broadcast u-aa000 -n rose_arch_ozone -p 19950101T0000Z '
'-s script="echo [INFO] No redistribution required in the '
'cylc broadcast u-aa000 -n rose_arch_ozone -p 19950101T0000Z '+
'-s script="echo [INFO] No redistribution required in the '+
'first year of simulation" -s post-script=""',
# Update ozone ancillary for remaining UM tasks this year
'cylc broadcast u-aa000 -n coupled '
'-p 19950101T0000Z -p 19950111T0000Z -p 19950121T0000Z '
'-p 19950201T0000Z -p 19950211T0000Z -p 19950221T0000Z '
'-p 19950301T0000Z -p 19950311T0000Z -p 19950321T0000Z '
'-p 19950401T0000Z -p 19950411T0000Z -p 19950421T0000Z '
'-p 19950501T0000Z -p 19950511T0000Z -p 19950521T0000Z '
'-p 19950601T0000Z -p 19950611T0000Z -p 19950621T0000Z '
'-p 19950701T0000Z -p 19950711T0000Z -p 19950721T0000Z '
'-p 19950801T0000Z -p 19950811T0000Z -p 19950821T0000Z '
'-p 19950901T0000Z -p 19950911T0000Z -p 19950921T0000Z '
'-p 19951001T0000Z -p 19951011T0000Z -p 19951021T0000Z '
'-p 19951101T0000Z -p 19951111T0000Z -p 19951121T0000Z '
'-p 19951201T0000Z -p 19951211T0000Z -p 19951221T0000Z '
'cylc broadcast u-aa000 -n coupled '+
'-p 19950101T0000Z -p 19950111T0000Z -p 19950121T0000Z '+
'-p 19950201T0000Z -p 19950211T0000Z -p 19950221T0000Z '+
'-p 19950301T0000Z -p 19950311T0000Z -p 19950321T0000Z '+
'-p 19950401T0000Z -p 19950411T0000Z -p 19950421T0000Z '+
'-p 19950501T0000Z -p 19950511T0000Z -p 19950521T0000Z '+
'-p 19950601T0000Z -p 19950611T0000Z -p 19950621T0000Z '+
'-p 19950701T0000Z -p 19950711T0000Z -p 19950721T0000Z '+
'-p 19950801T0000Z -p 19950811T0000Z -p 19950821T0000Z '+
'-p 19950901T0000Z -p 19950911T0000Z -p 19950921T0000Z '+
'-p 19951001T0000Z -p 19951011T0000Z -p 19951021T0000Z '+
'-p 19951101T0000Z -p 19951111T0000Z -p 19951121T0000Z '+
'-p 19951201T0000Z -p 19951211T0000Z -p 19951221T0000Z '+
'-s [environment]OZONE_ANCIL=ancil1990file'
]
self.assertListEqual(mock_exec.mock_calls,
Expand Down