ESMPy: The Python Interface to the Earth System Modeling Framework Ryan O’Kuinghttons, Robert Oehmke Cecelia DeLuca, Gerhard Theurich Peggy Li, Joseph.

Slides:



Advertisements
Similar presentations
EURO4M Project Kick-Off, April 2010 OGC Web Services Data visualization using OGC web services Maarten Plieger Wim Som de Cerff Royal Netherlands Meteorological.
Advertisements

Expanding Regridding Capabilities of the Earth System Modeling Framework Andrew Scholbrock University of Colorado – Boulder Robert Oehmke NOAA/CIRES 1.
NSF NCAR | NASA GSFC | DOE LANL ANL | NOAA NCEP GFDL | MIT | U MICH Emergence of the Earth System Modeling Framework NSIPP Seasonal Forecast.
Earth System Curator Spanning the Gap Between Models and Datasets.
Metadata Development in the Earth System Curator Spanning the Gap Between Models and Datasets Rocky Dunlap, Georgia Tech.
The Model Output Interoperability Experiment in the Gulf of Maine: A Success Story Made Possible By CF, NcML, NetCDF-Java and THREDDS Rich Signell (USGS,
ESMPy and OpenClimateGIS: Python Interfaces for High Performance Grid Remapping and Geospatial Dataset Manipulation Ryan O’Kuinghttons, Ben Koziol, Robert.
NCAR GIS Program : Bridging Gaps
CSE351/ IT351 Modeling And Simulation Choosing a Mesh Model Dr. Jim Holten.
Marine GIS Applications using ArcGIS Global Classroom training course Marine GIS Applications using ArcGIS Global Classroom training course By T.Hemasundar.
Web-based Portal for Discovery, Retrieval and Visualization of Earth Science Datasets in Grid Environment Zhenping (Jane) Liu.
A Quick Tour of the NOAA Environmental Software Infrastructure and Interoperability Group Cecelia DeLuca and the ESMF team ESRL Directorate Seminar June.
Community infrastructure for building and coupling high performance climate, weather, and coastal models Cecelia DeLuca NOAA / CIRES University of Colorado,
Session 2: ESMF Distributed Data Classes
Metadata Creation with the Earth System Modeling Framework Ryan O’Kuinghttons – NESII/CIRES/NOAA Kathy Saint – NESII/CSG July 22, 2014.
Fast Parallel Grid Remapping for Unstructured and Structured Grids Robert Oehmke NOAA Cooperative Institute for Research in Environmental Sciences University.
ESMF Town Hall Meeting AGU Fall Meeting 2010 San Francisco Gerhard Theurich, Fei Liu, Peggy Li, Cecelia DeLuca NOAA/CIRES December 15, 2010
Metadata for the Coupled Ocean/Atmosphere Mesoscale Prediction System (COAMPS) using the Earth System Modeling Framework (ESMF) Peter Bosler University.
NE II NOAA Environmental Software Infrastructure and Interoperability Program Cecelia DeLuca Sylvia Murphy V. Balaji GO-ESSP August 13, 2009 Germany NE.
HDF5 A new file format & software for high performance scientific data management.
ESMF Development Status and Plans ESMF 4 th Community Meeting Cecelia DeLuca July 21, 2005 Climate Data Assimilation Weather.
Update on ESMF, Earth System Curator, and Earth System CoG Cecelia DeLuca and the ESMF team CCSM Software Engineering Working Group June 23, 2011.
Computational Design of the CCSM Next Generation Coupler Tom Bettge Tony Craig Brian Kauffman National Center for Atmospheric Research Boulder, Colorado.
A Metadata Based Approach For Supporting Subsetting Queries Over Parallel HDF5 Datasets Vignesh Santhanagopalan Graduate Student Department Of CSE.
2 3 ROMS/COAWST NcML file 4 5 Exploiting IOOS: A Distributed, Standards-Based Framework and Software Stack for Searching, Accessing, Analyzing and.
Unidata TDS Workshop TDS Overview – Part I XX-XX October 2014.
material assembled from the web pages at
GMT: The Generic Mapping Tools Paul Wessel, Walter H.F. Smith and the GMT team.
Initial Results from the Integration of Earth and Space Frameworks Cecelia DeLuca/NCAR, Alan Sussman/University of Maryland, Gabor Toth/University of Michigan.
Mid-Course Review: NetCDF in the Current Proposal Period Russ Rew
IPlant cyberifrastructure to support ecological modeling Presented at the Species Distribution Modeling Group at the American Museum of Natural History.
The use of modeling frameworks to facilitate interoperability Cecelia DeLuca/NCAR (ESMF) Bill Putman/NASA GSFC (MAPL) David Neckels/NCAR.
Center for Component Technology for Terascale Simulation Software CCA is about: Enhancing Programmer Productivity without sacrificing performance. Supporting.
Earth System Modeling Framework Status Cecelia DeLuca NOAA Cooperative Institute for Research in Environmental Sciences University of Colorado, Boulder.
_______________________________________________________________CMAQ Libraries and Utilities ___________________________________________________Community.
May 2003National Coastal Data Development Center Brief Introduction Two components Data Exchange Infrastructure (DEI) Spatial Data Model (SDM) Together,
GRIDS Center Middleware Overview Sandra Redman Information Technology and Systems Center and Information Technology Research Center National Space Science.
GEON2 and OpenEarth Framework (OEF) Bradley Wallet School of Geology and Geophysics, University of Oklahoma
Earth System Modeling Framework Python Interface (ESMP) October 2011 Ryan O’Kuinghttons Robert Oehmke Cecelia DeLuca.
Strategic Plan Implementation Cecelia DeLuca/NCAR (ESMF) December 17, 2008 ESMF Board/Interagency Meeting.
Cyberinfrastructure to promote Model - Data Integration Robert Cook, Yaxing Wei, and Suresh S. Vannan Oak Ridge National Laboratory Presented at the Model-Data.
ESMF Strategic Discussion Cecelia DeLuca NOAA ESRL/University of Colorado ESMF Executive Board/Interagency Meeting June 12, 2014.
ESMF Regridding Update Robert Oehmke, Peggy Li, Ryan O’Kuinghttons, Mat Rothstein, Joseph Jacob NOAA Cooperative Institute for Research in Environmental.
ESMF Regridding Update Robert Oehmke Ryan O’Kuinghttons Amik St. Cyr.
The HDF Group Introduction to netCDF-4 Elena Pourmal The HDF Group 110/17/2015.
Progress on Component-Based Subsurface Simulation I: Smooth Particle Hydrodynamics Bruce Palmer Pacific Northwest National Laboratory Richland, WA.
00/XXXX 1 Data Processing in PRISM Introduction. COCO (CDMS Overloaded for CF Objects) What is it. Why is COCO written in Python. Implementation Data Operations.
Earth System Curator and Model Metadata Discovery and Display for CMIP5 Sylvia Murphy and Cecelia Deluca (NOAA/CIRES) Hannah Wilcox (NCAR/CISL) Metafor.
The Earth System Modeling Framework Robert Oehmke, Gerhard Theurich, Cecelia DeLuca NOAA Cooperative Institute for Research in Environmental Sciences University.
ESMF,WRF and ROMS. Purposes Not a tutorial Not a tutorial Educational and conceptual Educational and conceptual Relation to our work Relation to our work.
Using ESMF Regridding Tools as an Observation Operator Presenter: Mathew V. Rothstein Software Engineer, NOAA/CNT Training at NRL Monterey August 5-6,
Enhancements for Hydrological Modeling in ESMF Cecelia DeLuca/NCAR (ESMF) December 19, 2008 AGU Fall Meeting.
ESMF and the future of end-to-end modeling Sylvia Murphy National Center for Atmospheric Research
State of ESMF: The NUOPC Layer Gerhard Theurich NRL/SAIC ESMF Executive Board / Interagency Working Group Meeting June 12, 2014.
Climate-SDM (1) Climate analysis use case –Described by: Marcia Branstetter Use case description –Data obtained from ESG –Using a sequence steps in analysis,
A TIME-GCM CAM Multi-executable Coupled Model Using ESMF and InterComm Robert Oehmke, Michael Wiltberger, Alan Sussman, Wenbin Wang, and Norman Lo.
Update on Unidata Technologies for Data Access Russ Rew
Options for Framework Connectivity Cecelia DeLuca NOAA Environmental Software Infrastructure and Interoperability February.
A Quick Tour of the NOAA Environmental Software Infrastructure and Interoperability Group Cecelia DeLuca Dr. Robert Detrick visit March 28, 2012
ESMPy and OpenClimateGIS: Python Interfaces for High Performance Grid Remapping and Geospatial Dataset Manipulation Ryan O’Kuinghttons, Ben Koziol, Robert.
Andrew White, Brian Freitag, Udaysankar Nair, and Arastoo Pour Biazar
GMAO Seasonal Forecast
SRNWP Interoperability Workshop
The cf-python software library
University of Technology
A Quick Tour of the NOAA Environmental Software Infrastructure and Interoperability Group Cecelia DeLuca and the ESMF team ESRL Directorate Seminar June.
ESMF Regridding Update
Cecelia DeLuca1, Rocky Dunlap1
Ben Koziol (NESII/CIRES/NOAA-ESRL/GSD) February 2018
OpenClimateGIS: A Python Library for Geospatial Manipulations of CF Climate Datasets Ben Koziol1, Ryan O’Kuinghttons1, Robert Oehmke1, Richard Rood2, Cecelia.
Presentation transcript:

ESMPy: The Python Interface to the Earth System Modeling Framework Ryan O’Kuinghttons, Robert Oehmke Cecelia DeLuca, Gerhard Theurich Peggy Li, Joseph Jacob Cooperative Institute for Research in Environmental Sciences NOAA Environmental Software Infrastructure and Interoperability Project American Meteorological Society Annual Meeting Atlanta, Georgia February 4, 2014

Introduction The Earth System Modeling Framework (ESMF) is open source software for building modeling components, and coupling them together to form weather prediction, climate, coastal, and other applications. Supports a full Fortran and limited C and Python interfaces ESMF provides a mature high performance regridding package Transforms data from one grid to another by generating and applying interpolation weights Supports structured and unstructured, global and regional, 2D and 3D grids, with many options Fully parallel and highly scalable The Python interface to ESMF (ESMPy) offers access to the regridding functionality and other related features of ESMF.

vs. ESMP Thin layer on top C interfaces to ESMF regridding Grid objects created in memory Basic masking capability Simple testing layer ESMPY ESMP ESMPy Python package surrounding ESMP and other related modules Grid objects created in memory or from file Field derived from MaskedArray Regrid testing framework Nose testing ESMPy ESMP Contributed Package Candidates: OCGIS Time Manager

What does ESMF gain with a Python Interface? Enables ESMF regridding to be used with very little effort, in an object oriented way: Regridding applied as a callable Python object Numpy array access to distributed data Grid creation from NetCDF files in standard formats Some users report computation times reduced from hours to minutes Enables ESMF regridding to be used in other scientific packages with Python-based workflows – current users include: UV-CDAT (PCMDI) – Ultrascale Visualization Climate Data Analysis Tools PyFerret (NOAA) – Python based interactive visualization and analysis environment Iris (Met Office) – Python library for visualizing meteorological and oceanographic data sets. Community Surface Dynamics Modeling System (CU-Boulder) – tools for hydrological and other surface modeling processes

Supported Grids and Methods Spherical coordinates – bilinear, higher order patch [1,2], or first order conservative regridding with: Global or regional 2D logically rectangular grids 2D unstructured meshes composed of triangles or quadrilaterals Cartesian (x,y) coordinates: Bilinear, higher order patch or first order conservative regridding between any pair of: 2D meshes composed of triangles and quadrilaterals 2D logically rectangular grids composed of a single patch Bilinear and first order conservative regridding between any pair of: 3D meshes composed of hexahedrons 3D logically rectangular grids composed of a single patch FIM Unstructured Grid Regional Grid 2D Unstructured Mesh From

ESMPy Classes Manager (esmpymanager module) Initialize and Finalize Logging Virtual Machine (parallel distribution) Grid Logically rectangular discretization object Mesh Unstructured mesh discretization object Field Grid or Mesh plus data, mask and metadata Derived type of the Numpy MaskedArray Regrid Callable object which operates on two Fields to compute and apply interpolation weights

A Few Words on Data Conventions… The following data conventions makes it easier to use data and tools. ESMPy grid files follow standard data file formats: Climate and Forecast (CF) grid conventions UGRID - candidate CF convention for unstructured grids[3] GRIDSPEC – accepted CF convention for logically rectangular grids [4] SCRIP – Spherical Coordinate Remapping and Interpolation Package [5] Legacy format for 2D logically rectangular or 2D unstructured grids ESMF Custom format for unstructured grids, more efficient storage than SCRIP when used with ESMF codes

From-file Grid/Mesh creation GRID SCRIP format GRIDSPEC is not fully supported, expected in a patch release by the end of February 2014 Examples: Latitude longitude Gaussian ESMPY ESMP MESH SCRIP (2D only) UGRID (2D and 3D) ESMFMESH (2D and 3D) Examples: Irregular cubed sphere Icosahedral BOTH Regional and global Parallel implementation supported for basic regridding - no masking or coordinate retrieval

Code – Grid Create a Grid from a SCRIP formatted NetCDF file: import ESMF grid = ESMF.Grid(filename=“ll2.5deg_grid.nc”, filetype=ESMF.FileFormat.SCRIP) OPTIONS: is_sphere – set to False for a regional grid add_corner_stagger – set to True to add the corner stagger location defined in the file, this is needed for conservative regridding add_user_area – set to True to read cell areas from the grid file, otherwise they will be calculated by ESMF internally add_mask – set to True to generate missing value attribute in ‘varname’ varname – missing value variable name for the mask **coord_names – two element array containing name of latitude and longitude variables in a GRIDSPEC file, for the case when multiple coordinates are defined

Code – Mesh Create a Mesh from UGRID formatted NetCDF file: import ESMF mesh = ESMF.Mesh(filename=“FVCOM_grid2d_ nc”, filetype=ESMF.FileFormat.UGRID, meshname=‘fvcom_mesh’) OPTIONS: convert_to_dual – set to False to NOT calculate the dual mesh add_user_area – set to True to read cell areas from the file, otherwise they will be calculated by ESMF internally meshname – name of the mesh metadata variable in a UGRID file add_mask – set to True to generate missing value attribute in ‘varname’ varname – missing value variable name for the mask

Code - Regridding Conservative regridding: from ESMF import Regrid r1to2 = Regrid(field1, field2, regrid_method=ESMF.RegridMethod.CONSERVE) destination_field = r1to2(source_field) OPTIONS: src_mask_values – numpy array of values to use for a mask on the source field dst_mask_values – numpy array of values to use for a mask on the source field regrid_method – (RegridMethod.BILINEAR(default), PATCH, or CONSERVE) pole_method – specifies the type of artificial pole to construct on source grid (PoleMethod.NONE (default conserve), ALLAVG (default nonconserve), NPNTAVG, TEETH ) regridPoleNPnts – number of points to use with PoleMethod.NPNTAVG unmapped_action – specifies which action to take if a destination point is found which does not map to any source points (UnmappedAction.ERROR(default) or IGNORE) src_frac_field– returned numpy array with weights corresponding to fractions of each source field value which contributes to the total mass of the source field dst_frac_field– returned numpy array with weights corresponding to fractions of each destination field value which contributes to the total mass of the destination field

Regridding Results r1to2 = Regrid(field1, field2, regrid_method=RegridMethod.CONSERVE) where: f(phi,theta) = 2 + cos(theta)**2 * cos(2*phi) Mean relative error Maximum relative error Conservation error Source grid: fv1.9x2.5_ nc - 1.9x2.5 CAM finite volume grid Destination grid: wr50a_ nc - Regional 205x275 grid = 3.19E-03 = 1.93E-02 = 7.11E-15

Requirements, Supported Platforms, Limitations, etc... Limitations: -No object for collections of Fields -No access to Field bounds Supported Platforms: -Linux, Darwin, and Cray -Gfortran -OpenMPI Requirements: -Python 2.6, 2.7 -Numpy 1.6.1/2 (ctypes) -ESMF installation (with NetCDF) Testing: -Regression tested nightly on 5 platforms Installation: -python setup.py build –ESMFMKFILE= install

Status and Future Work ESMPy is still in beta, production release expected later this year ESMP is in production and fully supported (fewer features) Later in 2014: Python layer functionality of Grid/Mesh created from file OpenClimateGIS Data type for observational data streams, and regridding to/from Time management, calendar Components?

OpenClimateGIS Overview Python package designed to ease the “localization” and accessibility of high-dimensional scientific datasets Primary Features: geospatial subsetting, standardized calculation, bundling, and format conversion Could benefit from ESMPy conservative regridding ESMPy could use subsetting capability and access/conversion to/from GIS data formats Will introduce a number of new dependencies: GDAL, Shapely, Fiona, netCDF4-Python Developed by the NESII Group in association with the NCPP Project under funding provided by the NOAA Climate Program Office.

Questions? References: 1.Khoei S.A., Gharehbaghi A. R., The superconvergent patch recovery technique and data transfer operators in 3d plasticity problems. Finite Elements in Analysis and Design, 43(8), Hung K.C, Gu H., Zong Z., A modified superconvergent patch recovery method and its application to large deformation problems. Finite Elements in Analysis and Design, 40(5-6), UGRID wiki: GridSpec wiki: 5.Jones, P.W. SCRIP: A Spherical Coordinate Remapping and Interpolation Package. Los Alamos National Laboratory Software Release LACC Please contact: with questions or feature requests Download: ects/ESMPy/releases

ctypes bindings to ESMF Allocating Numpy array buffers for memory allocated in ESMF: buffer = numpy.core.multiarray.int_asbuffer( ctypes.addressof(pointer.contents), numpy.dtype(ESMF2PythonType[self.type]).itemsize*size) array = numpy.frombuffer(buffer, ESMF2PythonType[self.type]) Interfacing with ctypes: _ESMF.ESMC_GridGetCoord.restype = ctypes.POINTER(ctypes.c_void_p) _ESMF.ESMC_GridGetCoord.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_uint, numpy.ctypeslib.ndpointer(dtype=numpy.int32), ctypes.POINTER(ctypes.c_int)] gridCoordPtr = _ESMF.ESMC_GridGetCoord(grid.struct.ptr, coordDim, staggerloc, exclusiveLBound, exclusiveUBound, ctypes.byref(lrc)) # adjust bounds to be 0 based exclusiveLBound = exclusiveLBound - 1 Switching between Fortran and C array striding: array = numpy.reshape(array, self.size_local[stagger], order='F')