This repository was archived by the owner on Sep 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +47
-20
lines changed Expand file tree Collapse file tree 6 files changed +47
-20
lines changed Original file line number Diff line number Diff line change 9
9
10
10
jobs :
11
11
conda_deployment_with_new_tag :
12
- name : Test conda deployment of package with Python ${{ matrix.python-version }}
12
+ name : Deploy conda package with Python ${{ matrix.python-version }}
13
13
runs-on : ubuntu-latest
14
14
strategy :
15
15
matrix :
Original file line number Diff line number Diff line change @@ -71,14 +71,17 @@ cmor:
71
71
# use this to indicate the path used for new or modified tables
72
72
# these will be used in preference to the package tables
73
73
tables_path : " "
74
- # ancillary files path
75
- # when running model with payu ancil files are copied to work/<realm>/INPUT
76
- # you can leave these empty if processing only atmos
74
+ # Ancil files are needed only for specific variables when
75
+ # grid information is not fully available from output
76
+ # you can usually leave these empty if processing only atmos
77
+ # ancillary files relative path to <appdir> or fullpath
77
78
ancils_path : " localdata/ancils"
78
79
grid_ocean : " "
79
80
grid_ice : " "
80
81
mask_ocean : " "
82
+ # to supply land area fraction if not available in output
81
83
land_frac : " "
84
+ # to supply tile area fraction if not available in output
82
85
tile_frac : " "
83
86
# defines Controlled Vocabularies and required attributes
84
87
# leave ACDD to follow NCI publishing requirements
Original file line number Diff line number Diff line change 1
1
# ###############################################################
2
2
# USER OPTIONS
3
3
# Settings to manage cmorisation and set tables/variables to process
4
+ # This config file is to produce files to submit to CMIP6 project
5
+ # It's more restrictive than ACDD_conf.yaml
4
6
cmor :
5
7
# If test true it will just run the setup but not launch the job automatically
6
8
test : false
@@ -62,14 +64,17 @@ cmor:
62
64
# as you should use official CMOR cmip6 tables for CMIP6 mode
63
65
# use this only if current package version is obsolete
64
66
tables_path : " "
65
- # ancillary files path
66
- # when running model with payu ancil files are copied to work/<realm>/INPUT
67
- # you can leave these empty if processing only atmos
68
- ancils_path : " data/ancils"
67
+ # Ancil files are needed only for specific variables when
68
+ # grid information is not fully available from output
69
+ # you can usually leave these empty if processing only atmos
70
+ # ancillary files relative path to <appdir> or fullpath
71
+ ancils_path : " localdata/ancils"
69
72
grid_ocean : " "
70
- mask_ocean : " "
71
73
grid_ice : " "
74
+ mask_ocean : " "
75
+ # to supply land area fraction if not available in output
72
76
land_frac : " "
77
+ # to supply tile area fraction if not available in output
73
78
tile_frac : " "
74
79
history_data : ' '
75
80
# DO NOT REMOVE OR ALTER this if you don't know what you're doing :-)
Original file line number Diff line number Diff line change 1
1
package :
2
2
name : mopper
3
- # version: "{{ environ.get('GIT_DESCRIBE_TAG', '1.0') }}"
3
+ # version: "{{ environ.get('GIT_DESCRIBE_TAG', '1.1. 0') }}"
4
4
version : ' 1.1.0'
5
5
# source:
6
- # path: ./
6
+ # path: ../.
7
7
8
8
source :
9
- # url: https://github.com/ACCESS-Hive/ACCESS-MOPPeR/archive/refs/tags/{{version }}.tar.gz
9
+ # url: https://github.com/ACCESS-Hive/ACCESS-MOPPeR/archive/refs/tags/{{ environ.get('RELEASE_VERSION') }}.tar.gz
10
10
git_url : https://github.com/ACCESS-Hive/ACCESS-MOPPeR.git
11
- git_tag : prerelease
11
+ git_tag : " 1.1.0 "
12
12
# git_rev: "1.1.0"
13
13
# git_depth: 1 # (Defaults to -1/not shallow)
14
- # path: ../.
15
14
16
15
build :
17
16
number : 1
Original file line number Diff line number Diff line change @@ -1110,9 +1110,10 @@ def define_attrs(ctx):
1110
1110
ctx : click context
1111
1111
Includes obj dict with 'cmor' settings, exp attributes
1112
1112
"""
1113
- # var_log = logging.getLogger(ctx.obj['var_log'])
1114
- attrs = ctx .obj ['attrs' ]
1113
+ var_log = logging .getLogger (ctx .obj ['var_log' ])
1114
+ attrs = ctx .obj ['attrs' ]. copy ()
1115
1115
notes = attrs .get ('notes' , '' )
1116
+ var_log .debug (f"in define_attrs, notes: { notes } " )
1116
1117
# open file containing notes
1117
1118
fname = import_files ('mopdata' ).joinpath ('notes.yaml' )
1118
1119
data = read_yaml (fname )['notes' ]
@@ -1125,7 +1126,8 @@ def define_attrs(ctx):
1125
1126
fval = ctx .obj [field ]
1126
1127
for k ,v in data [field ].items ():
1127
1128
if k == fval or (k [0 ] == '~' and k [1 :] in fval ):
1128
- notes += v
1129
+ notes += f" { v } "
1129
1130
if notes != '' :
1130
- attrs ['notes' ] = notes
1131
+ attrs ['notes' ] = notes .strip ()
1132
+ var_log .debug (f"in define_attrs, attrs: { attrs } " )
1131
1133
return attrs
Original file line number Diff line number Diff line change 22
22
import logging
23
23
from pathlib import Path
24
24
25
- from mopper .mop_utils import (check_timestamp , get_cmorname ,)
25
+ from mopper .mop_utils import (check_timestamp , get_cmorname ,
26
+ define_attrs )
26
27
27
28
28
29
ctx = click .Context (click .Command ('cmd' ),
@@ -121,8 +122,25 @@ def test_get_cmorname(caplog):
121
122
assert iname == 'longitude'
122
123
assert jname == 'latitude'
123
124
assert zname == 'plev3'
124
- # test generic axis alevel
125
125
ctx .obj ['axes' ] = 'longitude latitude alevel time'
126
126
with ctx :
127
127
zname = get_cmorname ('theta_model_level_number' )
128
128
assert zname == 'hybrid_height'
129
+
130
+ def test_define_attrs (caplog ):
131
+ global ctx
132
+ caplog .set_level (logging .DEBUG , logger = 'varlog_1' )
133
+ ctx .obj ['attrs' ] = {'notes' : "some existing note" }
134
+ ctx .obj ['variable_id' ] = "ta"
135
+ ctx .obj ['calculation' ] = "... plevinterp(var[0]) "
136
+ with ctx :
137
+ out = define_attrs ()
138
+ assert out ['notes' ] == "some existing note Linearly interpolated from model levels using numpy.interp() function. NaNs are assigned to pressure levels falling out of the height range covered by the model"
139
+ # repeating to make sure we are not using reference to ctx see issue #190
140
+ with ctx :
141
+ out = define_attrs ()
142
+ assert out ['notes' ] == "some existing note Linearly interpolated from model levels using numpy.interp() function. NaNs are assigned to pressure levels falling out of the height range covered by the model"
143
+ ctx .obj ['attrs' ] = {}
144
+ with ctx :
145
+ out = define_attrs ()
146
+ assert out ['notes' ] == "Linearly interpolated from model levels using numpy.interp() function. NaNs are assigned to pressure levels falling out of the height range covered by the model"
You can’t perform that action at this time.
0 commit comments