Skip to content
Merged
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
208 changes: 208 additions & 0 deletions parm/fixed_files_mapping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
fixed_files:
#
#-----------------------------------------------------------------------
#
# FV3_NML_VARNAME_TO_SFC_CLIMO_FIELD_MAPPING:
# This array is used to set some of the namelist variables in the forecast
# model's namelist file that represent the relative or absolute paths of
# various fixed files (the first column of the array, where columns are
# delineated by the pipe symbol "|") to the full paths to surface climatology
# files (on the native FV3-LAM grid) in the FIXlam directory derived from
# the corresponding surface climatology fields (the second column of the
# array).
#
#-----------------------------------------------------------------------
#
FV3_NML_VARNAME_TO_SFC_CLIMO_FIELD_MAPPING: [
"FNALBC | snowfree_albedo",
"FNALBC2 | facsf",
"FNTG3C | substrate_temperature",
"FNVEGC | vegetation_greenness",
"FNVETC | vegetation_type",
"FNSOTC | soil_type",
"FNVMNC | vegetation_greenness",
"FNVMXC | vegetation_greenness",
"FNSLPC | slope_type",
"FNABSC | maximum_snow_albedo"
]

#
#-----------------------------------------------------------------------
#
# Set the array parameter containing the names of all the fields that the
# MAKE_SFC_CLIMO_TN task generates on the native FV3-LAM grid.
#
#-----------------------------------------------------------------------
#
SFC_CLIMO_FIELDS: [
"facsf",
"maximum_snow_albedo",
"slope_type",
"snowfree_albedo",
"soil_type",
"substrate_temperature",
"vegetation_greenness",
"vegetation_type",
]

#
#-----------------------------------------------------------------------
#
# FNGLAC, ..., FNMSKH:
# Names of (some of the) global data files that are assumed to exist in
# a system directory specified (this directory is machine-dependent;
# the experiment generation scripts will set it and store it in the
# variable FIXgsm). These file names also appear directly in the forecast
# model's input namelist file.
#
#-----------------------------------------------------------------------
#
FNGLAC: &FNGLAC "global_glacier.2x2.grb"
FNMXIC: &FNMXIC "global_maxice.2x2.grb"
FNTSFC: &FNTSFC "RTGSST.1982.2012.monthly.clim.grb"
FNSNOC: &FNSNOC "global_snoclim.1.875.grb"
FNZORC: &FNZORC "igbp"
FNAISC: &FNAISC "CFSR.SEAICE.1982.2012.monthly.clim.grb"
FNSMCC: &FNSMCC "global_soilmgldas.t126.384.190.grb"
FNMSKH: &FNMSKH "seaice_newland.grb"
#
#-----------------------------------------------------------------------
#
# FIXgsm_FILES_TO_COPY_TO_FIXam:
# If not running in NCO mode, this array contains the names of the files
# to copy from the FIXgsm system directory to the FIXam directory under
# the experiment directory. Note that the last element has a dummy value.
# This last element will get reset by the workflow generation scripts to
# the name of the ozone production/loss file to copy from FIXgsm. The
# name of this file depends on the ozone parameterization being used,
# and that in turn depends on the CCPP physics suite specified for the
# experiment. Thus, the CCPP physics suite XML must first be read in to
# determine the ozone parameterizaton and then the name of the ozone
# production/loss file. These steps are carried out elsewhere (in one
# of the workflow generation scripts/functions).
#
#-----------------------------------------------------------------------
#
FIXgsm_FILES_TO_COPY_TO_FIXam: [
*FNGLAC,
*FNMXIC,
*FNTSFC,
*FNSNOC,
*FNAISC,
*FNSMCC,
*FNMSKH,
"global_climaeropac_global.txt",
"fix_co2_proj/global_co2historicaldata_2010.txt",
"fix_co2_proj/global_co2historicaldata_2011.txt",
"fix_co2_proj/global_co2historicaldata_2012.txt",
"fix_co2_proj/global_co2historicaldata_2013.txt",
"fix_co2_proj/global_co2historicaldata_2014.txt",
"fix_co2_proj/global_co2historicaldata_2015.txt",
"fix_co2_proj/global_co2historicaldata_2016.txt",
"fix_co2_proj/global_co2historicaldata_2017.txt",
"fix_co2_proj/global_co2historicaldata_2018.txt",
"fix_co2_proj/global_co2historicaldata_2019.txt",
"fix_co2_proj/global_co2historicaldata_2020.txt",
"fix_co2_proj/global_co2historicaldata_2021.txt",
"global_co2historicaldata_glob.txt",
"co2monthlycyc.txt",
"global_h2o_pltc.f77",
"global_hyblev.l65.txt",
"global_zorclim.1x1.grb",
"global_sfc_emissivity_idx.txt",
"global_tg3clim.2.6x1.5.grb",
"global_solarconstant_noaa_an.txt",
"global_albedo4.1x1.grb",
"geo_em.d01.lat-lon.2.5m.HGT_M.nc",
"HGT.Beljaars_filtered.lat-lon.30s_res.nc",
"replace_with_FIXgsm_ozone_prodloss_filename"
]
#
#-----------------------------------------------------------------------
#
# FV3_NML_VARNAME_TO_FIXam_FILES_MAPPING:
# This array is used to set some of the namelist variables in the forecast
# model's namelist file that represent the relative or absolute paths of
# various fixed files (the first column of the array, where columns are
# delineated by the pipe symbol "|") to the full paths to these files in
# the FIXam directory derived from the corresponding workflow variables
# containing file names (the second column of the array).
#
#-----------------------------------------------------------------------
#
FV3_NML_VARNAME_TO_FIXam_FILES_MAPPING: [
!join_str ["FNGLAC | ",*FNGLAC],
!join_str ["FNMXIC | ",*FNMXIC],
!join_str ["FNTSFC | ",*FNTSFC],
!join_str ["FNSNOC | ",*FNSNOC],
!join_str ["FNAISC | ",*FNAISC],
!join_str ["FNSMCC | ",*FNSMCC],
!join_str ["FNMSKH | ",*FNMSKH]
]
#"FNZORC | $FNZORC",

