This program interpolates fields from an MPAS mesh (the "source" mesh) to a regular WRF grid (the "target" grid). Integer fields use nearest neighbor interpolation, snow-related fields use conservative regridding, and all other fields use bilinear interpolation.
The main point of this program was to be able to interpolate fields from an MPAS mesh to a regular grid for data visualization and post-processing purposes.
Additional information to what's below can be found in the included MPASSIT_presentation.pdf.
Compiling instructions:
0)[Only necessary on non-RDHPCS machines] Create an appropriate module file in the modulefiles subdirectory named build.[target].[compiler].lua (if your machine supports lua modulefiles) or build.[target]. In this file you will need to load your desired compiling environment, including cmake and MPI. Environmental variables NETCDF and ESMFMKFILE are also necessary and should be pointed to the top directory of the NETCDF install and the file esmf.mk of your ESMF install, respectively. Note that this code requires NetCDF compiled with hdf5.
An example file that loads the build environment through modulefiles and the extra libraries via LD_LIBRARY_PATH modification is provided in modulfiles/build.jet.test.intel.lua.
1) run build.sh [target] [compiler]
Run instructions:
1) Copy all variable list files from ./parm in to run directory. Each file is formatted like:
rainc RAINC rainnc RAINNC refl10cm_max REFL10CM_MAX [...]
with the variable name in the MPAS file in the first column, and the desired output name in the second file. Variables are separated in to four categories:
a) Variables from the diag file (diaglist)
b) 2-dimensional variables from the history file (histlist_2d)
c) 3-dimensional variables from the history file (histlist_3d)
d) 3-dimensional soil variables from the history file (histlist_soil)
The user can edit these to their specifications, if they so wish.
2) Create a namelist file of any name in run directory (e.g., namelist.input)
Input/namelist:
&config grid_file_input_grid="/scratch/wof/mpas/init.nc" hist_file_input_grid="/scratch/wof/mpas/init.nc" diag_file_input_grid="/scratch/wof/mpas/diag.2019-05-18_00.00.00.nc" file_target_grid="/scratch/wicker/27April2011/ICs/wrfinput_d01" output_file="/scratch/larissa.reames/out_hist_diag.nc" block_decomp_file="/scratch/wof/mpas/wofs_mpas.graph.info.part.120" target_grid_type = 'lambert' interp_diag=.true. interp_hist=.true. esmf_log=.false. nx = 1801 ny = 1061 dx = 3000.0 dy = 3000.0 ref_lat = 38.50 ref_lon = -97.50 truelat1 = 38.5 truelat2 = 38.5 stand_lon = -97.5 /
grid_file_input_grid : Full path of MPAS file containing grid information
hist_file_input_grid : Full path of input history MPAS data
diag_file_input_grid : Full path of input diag MPAS data
target_grid_type : Grid type to interpolate date to. Supported options are: 'file', 'lambert', lat-lon'
file_target_grid : Full path of WRF file containing target grid information, supported types: wrfout, wrfinput, geo_em (Valid only if target_grid_type='file')
is_regional: Whether the target grid is regional or not (default:.true.)
output_file : Full path of output file
block_decomp_file : Full path to the MPAS grid-specific block decomposition file
interp_diag : Whether to interpolate fields from the diag file (T/F)
interp_hist : Whether to interpolate fields from the hist file (T/F)
wrf_mod_vars : Whether to modify output variables to conform to WRF shapes (i.e. staggered winds) (default:.false.)
esmf_log : Whether to output ESMF files (PET) if an ESMF error is encounters (default:.false.)
The following options are only valid for target_grid_type NOT 'file':
nx : The number of target grid points in the east-west direction
ny : The number of target grid pointers in the north-south direction
dx : Grid size (meters, or deg for target_grid_type='lat-lon') in the east-west direction
dy : Grid size (meters, or deg for target_grid_type='lat-lon') in the north-south direction
ref_lat : Reference latitude of the target grid projection
ref_lon : Reference longitude of the target grid projection
truelat1 : First true latitude of target grid projection (for target_grid_type='lambert')
truelat2 : Second true latitude of target grid projection (for target_grid_type='lambert'; optional)
stand_lon : Standard longitude of the target grid projection (for target_grid_type='lambert')
missing_value : Value to be used as _FillValue for unmappable target points (default = -9999.0)
3) Submit to job queue (most grids won't need more then 3 nodes/72 processes)
srun bin/mpassit namelist.input [or whatever your chosen namelist is named]