Skip to content

Commit c41f37c

Browse files
authored
Merge pull request #3346 from GEOS-ESM/develop
2 parents c65548b + 16b7f41 commit c41f37c

32 files changed

+1209
-316
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ parameters:
1616

1717
# Anchors to prevent forgetting to update a version
1818
os_version: &os_version ubuntu24
19-
baselibs_version: &baselibs_version v7.27.0
19+
baselibs_version: &baselibs_version v7.29.0
2020
bcs_version: &bcs_version v11.6.0
2121
tag_build_arg_name: &tag_build_arg_name maplversion
2222

.github/workflows/docs.yml

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
filter: blob:none
2023

2124
- name: Build and Deploy Docs
2225
uses: ./.github/actions/deploy-ford-docs
@@ -34,6 +37,9 @@ jobs:
3437
steps:
3538
- name: Checkout
3639
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
filter: blob:none
3743

3844
- name: Build and Deploy Dev Docs
3945
uses: ./.github/actions/deploy-ford-docs

.github/workflows/push-to-develop.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 0
17+
filter: blob:none
1718
- name: Run the action
1819
uses: devops-infra/[email protected]
1920
with:

.github/workflows/push-to-main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 0
17+
filter: blob:none
1718
- name: Run the action
1819
uses: devops-infra/[email protected]
1920
with:

.github/workflows/validate_yaml_files.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ jobs:
1515
validate-YAML:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
filter: blob:none
1923
- id: yaml-lint
2024
name: yaml-lint
2125
uses: ibiqlik/action-yamllint@v3

.github/workflows/workflow.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
filter: blob:none
2225

2326
- name: Build and Deploy Docs
2427
uses: ./.github/actions/deploy-ford-docs
@@ -35,7 +38,7 @@ jobs:
3538
name: Build and Test MAPL GNU
3639
runs-on: ubuntu-latest
3740
container:
38-
image: gmao/ubuntu24-geos-env-mkl:v7.27.0-openmpi_5.0.5-gcc_14.2.0
41+
image: gmao/ubuntu24-geos-env-mkl:v7.29.0-openmpi_5.0.5-gcc_14.2.0
3942
# Per https://github.com/actions/virtual-environments/issues/1445#issuecomment-713861495
4043
# It seems like we might not need secrets on GitHub Actions which is good for forked
4144
# pull requests
@@ -86,7 +89,7 @@ jobs:
8689
name: Build and Test MAPL Intel
8790
runs-on: ubuntu-latest
8891
container:
89-
image: gmao/ubuntu24-geos-env:v7.27.0-intelmpi_2021.13-ifort_2021.13
92+
image: gmao/ubuntu24-geos-env:v7.29.0-intelmpi_2021.13-ifort_2021.13
9093
# Per https://github.com/actions/virtual-environments/issues/1445#issuecomment-713861495
9194
# It seems like we might not need secrets on GitHub Actions which is good for forked
9295
# pull requests
@@ -102,6 +105,7 @@ jobs:
102105
uses: actions/checkout@v4
103106
with:
104107
fetch-depth: 1
108+
filter: blob:none
105109
- name: Set all directories as git safe
106110
run: |
107111
git config --global --add safe.directory '*'

CHANGELOG.md

+32
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Deprecated
1919

