Skip to content

Commit

Permalink
Add MU-MIP experiment configuration and Indian Ocean predefined grid
Browse files Browse the repository at this point in the history
  • Loading branch information
willmayfield committed Feb 5, 2024
1 parent bbe78ca commit f4d864e
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 4 deletions.
6 changes: 3 additions & 3 deletions jobs/JREGIONAL_GET_EXTRN_MDL_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ case ${EXTRN_MDL_NAME} in
# this was the first official forecast with the FV3GFS. However, paral-
# lel runs with the FV3GFS go back to 2018121500. So we set the first
# EXTRN_MDL_CDATE for the FV3GFS to this date and time.
CDATE_min="2018121500"
CDATE_min_netcdf="2021032100"
CDATE_max_nemsio="2021032018"
CDATE_min="2014121500"
CDATE_min_netcdf="2014032100"
CDATE_max_nemsio="2014032018"
if [ "$EXTRN_MDL_CDATE" -lt "$CDATE_min" ]; then
print_err_msg_exit "\
$(data_unavailable $EXTRN_MDL_NAME $EXTRN_MDL_CDATE $CDATE_min min)"
Expand Down
203 changes: 203 additions & 0 deletions ush/MUMIP_plot_domains.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
#!/usr/bin/env python

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.path import Path
import matplotlib.patches as patches
import numpy as np

#### User-defined variables


# Computational grid definitions
ESGgrid_LON_CTR = 73.0
ESGgrid_LAT_CTR = -15.0
ESGgrid_DELX = 3000.0
ESGgrid_DELY = 3000.0
ESGgrid_NX = 1651
ESGgrid_NY = 1510

# Write component grid definitions

WRTCMP_nx = 1621
WRTCMP_ny = 1480
WRTCMP_lon_lwr_left = 50
WRTCMP_lat_lwr_left = -35.8
WRTCMP_dx = ESGgrid_DELX
WRTCMP_dy = ESGgrid_DELY

# Plot-specific definitions

plot_res = "i" # background map resolution

# Note: Resolution can be 'c' (crude), 'l' (low), 'i' (intermediate), 'h' (high), or 'f' (full)
# To plot maps with higher resolution than low,
# you will need to download and install the basemap-data-hires package


#### END User-defined variables


ESGgrid_width = ESGgrid_NX * ESGgrid_DELX
ESGgrid_height = ESGgrid_NY * ESGgrid_DELY

big_grid_width = np.ceil(ESGgrid_width * 1.25)
big_grid_height = np.ceil(ESGgrid_height * 1.25)

WRTCMP_width = WRTCMP_nx * WRTCMP_dx
WRTCMP_height = WRTCMP_ny * WRTCMP_dy

fig = plt.figure()

# ax1 = plt.axes
ax1 = plt.subplot2grid((1, 1), (0, 0))

map1 = Basemap(
projection="gnom",
resolution=plot_res,
lon_0=ESGgrid_LON_CTR,
lat_0=ESGgrid_LAT_CTR,
width=big_grid_width,
height=big_grid_height,
)

map1.drawmapboundary(fill_color="#9999FF")
map1.fillcontinents(color="#ddaa66", lake_color="#9999FF")
map1.drawcoastlines()

map2 = Basemap(
projection="gnom",
lon_0=ESGgrid_LON_CTR,
lat_0=ESGgrid_LAT_CTR,
width=ESGgrid_width,
height=ESGgrid_height,
)

# map2.drawmapboundary(fill_color='#9999FF')
# map2.fillcontinents(color='#ddaa66',lake_color='#9999FF')
# map2.drawcoastlines()


map3 = Basemap(
llcrnrlon=WRTCMP_lon_lwr_left,
llcrnrlat=WRTCMP_lat_lwr_left,
width=WRTCMP_width,
height=WRTCMP_height,
resolution=plot_res,
projection="lcc",
lat_0=ESGgrid_LAT_CTR,
lon_0=ESGgrid_LON_CTR,
)

# map3.drawmapboundary(fill_color='#9999FF')
# map3.fillcontinents(color='#ddaa66',lake_color='#9999FF',alpha=0.5)
# map3.drawcoastlines()


# Draw gnomonic compute grid rectangle:

lbx1, lby1 = map1(*map2(map2.xmin, map2.ymin, inverse=True))
ltx1, lty1 = map1(*map2(map2.xmin, map2.ymax, inverse=True))
rtx1, rty1 = map1(*map2(map2.xmax, map2.ymax, inverse=True))
rbx1, rby1 = map1(*map2(map2.xmax, map2.ymin, inverse=True))

verts1 = [
(lbx1, lby1), # left, bottom
(ltx1, lty1), # left, top
(rtx1, rty1), # right, top
(rbx1, rby1), # right, bottom
(lbx1, lby1), # ignored
]

codes2 = [
Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
]

path = Path(verts1, codes2)
patch = patches.PathPatch(path, facecolor="r", lw=2, alpha=0.5)
ax1.add_patch(patch)


# Draw lambert write grid rectangle:

# Define a function to get the lambert points in the gnomonic space


def get_lambert_points(gnomonic_map, lambert_map, pps):

# 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"),
# and returns an array of two lists: one a list of tuples of the 4*ppf + 4 vertices mapping the approximate shape
# of the lambert domain on the gnomonic map, the other a list of "draw" instructions to be used by
# the PathPatch function

# pps is recommended 10 or less due to time of calculation

# Start array with bottom left point, "MOVETO" instruction
vertices = [
gnomonic_map(*lambert_map(lambert_map.xmin, lambert_map.ymin, inverse=True))
]
instructions = [Path.MOVETO]

