implementing a new suite of remapping functions within ncl m... · 2020-01-07 · implementing a...

30
Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR, 2011 Computational Science Ph.D. Student at Joint Program between SDSU & CGU Mentor: David Brown CISL/VETS/NCAR Co-Mentors: Mary Haley (CISL/VETS/NCAR) Dennis Shea (NESL/CGD/NCAR)

Upload: others

Post on 13-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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)

Page 2: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Numerical Modeling of The Environment

Page 3: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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.

Page 4: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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.

Page 5: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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,

Page 6: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Structured Grids

6

gridgen.c

http://code.google.com/p/gridgen-c/

Variational Method:Abouali

Page 7: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Structured Grid

7

Tripolar Grid, using SCRIP2KML (NCL):

Page 8: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Unstructured Grid

8

MPAS Grid, Using Unstruct2KML (NCL)

Page 9: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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.

Page 10: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 11: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

• 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

Page 12: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Remapping Procedure

12

Converting to SCRIP or ESMF

Generating interpolation weights

Applying the interpolation weights and remapping

Step

2

Step

1

Step

3

Page 13: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 14: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

• 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.

Page 15: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 16: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 17: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 18: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 19: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

19

• Temperature – HRM3 to CRCM

Page 20: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

20

• Surface Pressure - MPAS to 15arcmin World

Page 21: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

21

• Surface Pressure - MPAS to 15arcmin World

Page 22: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

22

• Surface Pressure - MPAS to Tripolar

Page 23: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

23

• Geopotential Height – WRF to Rectilinear

Purple Color shows the coverage of the rectilinear grid.

Page 24: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

24

• Sea Surface Temperature – Tripolar to MPAS

Page 25: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

25

• SWE – EASE to NH

Page 26: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

Sample Interpolation Results

26

• SLP – CCSM4 to EASE

Page 27: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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.

Page 28: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 29: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

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

Page 30: Implementing a new suite of remapping functions within NCL M... · 2020-01-07 · Implementing a new suite of remapping functions within NCL 1 Mohammad Abouali SIPARCS Intern at CISL/NCAR,

30

ww

w.razorleaf.com

/2010/09/epdm-docbom

-vs-itembom

/