20+
## [2.52.0] - 2025-01-17
21+
22+
### Added
23+
24+
- Added subroutine to read nc4 tile file
25+
- Added optional `start_date` and `start_time` to control the output window for each History collection. No output will be written before then. If not specified, these default to the beginning of the experiment.
26+
- Added utility to prepare inputs for `ExtDataDriver.x` so that ExtData can simulate a real GEOS run
27+
- Added loggers when writing or reading weight files
28+
- Added new option to AGCM.rc `overwrite_checkpoint` to allow checkpoint files to be overwritten. By default still will not overwrite checkpoints
29+
- The trajectory sampler netCDF output variable `location_index_in_iodafile` can be turned off, after we add two control variables: `use_NWP_1_file` and `restore_2_obs_vector` for users. When set to true, the two options will select only one obs file at each Epoch interval, and will rotate the output field index back to the location vector inthe obs file before generating netCDF output.
30+
- Support `splitfield: 1` in HISTORY.rc for trajectory sampler
31+
32+
### Changed
33+
34+
- Changed `MAPL_ESMFRegridder` to require the dstMaskValues to be added as grid attribute to use fixed masking, fixes UFS issue
35+
- Increased formatting width of time index in ExtData2G diagnostic print
36+
- Updated GitHub checkout action to use blobless clones
37+
- Update CI to use Baselibs 7.29.0 by default
38+
- This provides ESMF 8.8.0
39+
- Update `components.yaml`
40+
- `ESMA_env` v4.34.0
41+
- Update to MPT 2.30 at NAS
42+
- Update to Baselibs 7.29.0 (ESMF 8.8.0)
43+
- `ESMA_cmake` v3.56.0
44+
- Use `LOCATION` Python `FIND_STRATEGY`
45+
46+
### Fixed
47+
48+
- Free MPI communicators after reading and/or writing of restarts
49+
- Fixed the behavior of `MAPL_MaxMin` in presence of NaN
50+
- Fixed bug with return codes and macros in udunits2f
51+
2052
## [2.51.2] - 2024-12-19
2153

2254
### Changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif ()
88