# Next generate the rest of the left side
lefty = np.linspace(lambert_map.ymin, lambert_map.ymax, num=pps + 1, endpoint=False)

for y in lefty[1:]:
vertices.append(
tuple(gnomonic_map(*lambert_map(lambert_map.xmin, y, inverse=True)))
)
instructions.append(Path.LINETO)

# Next generate the top of the domain
topx = np.linspace(lambert_map.xmin, lambert_map.xmax, num=pps + 1, endpoint=False)

for x in topx:
vertices.append(
tuple(gnomonic_map(*lambert_map(x, lambert_map.ymax, inverse=True)))
)
instructions.append(Path.LINETO)

# Next generate the right side of the domain
righty = np.linspace(
lambert_map.ymax, lambert_map.ymin, num=pps + 1, endpoint=False
)

for y in righty:
vertices.append(
tuple(gnomonic_map(*lambert_map(lambert_map.xmax, y, inverse=True)))
)
instructions.append(Path.LINETO)

# Finally generate the bottom of the domain
bottomx = np.linspace(
lambert_map.xmax, lambert_map.xmin, num=pps + 1, endpoint=False
)

for x in bottomx:
vertices.append(
tuple(gnomonic_map(*lambert_map(x, lambert_map.ymin, inverse=True)))
)
instructions.append(Path.LINETO)

# Need to replace final instruction with Path.CLOSEPOLY
instructions[-1] = Path.CLOSEPOLY

return vertices, instructions


# Call the function we just defined to generate a polygon roughly approximating the lambert "rectangle" in gnomonic space

verts3, codes3 = get_lambert_points(map1, map3, 10)

# Now draw!

path = Path(verts3, codes3)
patch = patches.PathPatch(path, facecolor="w", lw=2, alpha=0.5)
ax1.add_patch(patch)


plt.savefig('MUMIP_domain.png')
40 changes: 40 additions & 0 deletions ush/config_mumip_indian_ocean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
metadata:
description: >-
config for MU-MIP project with UFS
user:
RUN_ENVIR: community
MACHINE: hera
ACCOUNT: fv3lam
platform:
CCPA_OBS_DIR: ""
MRMS_OBS_DIR: ""
NDAS_OBS_DIR: ""
workflow:
USE_CRON_TO_RELAUNCH: false
EXPT_SUBDIR: DYAMOND_3km
CCPP_PHYS_SUITE: FV3_RAP
PREDEF_GRID_NAME: MUMIP_IO_3km
DATE_FIRST_CYCL: '2016081012'
DATE_LAST_CYCL: '2016081012'
FCST_LEN_HRS: 36
PREEXISTING_DIR_METHOD: rename
VERBOSE: true
COMPILER: intel
task_get_extrn_ics:
EXTRN_MDL_NAME_ICS: FV3GFS
FV3GFS_FILE_FMT_ICS: netcdf
USE_USER_STAGED_EXTRN_FILES: true
EXTRN_MDL_SOURCE_BASEDIR_ICS: /scratch2/BMC/fv3lam/MUMIP/icbc_data/GFSreplay/FV3GFS/netcdf/2016081012
task_get_extrn_lbcs:
USE_USER_STAGED_EXTRN_FILES: true
EXTRN_MDL_SOURCE_BASEDIR_LBCS: /scratch2/BMC/fv3lam/MUMIP/icbc_data/GFSreplay/FV3GFS/netcdf/2016081012
EXTRN_MDL_NAME_LBCS: FV3GFS
LBC_SPEC_INTVL_HRS: 6
FV3GFS_FILE_FMT_LBCS: netcdf
task_run_fcst:
QUILTING: true
task_plot_allvars:
COMOUT_REF: ""
global:
DO_ENSEMBLE: false
NUM_ENS_MEMBERS: 2
35 changes: 35 additions & 0 deletions ush/predef_grid_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,38 @@
WRTCMP_dlon: 0.025
WRTCMP_dlat: 0.025

#
#-----------------------------------------------------------------------
#
# Future operational RRFS domain with ~3km cell size.
#
#-----------------------------------------------------------------------
#
"MUMIP_IO_3km":
GRID_GEN_METHOD: "ESGgrid"
ESGgrid_LON_CTR: 73.0
ESGgrid_LAT_CTR: -15.0
ESGgrid_DELX: 3000.0
ESGgrid_DELY: 3000.0
ESGgrid_NX: 1651
ESGgrid_NY: 1510
ESGgrid_PAZI: 0.0
ESGgrid_WIDE_HALO_WIDTH: 6
DT_ATMOS: 36
LAYOUT_X: 46
LAYOUT_Y: 24
BLOCKSIZE: 32
QUILTING:
WRTCMP_write_groups: 1
WRTCMP_write_tasks_per_group: 16
WRTCMP_output_grid: "lambert_conformal"
WRTCMP_cen_lon: 73.0
WRTCMP_cen_lat: -15.0
WRTCMP_stdlat1: -15.0
WRTCMP_stdlat2: -15.0
WRTCMP_nx: 1621
WRTCMP_ny: 1480
WRTCMP_lon_lwr_left: 50
WRTCMP_lat_lwr_left: -35.8
WRTCMP_dx: 3000.0
WRTCMP_dy: 3000.0
3 changes: 2 additions & 1 deletion ush/valid_param_vals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ valid_vals_PREDEF_GRID_NAME: [
"RRFS_NA_13km",
"RRFS_NA_3km",
"SUBCONUS_Ind_3km",
"WoFS_3km"
"WoFS_3km",
"MUMIP_IO_3km"
]
valid_vals_CCPP_PHYS_SUITE: [
"FV3_GFS_v15p2",
Expand Down

0 comments on commit f4d864e

Please sign in to comment.