<div dir="ltr">Thanks Rick. I think this transform_coordinate function will take care of my needs. <div><br><div>In my case the gfs data has a latitude array of 1440, and longitude array of 721. So, does this mean, I need to pass transform_coordinate a 1d array for X that shows latitude values for every coordinate? Meaning 1440x721 values? And, subsequently for Y? And, I"ll pass a 1d array for Z with all zeroes that have 1440x721 values. </div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 3, 2019 at 5:13 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>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:</div><div> </div><div> transform_coordinate(srcProj:string, dstProj:string, x[*]:double, y[*]:double, z[*]:double)</div><div><br></div><div>Where srcProj/dstProj are the "proj4 strings" describing the source and destination projections. In your case, the srcProj would be something like:</div><div> "+proj=lonlat +ellps=sphere" # I've encountered some instance where things fail without specifying the ellipsoid</div><div><br></div><div>dest:</div><div><br></div><div> "+proj=merc"</div><div><br></div><div>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:</div><div><br></div><div> <a href="https://proj.org/" target="_blank">https://proj.org/</a></div><div><br></div><div>(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)</div><div><br></div><div>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.</div><div><br></div><div><br></div><div>Rick<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 3, 2019 at 3:01 PM Micah Sklut via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>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. </div><div><div><br></div><div>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? </div><div><br></div><div>Thanks! </div><div><br></div>-- <br><div dir="ltr">Micah Sklut<br><br></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">Micah Sklut<br><br></div>