99
project (
1010
MAPL
11-
VERSION 2.51.2
11+
VERSION 2.52.0
1212
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF
1313

1414
# Set the possible values of build type for cmake-gui

Tests/generate_extdatadriver_input.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Introduction
2+
This is a simple utility to generate inputs for ExtDataDriver.x so that ExtData can simulate a real GEOS run. It requires 3 things that are passed in
3+
- A list of items ExtData needs to fill. This can be found by looking at the GEOS log
4+
- The import spec of the GCM component from using the printspec option to GEOS
5+
- all the needed yaml files in a directory, name of directory is passed
6+
7+
This will generate the import and optionally the export (as well as History) defition for ExtDataDriver.x to spare the human the tedious work.
8+
9+
# Example Inputs
10+
To get the list of ExtDate items, just grab all the lines that look like this to a file:
11+
```
12+
EXTDATA: INFO: ---- 00001: BC_AIRCRAFT
13+
EXTDATA: INFO: ---- 00002: BC_ANTEBC1
14+
EXTDATA: INFO: ---- 00003: BC_ANTEBC2
15+
EXTDATA: INFO: ---- 00004: BC_AVIATION_CDS
16+
EXTDATA: INFO: ---- 00005: BC_AVIATION_CRS
17+
EXTDATA: INFO: ---- 00006: BC_AVIATION_LTO
18+
EXTDATA: INFO: ---- 00007: BC_BIOFUEL
19+
EXTDATA: INFO: ---- 00008: BC_BIOMASS
20+
EXTDATA: INFO: ---- 00009: BC_SHIP
21+
EXTDATA: INFO: ---- 00010: BRC_AIRCRAFT
22+
EXTDATA: INFO: ---- 00011: BRC_ANTEBRC1
23+
EXTDATA: INFO: ---- 00012: BRC_ANTEBRC2
24+
EXTDATA: INFO: ---- 00013: BRC_AVIATION_CDS
25+
EXTDATA: INFO: ---- 00014: BRC_AVIATION_CRS
26+
EXTDATA: INFO: ---- 00015: BRC_AVIATION_LTO
27+
EXTDATA: INFO: ---- 00016: BRC_BIOFUEL
28+
EXTDATA: INFO: ---- 00017: BRC_BIOMASS
29+
EXTDATA: INFO: ---- 00018: BRC_SHIP
30+
EXTDATA: INFO: ---- 00019: BRC_TERPENE
31+
```
32+
33+
To get the GCM component spec, run with `PRINTSPEC: 1` in the `CAP.rc` and copy lines out that look like this:
34+
```
35+
#IMPORT spec for GCM
36+
#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE
37+
GENERIC: INFO: GCM, WSUB_CLIM, stdev in vertical velocity, m s-1, 3, esmf_field
38+
GENERIC: INFO: GCM, MEGAN_ORVC, MEGAN_ORVC, kgC/m2/s, 2, esmf_field
39+
GENERIC: INFO: GCM, CLM4_PFT_CROP, CLM4_PFT_CROP, 1, 2, esmf_field
40+
GENERIC: INFO: GCM, CLM4_PFT_C4_GRSS, CLM4_PFT_C4_GRSS, 1, 2, esmf_field
41+
GENERIC: INFO: GCM, CLM4_PFT_C3_NARC_GRSS, CLM4_PFT_C3_NARC_GRSS, 1, 2, esmf_field
42+
GENERIC: INFO: GCM, CLM4_PFT_C3_ARCT_GRSS, CLM4_PFT_C3_ARCT_GRSS, 1, 2, esmf_field
43+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_DECD_BORL_SHRB, CLM4_PFT_BDLF_DECD_BORL_SHRB, 1, 2, esmf_field
44+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_DECD_TMPT_SHRB, CLM4_PFT_BDLF_DECD_TMPT_SHRB, 1, 2, esmf_field
45+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_EVGN_SHRB, CLM4_PFT_BDLF_EVGN_SHRB, 1, 2, esmf_field
46+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_DECD_BORL_TREE, CLM4_PFT_BDLF_DECD_BORL_TREE, 1, 2, esmf_field
47+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_DECD_TMPT_TREE, CLM4_PFT_BDLF_DECD_TMPT_TREE, 1, 2, esmf_field
48+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_DECD_TROP_TREE, CLM4_PFT_BDLF_DECD_TROP_TREE, 1, 2, esmf_field
49+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_EVGN_TMPT_TREE, CLM4_PFT_BDLF_EVGN_TMPT_TREE, 1, 2, esmf_field
50+
GENERIC: INFO: GCM, CLM4_PFT_BDLF_EVGN_TROP_TREE, CLM4_PFT_BDLF_EVGN_TROP_TREE, 1, 2, esmf_field
51+
GENERIC: INFO: GCM, CLM4_PFT_NDLF_DECD_BORL_TREE, CLM4_PFT_NDLF_DECD_BORL_TREE, 1, 2, esmf_field
52+
GENERIC: INFO: GCM, CLM4_PFT_NDLF_EVGN_BORL_TREE, CLM4_PFT_NDLF_EVGN_BORL_TREE, 1, 2, esmf_field
53+
GENERIC: INFO: GCM, CLM4_PFT_NDLF_EVGN_TMPT_TREE, CLM4_PFT_NDLF_EVGN_TMPT_TREE, 1, 2, esmf_field
54+
```
55+
56+
Finally just grab the right yaml files for ExtData.
57+
58+
To run you will of course need to do some further editing of the produced files and link in the acutal data using the same convention `gcm_run.j` does.

Tests/generate_extdatadriver_input.py

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
#!/usr/bin/env python3
2+
from yaml import load,dump
3+
import argparse
4+
import os
5+
import yaml
6+
import glob
7+
8+
dims_dict = {"2":"xy", "3":"xyz"}
9+
10+
def get_dims(component_map, name):
11+
for comp in component_map:
12+
if name in component_map[comp]:
13+
dims = component_map[comp][name]["dims"]
14+
return dims
15+
16+
def get_vars_needed(input_file):
17+
18+
output_list = []
19+
f = open(input_file,"r")
20+
lines = f.readlines()
21+
f.close()
22+
for line in lines:
23+
temp = line.split()
24+
output_list.append(temp[4])
25+
26+
return output_list
27+
28+
def get_extdata_map(input_dir):
29+
30+
input_files = glob.glob(input_dir+"/*.yaml")
31+
export_list = {}
32+
for input_file in input_files:
33+
f = open(input_file,'r')
34+
extdata_def = yaml.safe_load(f)
35+
f.close()
36+
for short_name in extdata_def["Exports"]:
37+
export_list.update({short_name:extdata_def["Exports"][short_name]})
38+
return export_list
39+
40+
def get_block(cvs_file):
41+
42+
temp = cvs_file[0].split(' ')
43+
state_type = temp[1][1:].strip()
44+
component = temp[4].strip()
45+
i=2
46+
for line in cvs_file[2:]:
47+
if "spec for" in line:
48+
break
49+
i=i+1
50+
return component,state_type,i
51+
52+
53+
def get_component_map(cvs_file):
54+
55+
i_start = 0
56+
i_end = 0
57+
n_lines = len(cvs_file)
58+
components = {}
59+
while i_start < n_lines-1:
60+
61+
comp_name,state_type,i_end = get_block(cvs_file[i_start:])
62+
comp_map = {}
63+
for i in range(i_end-2):
64+
line = cvs_file[i_start+2+i]
65+
values = line.split(',')
66+
short_name = values[1].strip()
67+
long_name = values[2].strip()
68+
units = values[3].strip()
69+
dims = values[4].strip()
70+
item_type = values[5].strip()
71+
comp_map.update({short_name:{"long_name":long_name,"units":units,"item_type":item_type,"dims":dims}})
72+
components.update({comp_name+"_"+state_type:comp_map})
73+
i_start = i_start + i_end
74+
75+
return components
76+
77+
def parse_args():
78+
p = argparse.ArgumentParser(description='Generarte input files for ExtDataDriver to simulate GEOS')
79+
p.add_argument('extdata_provided',type=str,help='a list of items ExtData should fill',default=None)
80+
p.add_argument('spec_def',type=str,help='the GEOS gcm import state from the printspec',default=None)
81+
p.add_argument('extdata_dir',type=str,help='diretory with all the yaml imputs for extdata',default=None)
82+
p.add_argument('-e','--export',action='store_true',help='also include exports for corresponding imports')
83+
84+
return vars(p.parse_args())
85+
86+
if __name__ == '__main__':
87+
88+
args = parse_args()
89+
90+
extdata_list = args['extdata_provided']
91+
do_exports = args['export']
92+
input_file = args['spec_def']
93+
f = open(input_file,"r")
94+
input_rc = f.readlines()
95+
f.close()
96+
97+
extdata_directory = args['extdata_dir']
98+
extdata_def = get_extdata_map(extdata_directory)
99+
100+
f_agcm = open("AGCM.rc",'w')
101+
# component
102+
component_map = {}
103+
component_map = get_component_map(input_rc)
104+
105+
vars_needed = get_vars_needed(extdata_list)
106+
107+
nl = "\n"
108+
cm = " , "
109+
110+
# Import state
111+
written = []
112+
f_agcm.write("IMPORT_STATE::"+nl)
113+
114+
for item in vars_needed:
115+
if item in extdata_def:
116+
long_name = "NA"
117+
units = "NA"
118+
dims = get_dims(component_map, item)
119+
cdims = dims_dict[dims]
120+
121+
if item not in written:
122+
f_agcm.write(item+cm+long_name+cm+units+cm+cdims+cm+"c"+nl)
123+
written.append(item)
124+
125+
f_agcm.write("::"+nl)
126+
127+
# Export state
128+
if do_exports:
129+
written = []
130+
f_agcm.write("EXPORT_STATE::"+nl)
131+
for item in vars_needed:
132+
if item in extdata_def:
133+
long_name = "NA"
134+
units = "NA"
135+
dims = get_dims(component_map, item)
136+
cdims = dims_dict[dims]
137+
138+
if item not in written:
139+
f_agcm.write(item+cm+long_name+cm+units+cm+cdims+cm+"c"+nl)
140+
written.append(item)
141+
142+
f_agcm.write("::"+nl)
143+
144+
f_hist = open("HISTORY.rc",'w')
145+
f_hist.write("GRID_LABELS:"+nl)
146+
f_hist.write("::"+nl)
147+
f_hist.write("COLLECTIONS: my_collection"+nl)
148+
f_hist.write("::"+nl)
149+
f_hist.write("my_collection.template: 'nc4'"+nl)
150+
f_hist.write("my_collection.format: 'CFIO'"+nl)
151+
f_hist.write("my_collection.frequency: '240000'"+nl)
152+
first = True
153+
written = []
154+
for item in vars_needed:
155+
if item in extdata_def:
156+
if item not in written:
157+
if first:
158+
first = False
159+
f_hist.write("my_collection.fields:'"+item+"' , 'Root',"+"\n")
160+
else:
161+
f_hist.write("'"+item+"' , 'Root',"+"\n")
162+
written.append(item)
163+
f_hist.write("::")
164+
165+
f_hist.close()
166+
f_agcm.close()
167+

0 commit comments

Comments
 (0)