@@ -3,22 +3,126 @@ title: Regrid
33subtitle : Tools for regridding MPAS-A output to regular lat-lon grids
44---
55
6- # pyremap
6+ # Options
7+
8+ ## pyremap
79
810[ pyremap] ( https://mpas-dev.github.io/pyremap/main/remapper/index.html )
911simplifies the process of regridding MPAS data to other grids.
10- It helps you compute weights (using ESMF or MOAB) and apply them,
12+ It helps you compute weights (using ` ESMF_RegridWeightGen ` or the MOAB CLI[ ^ mbcli ] )
13+ and apply them,
1114and works with global and limited-area meshes.
1215
13- # Global
16+ ## NCO
17+
18+ [ NCO] ( https://nco.sourceforge.net/ ) [ ncremap] ( https://nco.sourceforge.net/nco.html#ncremap-netCDF-Remapper )
19+ provides many facilities for regridding.
20+
21+ - Use ` ncremap ` to generate weights
22+ with ` ESMF_RegridWeightGen ` ("ERWG"),
23+ the TempestRemap CLI[ ^ trcli ] ,
24+ the MOAB CLI[ ^ mbcli ] , or internal routines[ ^ nco-internal ]
25+ - ERWG and MOAB can use multiple processors with ` --mpi_nbr=<n> `
26+ - To apply weights:
27+ - ` ncks -m map.nc --rgr `
28+ - ` ncremap -P mpasa -m map.nc in.nc out.nc `
29+ - ` -P mpasa ` (not always necessary) was added in NCO v5.2.6 (2024-06-20)
30+ - ` ncremap --pdq=Time,nVertLevels,nIsoLevelsT,nIsoLevelsZ,nCells -m map.nc in.nc out.nc `
31+
32+ [ ^ trcli ] :
33+ ` GenerateOverlapMesh ` (overlay the source and destination meshes and compute intersections),
34+ ` GenerateOfflineMap ` (generate weights)
35+
36+ [ ^ mbcli ] :
37+ ` mbconvert ` (to the MOAB native format), ` mbpart ` (partition into pieces for parallel processing),
38+ ` mbtempest ` (generate weights using the TempestRemap library)
39+
40+ [ ^ nco-internal ] :
41+ ` -a nco_con ` (first-order conservative),
42+ ` -a nco_idw ` (inverse distance weighting, can extrapolate)
43+
44+ ### Examples
45+
46+ ``` bash
47+ # Automatically generate a 1-degree target grid
48+ # Generate weights with TempestRemap conservative monotone algorithm
49+ ncremap -m map.nc -s mpas_source_grid.nc -g target_grid.nc -G latlon=180,360 -a traave
50+
51+ # Apply weights
52+ ncremap -P mpasa -m map.nc in.nc out.nc
53+ ```
54+
55+ ### Notes
56+
57+ > In practice, it may make sense to use the default "conservative" algorithm when performing conservative regridding,
58+ > and the "renormalized" algorithm when performing other regridding such as bilinear interpolation or nearest-neighbor.
59+ > Another consideration is whether the fields being regridded are fluxes or state variables.
60+ > For example, temperature (unlike heat) and concentrations (amount per unit volume)
61+ > are not physically conserved quantities under areal-regridding
62+ > so it often makes sense to interpolate them in a non-conservative fashion, to preserve their fine-scale structure.
63+ > Few researchers can digest the unphysical values of temperature
64+ > that the "conservative" option will produce in regions rife with missing values.
65+ > A counter-example is fluxes, which should be physically conserved under areal-regridding.
66+ > One should consider both the type of field and its conservation properties when choosing a regridding strategy.
67+ >
68+ > -- NCO doc, Section 3.26 Regridding
69+
70+ Renormalization is specified using ` --rnr=<threshold> ` where the threshold ranges from 0 to 1
71+ and indicates the fraction of given destination cell covered by valid (data not missing) source cells.
72+ Cell-times where the threshold is met preserve the mean, while others are set to missing.
73+ [ ] ( #pyremap ) supports renormalization as well (example uses 0.01).
74+
75+ It may be possible to use NCO RRG mode to generate weights for limited-area meshes,
76+ but it is more involved than using pyremap.
77+ However, you can use NCO to _ apply_ pyremap-generated weights.
78+
79+ It is also possible to use [ TempestRemap] ( https://github.com/ClimateGlobalChange/tempestremap )
80+ or [ MOAB] ( https://sigma.mcs.anl.gov/category/moab/ ) directly instead of through NCO.
81+
82+ ## CDO
83+
84+ (convert_mpas)=
85+
86+ ## convert_mpas
87+
88+ [ convert_mpas] ( https://github.com/mgduda/convert_mpas ) [ ^ cm ] provides a simple way
89+ to convert to a 0.5°x0.5° regular lat-lon grid (or other rectangular lat-lon grids).
90+
91+ [ ^ cm ] :
92+ Provided by the MPAS-A lead developer,
93+ and used in [ the official virtual tutorial] ( https://www2.mmm.ucar.edu/projects/mpas/tutorial/Virtual2025/ ) .
94+
95+ ### Examples
96+
97+ ``` bash
98+ # Default 0.5-degree global, one file
99+ convert_mpas x1.10242.init.nc diag.2017-09-20_12.00.00.nc
100+ ```
101+
102+ ``` bash
103+ # 2-degree global, all diag files
104+ convert_mpas x1.10242.init.nc diag.* .nc nlat=90 nlon=180
105+ ```
106+
107+ ``` bash
108+ # CONUS rectangle, all diag files
109+ echo " startlat=25
110+ endlat=50
111+ nlat=25
112+ startlon=-125
113+ endlon=-66
114+ nlon=59
115+ " > target_domain
116+
117+ convert_mpas x1.10242.init.nc diag.* .nc
118+ ```
14119
15- For global files, commonly used regridding tools should work
16- (i.e., they have implemented support for MPAS meshes):
120+ # Recommendations
17121
18- - NCO ` ncremap `
19- - CDO
20- - TempestRemap
122+ [ ] ( #convert_mpas ) for a quick remap, e.g. for checking your data with tools like ncview
21123
22- # Limited-area
124+ Otherwise:
23125
24- - Kelly has a tool that allows CDO to work with limited-area meshes.
126+ - [ ] ( #pyremap ) for generating weights
127+ - Generate both conservative and bilinear weights to be used for different variables
128+ - [ ] ( #pyremap ) for applying weights
0 commit comments