[ncl-talk] grib projection conversion

Rick Brownrigg brownrig at ucar.edu
Tue Dec 3 15:13:39 MST 2019


Hi,

NCL has an undocumented interface to the Proj4 cartographic projection
library that could produce coordinates in a Mercator projection, given a
list of lat/lons:

   transform_coordinate(srcProj:string, dstProj:string, x[*]:double,
y[*]:double, z[*]:double)

Where srcProj/dstProj are the "proj4 strings" describing the source and
destination projections. In your case, the srcProj would be something like:
  "+proj=lonlat +ellps=sphere"     # I've encountered some instance where
things fail without specifying the ellipsoid

dest:

  "+proj=merc"

The x/y/z arrays are the same length; the z can be set to zeros if real
data unavailable. The conversion happens "in place".  More on proj4 here.
Particularly if your area of interest is not global, there are likely other
parameters to the Mercator you might want to add, like center of
projection, etc:

    https://proj.org/

(Note, NCL's binding to proj4 is specifically the older v4.xxx libraries,
not the newer v.6. series. The proj-strings should be compatible however)

Finally, I don't understand the bit about starting with a 1440x721 and
ending up with a 1440x1440. It almost sounds like you'll need to regrid to
that density in lat/lon space prior to projecting.


Rick


On Tue, Dec 3, 2019 at 3:01 PM Micah Sklut via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hi,
>
> I'm interested in the best way to convert lat/lon and corresponding data
> values from GFS grib data into Mercator projection values. The use case is
> not for mapping in NCL, but taking an input grib file and converting values
> to an output grib file.
>
> The GFS data I have is 0.25x0.25, so 1440x721 values, so I believe I'm
> looking for the Mercator projection to provide 1440x1440 values, where the
> lat/lons are spaced according to the Mercator projection. Is there a
> conversion function in NCL that will do this?
>
> Thanks!
>
> --
> Micah Sklut
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191203/4c79c538/attachment.html>


More information about the ncl-talk mailing list