-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPHY conversion #496
DEPHY conversion #496
Conversation
grantfirl
commented
Jul 24, 2024
•
edited
Loading
edited
- Add dephy_converter.py script that takes one argument (-n name_of_case) where name_of_case is found in scm/etc/case_config and data file found in scm/data/processed_case_input and produces a DEPHY-formatted case namelist and data file
- This script successfully converted all previous cases except for fv3_model_point_noah that was outdated.
- Files in scm/etc/case_config are updated
- Files in scm/data/processed_case_input were updated in v7.0.0-beta release asset
- Fixed small bugs in run_scm.py, scm_forcing.F90, and scm_input.F90
…th non-conforming COMBLE case DEPHY file
…rcingT to be true and surfaceforcinglsm to be true - ingests LSM data and a forcing surface T
I have updated DEPHY files for all data in data/processed_case_input ready to be made into a release asset. |
…ts (with new DEPHY-format processed_case_input files)
@@ -21,7 +21,7 @@ for file in "${data_files[@]}"; do | |||
mkdir -p $BASEDIR/scm/data/$file | |||
cd $BASEDIR/scm/data/$file | |||
echo "Retrieving $file" | |||
wget https://github.com/NCAR/ccpp-scm/releases/download/v6.0.0/${file}.tar.gz | |||
wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/${file}.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkavulich As soon as there is a v7.0.0-beta release on GitHub, this script is ready to go and CI should use the new files.
#height = ffc.get_height_from_pres(T_abs[:,0],levels,z_sfc) | ||
|
||
#the following variables are not in this forcing file, but are included in other cases | ||
soil_depth = np.zeros(4,dtype=float) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hertneky It's not showing as changed because this file is new, but I added this (needed by the dephy_converter.py script when lsm_ics = T)
snwdph = 2.e-4 | ||
tg3 = 271.35 | ||
zorl = 15.0 | ||
alvsf = 0.06 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hertneky Updated these (alvsf, alnsf, alvwf, alnwf, facsf, facwf). The previous values were from the GABLS3 case, but those are specific to that location. These are the values from the UFS fix files for this lat/lon. It doesn't seem to change the results though.
canopy = 0.0 | ||
vegtyp = 0 | ||
soiltyp = 0 | ||
scolor = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hertneky Added scolor needed by lsm_ics.
shdmax = 0.0 | ||
slopetyp = 1 | ||
snoalb = 0.0 | ||
sncovr = 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hertneky Added sncovr needed by lsm_ics.
writefile_zorl_var.units = 'cm' | ||
writefile_zorl_var.description = 'composite surface roughness length' | ||
|
||
writefile_zorll_var = writefile_scalar_grp.createVariable('zorll', 'f4') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hertneky Writing out zorll, zorlw, zorli as identical to zorl -- needed by lsm_ics.
@@ -0,0 +1,590 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hertneky Everything that I added to the MOSAiC_AMPS_forcing... file, I repeated here.
call NetCDF_read_var(ncid, "pa", .True., input_pres) | ||
call NetCDF_read_var(ncid, "zh", .True., input_height) | ||
|
||
if (lev_in_altitude) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bluefinweiwei This code change is to accommodate the COMBLE case that doesn't supply everything that a DEPHY file should have. One has a choice of what to put in the 'lev' data in the NetCDF file (according to the DEPHY file specification). This code can now handle whether the data is altitude in m or pressure levels in Pa. With this change, the other changes that you had to the scm_input.F90 file are taken care of.
else if (trim(input_surfaceForcingLSM) == 'lsm') then | ||
end if | ||
|
||
if (trim(input_surfaceForcingLSM) == 'lsm') then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: This is needed to not have LSM ICs be mutually exclusive to surfaceForcingT == 'ts'. For the MOSAiC cases, we have a forcing surface T and LSM IC data for the sea ice. This allows us to read in LSM IC data and force the surface temperature, like the case wants. This does not break the GABLS3 cases (tested).
@@ -2259,8 +2318,8 @@ subroutine get_case_init_DEPHY(scm_state, scm_input) | |||
!set all individual w forcing controls to .true. until finer control is available from the input file | |||
scm_state%force_sub_for_T = .true. | |||
scm_state%force_sub_for_qv = .true. | |||
scm_state%force_sub_for_u = .true. | |||
scm_state%force_sub_for_v = .true. | |||
!scm_state%force_sub_for_u = .true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can potentially be uncommented. Subsidence forcing typically isn't applied to horizontal momentum and the DEPHY standard doesn't have a control for which variables to apply w or omega forcing to. This is simply an assertion on my part.
@@ -27,6 +27,17 @@ | |||
{"case": "LASSO_2016051812", "suite": "SCM_GFS_v16"}, \ | |||
{"case": "LASSO_2016051812", "suite": "SCM_WoFS_v0"}, \ | |||
{"case": "LASSO_2016051812", "suite": "SCM_HRRR_gf"}, \ | |||
{"case": "COMBLE", "suite": "SCM_GFS_v17_p8_ugwpv1"}, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ligiabernardet @dustinswales Added COMBLE/MOSAiC to RTs
…shorter and will make list maintenance less of a hassle if changes are needed
- Fix calls to logging.critical() with no argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grantfirl I have opened two PRs to your branch with proposed changes (only one of which should be merged): one of which is my "preferred" changes and the other I'd consider "essential" changes. Note that I haven't run any tests yet (since I'm not sure where to get that data) but the changes should still produce bit-for-bit identical output.
grantfirl#11 These are my preferred changes. I understand that it is invasive, but it eliminates so much code redundancy that doesn't seem necessary. Also some fixes to problems mentioned below.
grantfirl#12 These are my "essential" changes. It converts the huge multi-line regular string with arguments at the end to a multi-line f-string, which is much easier to maintain.
Both of the above PRs include two bug fixes:
- a fix to a bug which may require that data gets re-converted:
w_d
was assigned the value ofw_0
. - Several calls to
logging.critical()
that included no message string as argument, which is required.
I also included "debug" as a new argument to get debug output rather than requiring manual editing of code.
Essential Updates for PR 496
Co-authored-by: Michael Kavulich <[email protected]>
Co-authored-by: Michael Kavulich <[email protected]>
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes, just a few more minor suggestions that are not required for merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grantfirl These changes look good to me. Thanks for this, it was a big effort to convert all of the cases to DEPHY.
I had a super picky comment, but nothing to hold this up.
Co-authored-by: Michael Kavulich <[email protected]>
Co-authored-by: Michael Kavulich <[email protected]>
Co-authored-by: Michael Kavulich <[email protected]>
Co-authored-by: Michael Kavulich <[email protected]>