+ All Categories
Home > Documents > Departments of Earth System Science and Computer Science...

Departments of Earth System Science and Computer Science...

Date post: 02-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
40
How to Regrid Swath Data Charlie Zender <[email protected] > Departments of Earth System Science and Computer Science, UC Irvine Seminar on Web GSFC GES DISC Greenbelt, MD April 5, 2016
Transcript
Page 1: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

How to Regrid Swath Data

Charlie Zender <[email protected]>

Departments of Earth System Science and Computer Science, UC Irvine

Seminar on Web

GSFC GES DISCGreenbelt, MD April 5, 2016

Page 2: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Weight f(x,y) numbers, then add them

Page 3: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Regridding Swath, Curvilinear, Rectangular, and Unstructured

Data (SCRUD)Charlie Zender <[email protected]>

Departments of Earth System Science and Computer Science, UC Irvine

Seminar on Web

GSFC DISCGreenbelt, MD April 5, 2016

Page 4: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Overview1.Prerequisites2.Rectangular, Swath/Curvilinear, Unstructured Grids3.Remapping4.Parallelism and Performance

Page 5: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Prerequisites1. netCDF Operators (NCO) (mandatory)> sudo dnf install nco

2. ESMF_RegridWeightGen (optional)> sudo dnf install gfortran csh ncl

3. TempestRemap (optional)> sudo dnf install lapack lapack-devel blas> git clone https://github.com \ ClimateGlobalChange/tempestremap.git

Page 6: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Find/Obtain/Install NCO DOE Labs, NCAR Yellowstone:> export PATH='~zender/bin':${PATH}> export LD_LIBRARY_PATH='~zender/lib': \${LD_LIBRARY_PATH}

Local clusters, workstations, laptops:> sudo aptitude install nco # Debian> sudo dnf install nco # Fedora> sudo port install nco # MacPorts> git clone [email protected]:nco/nco.git # DIY> ./configure; sudo make install

Page 7: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

GitHub NCO homepage

Page 8: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Overview1.Prerequisites2.Rectangular, Swath/Curvilinear, Unstructured Grids3.Remapping4.Parallelism and Performance

Page 9: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

RectangularEquiangular Grid

RectangularCap Grid

Courtesy M. Taylor, Sandia Nat'l Lab

Page 10: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Curvilinearlat(x,y), lon(x,y)

Page 11: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

UnstructuredCubed-Sphere lat(i), lon(i)

Courtesy M. Taylor, Sandia Nat'l Lab

UnstructuredDrainage/river lat(i), lon(i)

Page 12: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

SwathCurvilinearlat(x,y), lon(x,y)

Potentially SwathUnstructuredlat(i), lon(j)

Page 13: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Overview1.Prerequisites2.Rectangular, Swath/Curvilinear, Unstructured Grids3.Remapping4.Parallelism and Performance

Page 14: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Regrid NASA AIRS Level 2 Swath Data in raw HDF4 format from regional curvilinear 45x30 source grid to equiangular 1x1 degree:

Remap Swath Data

% ncremap -i AIRS.2014.10.01.202.L2.RetStd.v6.0.11.0.G14275134307.hdf -d 1x1.nc

Page 15: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Global Sea-Ice (CICE) Data

Native CICE grid has _FillValue in mask variable (tmask), which NCL function curvilinear_to_SCRIP() and ESMF do not understand. Unless user first manually sets _FillValue to 0, NCL generates incorrect grid, and regridding produces subtly biased results. ncremap handles missing values in masks without user intervention.

Page 16: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

"ncremap" documentation

Page 17: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Run "ncremap"> ncremap -i in.nc -d dst.nc -o out.nc> ncremap # Print help

Page 18: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

ncremap Help Screen

Examples

Command

Options

Page 19: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Pre-computed map > ncremap -I in_drc -m map.nc -O out_drc

Data on Identical input grids

Page 20: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Standard Output> ls in*.nc | ncremap -m map -O drc

Summary

Status

Preamble

Page 21: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Regrid NASA AIRS Level 2 Swath Data in raw HDF4 format from regional curvilinear 45x30 source grid to equiangular 1x1 degree:

Remap Swath Data

% ncremap -i AIRS.2014.10.01.202.L2.RetStd.v6.0.11.0.G14275134307.hdf -d 1x1.nc

Page 22: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Four Invocation ModesFree-will: Infer source and destination grids> ncremap -i in.nc -d dst.nc # L2-Swath Data!

Old grid: Known grid(s) generate mapfile> ncremap -s src.nc -g dst_grd.nc

New grid: Generate destination-grid with NCO> ncremap -G '--rgr latlon=40,40 --rgr \ snwe=30.0,70.0,-130.0,-90.0'

Pre-Destination: Apply supplied mapfile> ncremap -m map.nc # Fastest

Page 23: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Free-will Grid-inferral Algorithm

ncremap first looks in any (optionally) supplied gridfile or mapfile, and supplements this information (if any) with grid details sometimes provided in CF metadata (e.g., "bounds" variables) from the datafiles themselves. ncremap next tests for known rectangular grid types (equiangular, FV, offset, Gaussian) and supplements metadata with exact information derived from inferred gridtype, if any. This fails for swath, curvilinear, and unstructured grids, for which ncremap must extrapolate grid properties from cell-center locations.

