Skip to content

Commit

Permalink
Fix an upstrean error from the mip-table (Apmon => APmon for sfcWind) #…
Browse files Browse the repository at this point in the history
  • Loading branch information
treerink committed Feb 13, 2025
1 parent 22d221b commit 0a470c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
"rsut",
"rsutcs",
"rtmt",
"sfcWind",
"ta",
"tas",
"tasmax",
Expand Down Expand Up @@ -306,9 +307,6 @@
"APmonZ": [
"zg"
],
"Apmon": [
"sfcWind"
],
"GIAmon": [
"hfls",
"hfss",
Expand Down
14 changes: 10 additions & 4 deletions ece2cmor3/scripts/convert_varlist_from_cmip6_to_cmip6Plus.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def load_cmip6_cmip6plus_map_table():
cmip6_cmip6plus_map_table_file_name = os.path.expanduser(file_name_mapping_table)

# Checking if the cmip6-cmip6plus-mapping file exist, if not try to create it:
if os.path.isfile(cmip6_cmip6plus_map_table_file_name) == False:
# if os.path.isfile(cmip6_cmip6plus_map_table_file_name) == False:
if os.path.isfile(cmip6_cmip6plus_map_table_file_name) == True:

# Git checkout of the github wiki table of the mip-cmor-tables if not available
# for converting the github wiki table to an ascii file with columns:
Expand All @@ -48,14 +49,19 @@ def load_cmip6_cmip6plus_map_table():

if os.path.isfile(cmip6_cmip6plus_map_table_file_name) == False: print(error_message, ' The file ', cmip6_cmip6plus_map_table_file_name, ' does not exist.\n'); sys.exit()

print(' Fix an error in the mip-cmor-tables repo content:')
command_3 = "sed -i -e 's/Apmon/APmon/g' " + file_name_mapping_table
print(' ' + command_3 + '\n')
os.system(command_3)

# Loading the cmip6-cmip6plus-mapping file
cmip6_cmip6plus_map_table = np.loadtxt(cmip6_cmip6plus_map_table_file_name, skiprows=2, usecols=(0,1,2,3), dtype='str')

# Clean:
command_3 = "rm -rf mip-cmor-tables.wiki"
command_4 = "rm -f " + file_name_mapping_table
os.system(command_3)
command_4 = "rm -rf mip-cmor-tables.wiki"
command_5 = "rm -f " + file_name_mapping_table
#os.system(command_4)
#os.system(command_5)

return cmip6_cmip6plus_map_table

Expand Down

0 comments on commit 0a470c9

Please sign in to comment.