nawendt / esmpy-tutorial

Basic tutorial for ESMPy Python package
MIT License
31 stars 8 forks source link

Grid projections need to be handled correctly #2

Closed nawendt closed 7 years ago

nawendt commented 7 years ago

The NAM and RUC grids used in the tutorial have LCC projection coordinates. What is confusing is that the coordinates that are extracted from the grids are latitude and longitude, which typically means you are working with geographic coordinates; however, the latitude and longitude values are simply converted from projection space. In order for the regridding to be done correctly, the latitude and longitude must be converted back to projection space and ESMF.CoordSys.CART must be used instead of ESMF.CoordSys.SPH_DEG.

nawendt commented 7 years ago

This was a misunderstanding on my part. The latitude and longitude values are geographical coordinates. To make them look "pretty" on a map you have to convert them back to the correct projected coordinates. The ESMF library assumes that the coordinate system for the source and destination grids are the same (see ESMF Requirements Document in source distribution). In our case, we have latitude and longitude values which are a type of spherical coordinates. If we were to do this using the projected, Cartesian coordinates from the NAM and RUC grids, this would also work as the projections are exactly the same (see the PROJ.4 strings). However, projections are typically not the same between grids and care must be taken to get both source and destination on the same projection in those cases. The ability of ESMF to be projection agnostic is both useful and potentially confusing.

The take home message here is: always make sure both source and destination grids are in the same coordinate system/projection space.