#
#-----------------------------------------------------------------------
#
# FV3_NML_VARNAME_TO_SFC_CLIMO_FIELD_MAPPING:
# This array is used to set some of the namelist variables in the forecast
# model's namelist file that represent the relative or absolute paths of
# various fixed files (the first column of the array, where columns are
# delineated by the pipe symbol "|") to the full paths to surface climatology
# files (on the native FV3-LAM grid) in the FIXlam directory derived from
# the corresponding surface climatology fields (the second column of the
# array).
#
#-----------------------------------------------------------------------
#
FV3_NML_VARNAME_TO_SFC_CLIMO_FIELD_MAPPING: [
"FNALBC | snowfree_albedo",
"FNALBC2 | facsf",
"FNTG3C | substrate_temperature",
"FNVEGC | vegetation_greenness",
"FNVETC | vegetation_type",
"FNSOTC | soil_type",
"FNVMNC | vegetation_greenness",
"FNVMXC | vegetation_greenness",
"FNSLPC | slope_type",
"FNABSC | maximum_snow_albedo"
]


#
#-----------------------------------------------------------------------
#
# CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING:
# This array specifies the mapping to use between the symlinks that need
# to be created in each cycle directory (these are the "files" that FV3
# looks for) and their targets in the FIXam directory. The first column
# of the array specifies the symlink to be created, and the second column
# specifies its target file in FIXam (where columns are delineated by the
# pipe symbol "|").
#
#-----------------------------------------------------------------------
#
CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING: [
"aerosol.dat | global_climaeropac_global.txt",
"co2historicaldata_2010.txt | fix_co2_proj/global_co2historicaldata_2010.txt",
"co2historicaldata_2011.txt | fix_co2_proj/global_co2historicaldata_2011.txt",
"co2historicaldata_2012.txt | fix_co2_proj/global_co2historicaldata_2012.txt",
"co2historicaldata_2013.txt | fix_co2_proj/global_co2historicaldata_2013.txt",
"co2historicaldata_2014.txt | fix_co2_proj/global_co2historicaldata_2014.txt",
"co2historicaldata_2015.txt | fix_co2_proj/global_co2historicaldata_2015.txt",
"co2historicaldata_2016.txt | fix_co2_proj/global_co2historicaldata_2016.txt",
"co2historicaldata_2017.txt | fix_co2_proj/global_co2historicaldata_2017.txt",
"co2historicaldata_2018.txt | fix_co2_proj/global_co2historicaldata_2018.txt",
"co2historicaldata_2019.txt | fix_co2_proj/global_co2historicaldata_2019.txt",
"co2historicaldata_2020.txt | fix_co2_proj/global_co2historicaldata_2020.txt",
"co2historicaldata_2021.txt | fix_co2_proj/global_co2historicaldata_2021.txt",
"co2historicaldata_glob.txt | global_co2historicaldata_glob.txt",
"co2monthlycyc.txt | co2monthlycyc.txt",
"global_h2oprdlos.f77 | global_h2o_pltc.f77",
"global_albedo4.1x1.grb | global_albedo4.1x1.grb",
"global_zorclim.1x1.grb | global_zorclim.1x1.grb",
"global_tg3clim.2.6x1.5.grb | global_tg3clim.2.6x1.5.grb",
"sfc_emissivity_idx.txt | global_sfc_emissivity_idx.txt",
"solarconstant_noaa_an.txt | global_solarconstant_noaa_an.txt",
"global_o3prdlos.f77 | "
]
2 changes: 1 addition & 1 deletion scripts/exregional_run_fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ static) files in the FIXam directory:
# isn't really an advantage to using relative symlinks, so we use symlinks
# with absolute paths.
#
if [ "${RUN_ENVIR}" != "nco" ]; then
if [ "${SYMLINK_FIX_FILES}" == "FALSE" ]; then
relative_link_flag="TRUE"
else
relative_link_flag="FALSE"
Expand Down
51 changes: 3 additions & 48 deletions tests/WE2E/run_WE2E_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,56 +69,11 @@ WE2Edir="$TESTSdir/WE2E"
#
#-----------------------------------------------------------------------
#

