Re: native mercator projection still having problems.

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 7 Oct 2008 08:34:08 -0600 (MDT)

John,

To back up for a bit, is your data already on a mercator grid? I'm
assuming it is, as that's what I think of when I hear "native mercator
grid".

If this is the case, then you need to make sure you have the map
projection resources set up exactly to match the projection that the
grid is defined on. Then, you do *not* want to set the
sfXArray/sfYArray resources, and instead, set "tfDoNDCOverlay" to
True. This tells PyNGL not to put your data through the equations for
a map projection, because they are already projected.

We do actually have an example of this. The pynglex example "panel2" is
done on a native mercator grid, but oddly, it uses the
sfXArray/sfYArray route, rather than the tfDoNDCOverlay route.

Try running:

   pynglex panel2

and then modify panel2.py to change the lines:

res.sfYArray = lat # Where to overlay
res.sfXArray = lon # contours on map

to:

#res.sfYArray = lat # Where to overlay
#res.sfXArray = lon # contours on map
res.tfDoNDCOverlay = True # don't put data through
                                         # map projection equations and

rerun. You will see that you get the same results, and this is because
the mercator projection is set up to match the data exactly.

I think I need to change this example to reflect that the sfXArray and
sfYArray resources are not needed (this is a bit of overkill).

--Mary

On Mon, 6 Oct 2008, Ertl, John C CIV 63134 wrote:

> Classification: UNCLASSIFIED
> Caveat (s): FOUO
>
> Seth,
>
> Thanks for the help...The mercator projection looks to still have big problems but I was able to make a good step forward on the Lambert Conformal.
>
> I think it is plotting the data correctly but the map is very wrong. It looks to be showing the entire northern hemisphere map (in a Lambert conformal plot) but the data is only for a portion of the east pacific. What are you using for plotting the map on top of the data?
>
> Thanks for you help.
>
> John Ertl
> Meteorologist
>
> FNMOC
> 7 Grace Hopper Ave.
> Monterey, CA 93943
> (831) 656-5704
> john.ertl_at_navy.mil
>
> Classification: UNCLASSIFIED
> Caveat (s): FOUO
>
>
>
> From: Seth McGinnis
> Sent: Fri 10/3/2008 3:58 PM
> To: Ertl, John C CIV 63134; pyngl-talk_at_ucar.edu
> Subject: Re: native mercator projection
>
>
>> I have some old PyNGL code that displays Spherical grids and it works great. I want to now display native mercator and eventually Lambert grids.
>
> I don't know how a native mercator grid works, but for Lambert grids, here's the chunk of (NCL) code I use to define the map projection. ("proj" is a variable from my NetCDF file that holds the projection information.)
>
> res_at_mpProjection = "LambertConformal"
> res_at_mpLambertMeridianF = proj_at_longitude_of_central_meridian
> res_at_mpLambertParallel1F = proj_at_standard_parallel(0)
> res_at_mpLambertParallel2F = proj_at_standard_parallel(1)
> res_at_tfDoNDCOverlay = True ;; Lambert Conformal generally needs this
>
> For all the other projections I've worked with (polar stereographic, transverse mercator, and rotated pole), you just have to set the "mpCenterLatF" and "mpCenterLonF" attributes. So if lat looks correct but lon is off, my guess would be that you need to set resources.mpCenterLonF to something non-default.
>
> Cheers,
>
> Seth McGinnis
> Associate Scientist
> ISSE / NCAR
>
_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Tue Oct 07 2008 - 08:34:08 MDT

This archive was generated by hypermail 2.2.0 : Tue Oct 07 2008 - 09:10:08 MDT