Skip to content
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

Add more wildcard characters to filenames and add soil color to LSM IC #419

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 8 additions & 5 deletions scm/etc/scripts/UFS_IC_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ def get_UFS_surface_data(dir, tile, i, j, old_chgres, lam):
facsf_in = read_NetCDF_surface_var(nc_file, 'facsf', i, j, old_chgres, 0)
facwf_in = read_NetCDF_surface_var(nc_file, 'facwf', i, j, old_chgres, 0)
styp_in = read_NetCDF_surface_var(nc_file, 'stype', i, j, old_chgres, 0)
scol_in = read_NetCDF_surface_var(nc_file, 'scolor', i, j, old_chgres, 0)
slope_in = read_NetCDF_surface_var(nc_file, 'slope', i, j, old_chgres, 0)
vtyp_in = read_NetCDF_surface_var(nc_file, 'vtype', i, j, old_chgres, 0)
vfrac_in = read_NetCDF_surface_var(nc_file, 'vfrac', i, j, old_chgres, 0)
Expand Down Expand Up @@ -1187,6 +1188,7 @@ def get_UFS_surface_data(dir, tile, i, j, old_chgres, lam):
"facsf": facsf_in,
"facwf": facwf_in,
"soiltyp": styp_in,
"scolor": scol_in,
"slopetyp": slope_in,
"vegtyp": vtyp_in,
"vegfrac": vfrac_in,
Expand Down Expand Up @@ -1313,7 +1315,7 @@ def get_UFS_oro_data(dir, tile, i, j, lam):
if lam:
nc_file = Dataset('{0}/{1}'.format(dir,'oro_data.nc'))
else:
filename_pattern = 'oro_data.tile{0}.nc'.format(tile)
filename_pattern = 'oro*.tile{0}.nc'.format(tile)
for f_name in os.listdir(dir):
if fnmatch.fnmatch(f_name, filename_pattern):
filename = f_name
Expand Down Expand Up @@ -1462,8 +1464,8 @@ def get_UFS_forcing_data(nlevs, state_IC, location, use_nearest, forcing_dir, gr
atm_ftag = 'atmf*.tile{0}.nc'.format(tile)
sfc_ftag = 'sfcf*.tile{0}.nc'.format(tile)
else:
atm_ftag = 'atmf*.nc'
sfc_ftag = 'sfcf*.nc'
atm_ftag = '*atmf*.nc'
sfc_ftag = '*sfcf*.nc'

# Get list of UFS history files with 3D ATMospheric state variables.
atm_filenames = []
Expand Down Expand Up @@ -2450,6 +2452,7 @@ def write_SCM_case_file(state, surface, oro, forcing, case, date, stateREGRID):
{"name": "q2m", "type":wp, "dimd": ('t0'), "units": "kg kg-1", "desc": "2-meter specific humidity"}, \
{"name": "vegtyp", "type":wi, "dimd": ('t0'), "units": "none", "desc": "vegetation type (1-12)"}, \
{"name": "soiltyp", "type":wi, "dimd": ('t0'), "units": "none", "desc": "soil type (1-12)"}, \
{"name": "scolor", "type":wi, "dimd": ('t0'), "units": "none", "desc": "soil color (1-20)"}, \
{"name": "ffmm", "type":wp, "dimd": ('t0'), "units": "none", "desc": "Monin-Obukhov similarity function for momentum"}, \
{"name": "ffhh", "type":wp, "dimd": ('t0'), "units": "none", "desc": "Monin-Obukhov similarity function for heat"}, \
{"name": "hice", "type":wp, "dimd": ('t0'), "units": "m", "desc": "sea ice thickness"}, \
Expand Down Expand Up @@ -2638,8 +2641,8 @@ def write_comparison_file(comp_data, case_name, date, surface):
########################################################################################
def find_date(forcing_dir):

atm_ftag = 'atmf*.nc'
atm_ftag = '*atmf*.nc'

atm_filenames = []
for f_name in os.listdir(forcing_dir):
if fnmatch.fnmatch(f_name, atm_ftag):
Expand Down
4 changes: 4 additions & 0 deletions scm/etc/scripts/extract_FV3GFS_column_ic.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
facsf_in=ncin2['facsf'][jpt,ipt]
facwf_in=ncin2['facwf'][jpt,ipt]
styp_in=ncin2['stype'][jpt,ipt]
scol_in=ncin2['scolor'][jpt,ipt]
slope_in=ncin2['slope'][jpt,ipt]
vtyp_in=ncin2['vtype'][jpt,ipt]
vfrac_in=ncin2['vfrac'][jpt,ipt]
Expand Down Expand Up @@ -149,6 +150,7 @@
ivegsrc = nc.createVariable('scalars/vegsrc',np.int32)
ivegtyp = nc.createVariable('scalars/vegtyp',np.int32)
isoiltyp = nc.createVariable('scalars/soiltyp',np.int32)
iscolor = nc.createVariable('scalars/scolor',np.int32)
islopetyp = nc.createVariable('scalars/slopetyp',np.int32)
ivegfrac = nc.createVariable('scalars/vegfrac',np.float)
ishdmin = nc.createVariable('scalars/shdmin',np.float)
Expand Down Expand Up @@ -180,6 +182,7 @@
ivegsrc.description = "vegetation soure (1-2)"
ivegtyp.description = "vegetation type (1-12)"
isoiltyp.description = "soil type (1-12)"
iscolor.description = "soil color (1-20)"
islopetyp.description = "slope type (1-9)"
ivegfrac.description = "vegetation fraction"
ishdmin.description = "minimum vegetation fraction"
Expand Down Expand Up @@ -395,6 +398,7 @@
ivegsrc[:] = 1
ivegtyp[:] = vtyp_in
isoiltyp[:] = styp_in
iscolor[:] = scol_in
islopetyp[:] = slope_in
ishdmin[:] = shdmin_in
ishdmax[:] = shdmax_in
Expand Down
Loading