Interrogating "Whiteness," Complicating "Blackness": Remapping ...
Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a...
Transcript of Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a...
Implementing a new suite of remapping functions within
NCL
1
Mohammad AboualiSIPARCS Intern at CISL/NCAR, 2011Computational Science Ph.D. Studentat Joint Program between SDSU & CGU
Mentor:David BrownCISL/VETS/NCAR
Co-Mentors:Mary Haley
(CISL/VETS/NCAR)Dennis Shea
(NESL/CGD/NCAR)
Numerical Modeling of The Environment
Understanding the Environment
• Measurements
• Satellite based measurements
• Numerical models
Ship Tracks Satellite Tracks
“The purpose of computingis insight, not numbers”.(Richard Hamming)
• Once the environment is described by numbers andequations, further mathematical operations can help usto understand our environment and predict how it may(re)act.
Model Performance
4
Selecting a coordinate system (grid) is one of the most important steps while developing a numerical model (Griffies et al., 2000).
Different parameters affect the performance of a numerical model.
Different models use different grids with different types and resolutions.
Take your pick
5
• Grid Types:– Structured:
• Rectangular
• Rectilinear
• Curvilinear…
– Hybrids:• Cube-Sphere
• Blocks
• Adaptive…
– Unstructured:• Triangular
• Quadrilateral
• Hexagonal...
Therefore, there existsmore than one best gridever.
Each model claims to bethe best model ever,
Sample Structured Grids
6
gridgen.c
http://code.google.com/p/gridgen-c/
Variational Method:Abouali
Sample Structured Grid
7
Tripolar Grid, using SCRIP2KML (NCL):
Sample Unstructured Grid
8
MPAS Grid, Using Unstruct2KML (NCL)
Comparison and Interaction
9
• To compare the results of different models anddata sets quantitatively, the data must be in thesame grid.
• Some models rely on the output of one or moremodels for their input, such as Surface EnergyBalance System (SEBS) (Su, 2002).
An Easy procedure tointerpolate data from one gridto another is needed.
Interpolation as a Transform Operator
10
• Interpolation can be considered to be a transformoperator, matrix A.
Vor
onoi
ww
w.n
cgia
.ucs
b.ed
u/gl
obal
grid
s-bo
ok/te
rra/
Cubed-S
phereIce.txcorp.com
/trac/modave/w
iki/CFP
roposalGridspec
Source Grid
Destination Grid
A
Datadestination grid = A ∗Datasource grid
•The interpolation schemedefines the entries of A.
•The majority of interpolationschemes only examine how thenodes in the destination andsource grids are located relativeto each other.
As long as the source anddestination grids are notchanged, matrix A remainsthe same.
A: InterpolationWeights
• Is a suite of functions and command lineoperators that facilitate the remappingcapabilities within the NCAR Command Language(NCL)
• Uses a software package from the Earth SystemModeling Framework (ESMF) to generateinterpolation weights, matrix A
• Available interpolation methods are:– Bilinear
– Conservative
– Patch
NCL Remapping Tools
11
www.ncl.ucar.edu
www.earthsystemmodeling.org
Remapping Procedure
12
Converting to SCRIP or ESMF
Generating interpolation weights
Applying the interpolation weights and remapping
Step
2
Step
1
Step
3
Converting to SCRIP or ESMF
13
• Several functions and procedures have been developed tofacilitate this step:– SCRIP Convention Files:
• GenBox_with_LLURCorner
• GenBox_with_Center_Dim
• Rectilinear2SCRIP
• Curvilinear2SCRIP
• Auto2SCRIP
– ESMF Convention Files:• Unstructured2ESMF
Stru
ctur
ed G
rids
Uns
tr.
Sample interface:function Auto2SCRIP (
sourceFileName [1] : string,varName [1] : string,SCRIPFileName [1] : string,fileTitle [1] : string,options [1] : logical
)return_val [1] : integer
CRCM GRID
• Calls “ESMF_RegridWeightGen” applicationwithin NCL
• ESMF must be compiled with NetCDF and LAPACK.
• If ESMF is compiled for multiprocessors, this stepwould be in parallel (requires mpirun).
Generating Interpolation Weights
14
NCL interface:function esmf_remap_weights (
sourceGrid [1] : string,destinationGrid [1] : string,weightFile [1] : string,options [1] : logical
)return_val [1] : integer
Options:•OverWrite•ForceOverWrite•method•pole•bothRegional•srcGridRegional
•dstGridRegional•isBothESMF•isSrcESMF•isDstESMF•showCMD
NOTE: All the interpolation weights aregenerated using ESMF software package;SCRIP weight generator is not used.
Remapping
15
• Using “sparse matrix multiplier” of NCL to applypreviously generated interpolation weights toperform the actual remapping/regridding
NCL remapping interface:function esmf_remap (
sourceData : numeric,weightFile [1] : string,Err [1] : integer
)return_val : numeric
Sample Code: Step 1
16
load "$ESMFRegridToolsPATH/ESMFRegridingTools.ncl"begin
sourceFile=”iceh.0070-01.nc"SCRIPFileName=“TGrid.nc”VarName="sst"fileTitle="A curvilinear Tripolar grid."Opt=True
Err=Auto2SCRIP(sourceFile,VarName, \SCRIPFileName,fileTitle,Opt)
if (Err.ne.0) thenprint("Not Successful!")exit
end ifend
Loading the Library
Initializing
Converting
Checking for Error
Sample Code: Step 2
17
load "$ESMFRegridToolsPATH/ESMFRegridingTools.ncl"begin
srcGrid="HRM3_SCRIP.nc"dstGrid="CRCM_SCRIP.nc"weightFile="HRM3_2_CRCM.nc"
Opt=TrueOpt@method="conserve”
Err=esmf_remap_weights(srcGrid,dstGrid, \weightFile,Opt)
if (Err.ne.0) thenprint("Not successful!")exit
end ifEnd
Loading the Library
Initializing
Checking for Error
Setting Options
Generating Weights
Sample Code: Step 3
18
load "$ESMFRegridToolsPATH/ESMFRegridingTools.ncl"begin
WFile=”WRF_2_Rect.nc"
fid=addfile("../data/WRF.grb","r")GH=todouble( fid->HGT_GDS5_ISBL_10 )
Err=0;dstGH=esmf_remap(GH(1,:,:),WFile,Err)
if (Err.ne.0) thenprint("Not Successful!")exit
end if end
Loading the Library
Initializing
Loading Source Data
Interpolating
Checking for Error
Sample Interpolation Results
19
• Temperature – HRM3 to CRCM
Sample Interpolation Results
20
• Surface Pressure - MPAS to 15arcmin World
Sample Interpolation Results
21
• Surface Pressure - MPAS to 15arcmin World
Sample Interpolation Results
22
• Surface Pressure - MPAS to Tripolar
Sample Interpolation Results
23
• Geopotential Height – WRF to Rectilinear
Purple Color shows the coverage of the rectilinear grid.
Sample Interpolation Results
24
• Sea Surface Temperature – Tripolar to MPAS
Sample Interpolation Results
25
• SWE – EASE to NH
Sample Interpolation Results
26
• SLP – CCSM4 to EASE
Command-Line Tools
27
• Some of the functions are also accessible fromthe command-line (Terminal).
• These commands can be used to convert grids toeither SCRIP or ESMF convention files.
• Once ESMF is compiled, the user gets acommand-line operator that generates weights.
• The user can apply the remapping weights withinthe command-line or a bash script on one ormultiple data files.
Want to Learn More?
28
• If you are interested in learninghow to use the package, pleaserefer to the NCL Remapping ToolsUser Guide.
• Only a subset of functions werediscussed in this presentation.
• The command line tools alongwith some extra useful functionsare described in the manual.
• 21+ Examples
• 5+ Comprehensive Examples
Thanks for the Support
29
• David Brown, Dennis Shea, Mary Haley
• NCAR and CISL personnel for assisting inevery step to make this internship happen
• Particular thanks to Kristin and Jennifer
• Dr. Robert Oehmke from NOAA for hiscollaboration and help on ESMF
• Christopher Kruse for the nice discussionsduring this internship
30
ww
w.razorleaf.com
/2010/09/epdm-docbom
-vs-itembom
/