Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d4432f1
Initial plan
Copilot Apr 17, 2026
e662161
initial plan for CMIP7 flavored tests
Copilot Apr 17, 2026
4895254
add pytest fixtures for CMIP6 and CMIP7 experiment config JSON files …
Copilot Apr 17, 2026
b0cbef4
add CMIP7 test file with all tests marked @skip
Copilot Apr 17, 2026
1e6b295
enable test_setup_cmip7_cmor_table_repo — verify CMIP7 table submodul…
Copilot Apr 17, 2026
67b6259
enable test_setup_fre_cmor_run_subtool_cmip7 — ncgen setup for CMIP7 run
Copilot Apr 17, 2026
119070b
enable test_cmor_run_subtool_cmip7_raise_value_error — missing requir…
Copilot Apr 17, 2026
461e349
enable test_fre_cmor_run_subtool_cmip7_no_exp_config — json_exp_confi…
Copilot Apr 17, 2026
44686a6
enable test_fre_cmor_run_subtool_cmip7_empty_varlist — empty variable…
Copilot Apr 17, 2026
59b6a58
enable test_fre_cmor_run_subtool_cmip7_opt_var_name_not_in_table — va…
Copilot Apr 17, 2026
d76cc6f
enable test_fre_cmor_run_subtool_cmip7_case1 — basic CMIP7 CMORizatio…
Copilot Apr 17, 2026
9cb2ad1
enable test_fre_cmor_run_subtool_cmip7_case1_output_compare_data — da…
Copilot Apr 17, 2026
5086dfa
remove input example JSON configs from git — now generated by conftes…
Copilot Apr 17, 2026
64bec7a
enable test_fre_cmor_run_subtool_cmip7_case1_output_compare_metadata …
Copilot Apr 17, 2026
bce4aa2
enable test_setup_fre_cmor_run_subtool_cmip7_case2 — setup for case 2
Copilot Apr 17, 2026
697442d
enable test_fre_cmor_run_subtool_cmip7_case2 — CMIP7 case2 run
Copilot Apr 17, 2026
7440ba1
enable test_fre_cmor_run_subtool_cmip7_case2_output_compare_data — ca…
Copilot Apr 17, 2026
09dd891
enable test_fre_cmor_run_subtool_cmip7_case2_output_compare_metadata …
Copilot Apr 17, 2026
df09558
address code review: move imports to top-level, add explicit table_in…
Copilot Apr 17, 2026
e85f76f
refactor further_examples: remove cleanup/exp_config_cleanup, use tmp…
Copilot Apr 17, 2026
a3847a7
enable CMIP7 further_examples tests (xfail — cmor.write not yet suppo…
Copilot Apr 17, 2026
ef4347c
fix pylint score to 9.62: remove unused imports, fix naming, add enco…
Copilot Apr 17, 2026
4c38a90
fix em dash to colon in xfail reason string
Copilot Apr 17, 2026
c1abbc3
fix CMIP7 further_examples: use g999 grid_label (CMIP7 CV-valid), fix…
Copilot Apr 17, 2026
8f06a44
revert further_examples.py to CMIP6-only: remove CMIP7 test section a…
Copilot Apr 20, 2026
8c24768
add test_cmor_run_subtool_cmip7_further_examples.py with all 3 CMIP7 …
Copilot Apr 20, 2026
49eca36
enable all 3 CMIP7 further_examples tests: ocean_so, ocean_sos, land_…
Copilot Apr 20, 2026
73a3cfe
remove unused monkeypatch fixture params from CMIP7 further_examples …
Copilot Apr 20, 2026
867c4b5
restructure CMIP7 further_examples: single parametrized test mirrorin…
Copilot Apr 20, 2026
a11aa61
remove pylint step in the create_test_conda_env workflow
ilaflott Apr 20, 2026
ebfee4b
rename function and use click group scaffolding to satisfy pylint war…
ilaflott Apr 20, 2026
9df874e
remove reference to .keys(), unnecessary for if X in Y style checks w…
ilaflott Apr 20, 2026
5693d78
remove reference to .keys(), unnecessary for if X in list(Y) style ch…
ilaflott Apr 20, 2026
d5cb098
avoid redefined outer name errors, remove unneeded/redundant fixtures…
ilaflott Apr 20, 2026
e36d4b1
update pylint threshold to 9.7, start checking for quote consistency,…
ilaflott Apr 20, 2026
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
5 changes: 0 additions & 5 deletions .github/workflows/create_test_conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,3 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

- name: Run pylint
if: ${{ always() }}
run: |
pylint --rcfile pylintrc fremorizer/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ cython_debug/
*.nc
tmp/

# experiment-config JSONs are generated by conftest fixtures at test time
fremorizer/tests/test_files/CMOR_input_example.json
fremorizer/tests/test_files/CMOR_CMIP7_input_example.json

# QA results
wcrp_compliance_reports/

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![readthedocs](https://app.readthedocs.org/projects/fremorizer/badge/?version=latest&style=flat)](https://fremorizer.readthedocs.io/en/latest/)

[![pylint](https://github.com/ilaflott/fremorizer/actions/workflows/pylint.yml/badge.svg?branch=main)](https://github.com/ilaflott/fremorizer/actions/workflows/pylint.yml)
[![pylint](https://img.shields.io/badge/pylint-%E2%89%A59.6-brightgreen)](https://github.com/NOAA-GFDL/epmt/actions/workflows/build_and_test_epmt.yml)
[![pylint](https://img.shields.io/badge/pylint-%E2%89%A59.7-brightgreen)](https://github.com/NOAA-GFDL/epmt/actions/workflows/build_and_test_epmt.yml)
[![codecov](https://codecov.io/gh/ilaflott/fremorizer/branch/main/graph/badge.svg)](https://codecov.io/gh/ilaflott/fremorizer)


Expand Down
2 changes: 1 addition & 1 deletion fremorizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

fre_logger = logging.getLogger(__name__)

FORMAT = "[%(levelname)5s:%(filename)24s:%(funcName)24s] %(message)s"
FORMAT = '[%(levelname)5s:%(filename)24s:%(funcName)24s] %(message)s'
logging.basicConfig( level = logging.WARNING,
format = FORMAT,
filename = None,
Expand Down
192 changes: 96 additions & 96 deletions fremorizer/cli.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fremorizer/cmor_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def cmor_config_subtool(
lines.append(f" - component_name: '{component_name}'")
lines.append(f" variable_list: '{variable_list}'")
lines.append(" data_series_type: 'ts'")
lines.append(" chunk: *PP_CMIP_CHUNK")
lines.append(' chunk: *PP_CMIP_CHUNK')


# ---- write output YAML ----
Expand Down
26 changes: 13 additions & 13 deletions fremorizer/cmor_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
# Vertical-coordinate classification (used by cmor_mixer)
# ---------------------------------------------------------------------------
ACCEPTED_VERT_DIMS = [
"z_l", "landuse",
"plev39", "plev30", "plev19", "plev8",
"height2m",
"level", "lev", "levhalf",
'z_l', 'landuse',
'plev39', 'plev30', 'plev19', 'plev8',
'height2m',
'level', 'lev', 'levhalf',
]

NON_HYBRID_SIGMA_COORDS = [
"landuse",
"plev39", "plev30", "plev19", "plev8",
"height2m",
'landuse',
'plev39', 'plev30', 'plev19', 'plev8',
'height2m',
]

ALT_HYBRID_SIGMA_COORDS = ["level", "lev", "levhalf"]
ALT_HYBRID_SIGMA_COORDS = ['level', 'lev', 'levhalf']

DEPTH_COORDS = ["z_l"]
DEPTH_COORDS = ['z_l']


# ---------------------------------------------------------------------------
Expand All @@ -62,10 +62,10 @@
# equivalents. Dimensions whose names already match (e.g. plev39, height2m)
# need no entry; the look-up falls back to using the input name directly.
INPUT_TO_MIP_VERT_DIM = {
"z_l": "olevel",
"level": "alevel",
"lev": "alevel",
"levhalf": "alevhalf",
'z_l': 'olevel',
'level': 'alevel',
'lev': 'alevel',
'levhalf': 'alevhalf',
}


Expand Down
24 changes: 12 additions & 12 deletions fremorizer/cmor_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ def print_var_content(table_config_file: IO[str],

table_name = None
try:
table_name = proj_table_vars["Header"].get('table_id').split(' ')[1]
table_name = proj_table_vars['Header'].get('table_id').split(' ')[1]
except KeyError:
fre_logger.warning("couldn't get header and table_name field")
fre_logger.warning('couldn\'t get header and table_name field')

if table_name is not None:
fre_logger.info('looking for %s data in table %s!', var_name, table_name)
else:
fre_logger.info('looking for %s data in table %s, but could not find its table_name!',
var_name, table_config_file.name)

var_content = proj_table_vars.get("variable_entry", {}).get(var_name)
var_content = proj_table_vars.get('variable_entry', {}).get(var_name)
if var_content is None:
fre_logger.debug('variable %s not found in %s, moving on!', var_name, Path(table_config_file.name).name)
return
Expand Down Expand Up @@ -107,7 +107,7 @@ def cmor_find_subtool( json_var_list: Optional[str] = None,

var_list = None
if json_var_list is not None:
with open(json_var_list, "r", encoding="utf-8") as var_list_file:
with open(json_var_list, 'r', encoding='utf-8') as var_list_file:
var_list = json.load(var_list_file)

if opt_var_name is None and var_list is None:
Expand All @@ -116,14 +116,14 @@ def cmor_find_subtool( json_var_list: Optional[str] = None,
if opt_var_name is not None:
fre_logger.info('opt_var_name is not None: looking for only ONE variables worth of info!')
for json_table_config in json_table_configs:
with open(json_table_config, "r", encoding="utf-8") as table_config_file:
with open(json_table_config, 'r', encoding='utf-8') as table_config_file:
print_var_content(table_config_file, opt_var_name)

elif var_list is not None:
fre_logger.info('opt_var_name is None, and var_list is not None, looking for many variables worth of info!')
for var in var_list:
for json_table_config in json_table_configs:
with open(json_table_config, "r", encoding="utf-8") as table_config_file:
with open(json_table_config, 'r', encoding='utf-8') as table_config_file:
print_var_content(table_config_file, str(var_list[var]))


Expand All @@ -132,7 +132,7 @@ def make_simple_varlist( dir_targ: str,
json_mip_table: Optional[str] = None) -> Optional[Dict[str, str]]:
"""
Generate a JSON file containing a list of variable names from NetCDF files in a specified directory.
This function searches for NetCDF files in the given directory, or a subdirectory, "ts/monthly/5yr",
This function searches for NetCDF files in the given directory, or a subdirectory, 'ts/monthly/5yr',
if not already included. It then extracts variable names from the filenames, and writes these variable
names to a JSON file.

Expand All @@ -154,22 +154,22 @@ def make_simple_varlist( dir_targ: str,

"""
# if the variable is in the filename, it's likely delimited by another period.
all_nc_files = glob.glob(os.path.join(dir_targ, "*.*.nc"))
all_nc_files = glob.glob(os.path.join(dir_targ, '*.*.nc'))
if not all_nc_files:
fre_logger.error("No files found in the directory.") #uncovered
fre_logger.error('No files found in the directory.') #uncovered
return None

if len(all_nc_files) == 1:
fre_logger.warning("Warning: Only one file found matching the pattern.")
fre_logger.warning('Warning: Only one file found matching the pattern.')

fre_logger.info("Files found matching pattern. Number of files: %d", len(all_nc_files))
fre_logger.info('Files found matching pattern. Number of files: %d', len(all_nc_files))

mip_vars = None
if json_mip_table is not None:
try:
# read in mip vars to check against later
fre_logger.debug('attempting to read in variable entries in specified mip table')
full_mip_vars_list=get_json_file_data(json_mip_table)["variable_entry"].keys()
full_mip_vars_list=get_json_file_data(json_mip_table)['variable_entry'].keys()

except Exception as exc:
raise Exception( 'problem opening mip table and getting variable entry data.'
Expand Down
Loading
Loading