Page 24: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Regrid NASA MODIS Level 2 Data in HDF4 format from 550x543 swath to equiangular 1x1 degree:

Remap Swath Data

% ncremap -v chlorophyll -i MODIS_L2N_20140304T1120_noNaN. -d 1x1.nc

Page 25: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Regrid NASA OMI Level 2 Ozone Data in HDF-EOS format from swath to 1x1 degree:

Remap Swath Data

% ncremap -v StepTwoO3 -i OMI-Aura_L2-OMTO3_2015m0731t0034-o58727_v003-2015m0731t080836.he5.nc -d 1x1.nc

Page 26: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Regrid NASA OMI Level 2 Ozone Data in HDF-EOS format from swath to 1x1 degree:

Remap Swath Data

% ncremap -v StepTwoO3 -i OMI-Aura_L2-OMTO3_2015m0731t0034-o58727_v003-2015m0731t080836.he5.nc -d 1x1.nc

Page 27: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

ncremap Options> ncremap -i in.nc -d dst.nc -o out.nc> ncremap … -m map … # Map (weights)> ncremap … -I drc_in … # Input directory> ncremap … -O drc_out … # Output directory> ncremap … -v FSNT,Q … # Subset> ncremap … -a conserve … # Algorithm> ncremap … -j 16 … # Batch job number> ncremap … -P airs … # Permutation type> ncremap … -p mpi … # Parallelism type> ncremap … -t thr_nbr … # Thread number> ncremap … -w tempest … # Weight generator

Page 28: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Current Issues 1. Regridding unstructured data when horizontal dimensions (i.e., latitude/longitude) vary more slowly than others (e.g., vertical, species)> ncremap … -P airs … # AIRS, HIRDLS, MLS (beta)2. Extensive variables (e.g., numbers, counts)> ncremap … -x TsurfStd_ct … # In progress (alpha)3. LIDAR without cell bounds or areas> ncremap … -i oco2.nc4 ... # In progress (alpha)4. Overlapping gridcells, e.g., polar swaths> ncremap … -i gpm.nc, amsr.nc ... # In progress

Page 29: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Overview1.Prerequisites2.Rectangular, Swath/Curvilinear, Unstructured Grids3.Remapping4.Parallelism and Performance

Page 30: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Three Parallelism Modes> ncremap -I drc_in -O drc_out> ncremap … -p nil … # Serial> ncremap … -p bck ... # Background (default)> ncremap … -p mpi … # MPI

● Serial: Execute sequentially on single node● Background: Fork process for each remap all on

single node. Control batchsize with -j job_nbr.● MPI: Spawn MPI process to new node for each

remap. Control batchsize with -j job_nbr.

Page 31: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

swath1

core1 core2 … coreC

●1 remap per core, C cores, thr_nbr=1●1 remap per C cores, thr_nbr=C●Hybrid

swathNswath2

Background Parallelism &

Page 32: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

swath1

node1 node2 … nodeN

●1 remap per node, N nodes, thr_nbr=C●2 remaps per node, thr_nbr=C/2

swathNswath2

MPI Parallelism

Page 33: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Threaded Regridding

●Regridding automatically invokes 2 (default) to 8 threads

●> ncremap…-t 8... # Threads

node1

var1, var4, ... varV-2

core1

core2

core3

var2, var5, ... varV-1

var3, var6, ... varV

Page 34: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

ncremap is threaded over variables with OpenMP and scales well up to 8-16 threads:

Threading Performance

Page 35: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Three regridders (UV-CDAT, NCL, NCO) on CAM-SE unstructured grid datasets from ~1-13 GB on multicore nodes:

Regridder Bake-Off

Page 36: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

node1core1

core2

coreC

var2, var5, ... varV-1

var3, var6, ... varV

node2 nodeN

core2

core1 core1

core2

coreC coreC

var1, var4, ... varV-2

var1, var4, ... varV-2

var2, var5, ... varV-1

var2, var5, ... varV-1

var3, var6, ... varV

var3, var6, ... varV

var1, var4, ... varV-2

Page 37: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Chooose Parallel Mode to Optimize Throughput

RAM: sizeof(map) + ~4x sizeof(var) per thread● Serial: Safest, slowest. Ideal for laptops, desktops.

Alternative to MPI-mode for small RAM systems.● Background: Default mode. Works on login nodes,

compute nodes, and beefy workstations.● MPI: Necessary for fast high-resolution remapping

on small-moderate systems

Page 38: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Vaporware 1. Allow CF "coordinates" to specify coordinates2. Radius-of-influence for weighting3. Understand quality flags4. Optimal Voronoi input mesh

Page 39: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

ncremap Advances1. Single command regrids Swath, Curvilinear,

Rectangular, and Unstructured Data (SCRUD)2. Infers accurate grids without user intervention3. Fastest regridder tested (with pre-computed maps)4. Parallelizes remapping workflows

Page 40: Departments of Earth System Science and Computer Science ...dust.ess.uci.edu/smn/smn_nco_gsfc_201604.pdfHow to Regrid Swath Data Charlie Zender  Departments of

Supplementary Slides


Recommended