# This line will return two numbers: the python major and minor versions
pyversion=($(/usr/bin/env python3 -c 'import platform; major, minor, patch = platform.python_version_tuple(); print(major); print(minor)'))

#Now, set an error check variable so that we can print all python errors rather than just the first
pyerrors=0

# Check that the call to python3 returned no errors, then check if the
# python3 minor version is 6 or higher
if [[ -z "$pyversion" ]];then
print_info_msg "\

Error: python3 not found"
pyerrors=$((pyerrors+1))
else
if [[ ${#pyversion[@]} -lt 2 ]]; then
print_info_msg "\

Error retrieving python3 version"
pyerrors=$((pyerrors+1))
elif [[ ${pyversion[1]} -lt 6 ]]; then
print_info_msg "\

Error: python version must be 3.6 or higher
python version: ${pyversion[*]}"
pyerrors=$((pyerrors+1))
fi
python3 $USHdir/check_python_version.py
if [[ $? -ne 0 ]]; then
exit 1
fi

#Next, check for the non-standard python packages: jinja2, yaml, and f90nml
pkgs=(jinja2 yaml f90nml)
for pkg in ${pkgs[@]} ; do
if ! /usr/bin/env python3 -c "import ${pkg}" &> /dev/null; then
print_info_msg "\

Error: python module ${pkg} not available"
pyerrors=$((pyerrors+1))
fi
done

#Finally, check if the number of errors is >0, and if so exit with helpful message
if [ $pyerrors -gt 0 ];then
print_err_msg_exit "\
Errors found: check your python environment

Instructions for setting up python environments can be found on the web:
https://github.com/ufs-community/ufs-srweather-app/wiki/Getting-Started

"
fi
#
#-----------------------------------------------------------------------
#
Expand Down
4 changes: 0 additions & 4 deletions ush/UFS_plot_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@


def get_lambert_points(gnomonic_map, lambert_map, pps):
#print("Hello from a function")

# This function takes the lambert domain we have defined, lambert_map, as well as
# pps (the number of points to interpolate and draw for each side of the lambert "rectangle"),
Expand Down Expand Up @@ -187,9 +186,6 @@ def get_lambert_points(gnomonic_map, lambert_map, pps):
# Need to replace final instruction with Path.CLOSEPOLY
instructions[-1] = Path.CLOSEPOLY

#print("vertices=", vertices)
#print("instructions=", instructions)

return vertices, instructions


Expand Down
57 changes: 57 additions & 0 deletions ush/check_python_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3

import sys
import logging
import platform
from textwrap import dedent


def check_python_version():
"""Check if python version >= 3.6 and presence of some
non-standard packages currently jinja2, yaml, f90nml"""

# Check for non-standard python packages
try:
import jinja2
import yaml
import f90nml
except ImportError as error:
logging.error(
dedent(
"""
Error: Missing python package required by the SRW app
"""
)
)
raise

# check python version
major, minor, patch = platform.python_version_tuple()
if int(major) < 3 or int(minor) < 6:
logging.error(
dedent(
f"""
Error: python version must be 3.6 or higher
Your python version is: {major}.{minor}"""
)
)
raise Exception("Python version below 3.6")


if __name__ == "__main__":
try:
check_python_version()
except:
logging.exception(
dedent(
f"""
*************************************************************************
FATAL ERROR:
The system does not meet minimum requirements for running the SRW app.
Instructions for setting up python environments can be found on the web:
https://github.com/ufs-community/ufs-srweather-app/wiki/Getting-Started
*************************************************************************\n
"""
)
)
sys.exit(1)
4 changes: 3 additions & 1 deletion ush/check_ruc_lsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class Testing(unittest.TestCase):
def test_check_ruc_lsm(self):
USHdir = os.path.dirname(os.path.abspath(__file__))
self.assertTrue(
check_ruc_lsm(ccpp_phys_suite_fp=f"{USHdir}{os.sep}test_data{os.sep}suite_FV3_GSD_SAR.xml")
check_ruc_lsm(
ccpp_phys_suite_fp=f"{USHdir}{os.sep}test_data{os.sep}suite_FV3_GSD_SAR.xml"
)
)

def setUp(self):
Expand Down
Loading