Re: How to access right lon, lat information of curvilinear grids?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 10 Jun 2009 10:31:45 -0600 (MDT)

Hi Mario,

This should work, if lat, lon are the same size as the rightmost two
dimensions of temp.

What does:

print temp.shape
print lon.shape
print lat.shape

report?

Also, you might try:

tempres.trGridType = "TriangularMesh"

Finally, and I'm not sure why this would make a different (Dave Brown
might be able to elaborate), you can try this:

temp = numpy.ravel(ncfile_sst.variables["var2"])
lon = numpy.ravel(ncfile_vel.variables["lon"])
lat = numpy.ravel(ncfile_vel.variables["lat"])

and keep everything else the same. This will force the contouring
algorithm to use the triangular mesh internally, but I'm not sure
if it will be appropriate for your data.

See the attached "seam.py" for a similar example.

--Mary

On Wed, 10 Jun 2009, Mario Krapp wrote:

> Hi,
>
> I could not find out, how to make a contour_map/vector_map plot with data on a curvilinear grid.
> The data I wanted to plot is the scalar temp(time,lev,lon,lat)
> I read the data as follows:
> ---cut---
> ncfile_sst = Nio.open_file("sst.elnino3.nc","r")
> temp = ncfile_sst.variables["var2"]
> lon = ncfile_vel.variables["lon"]
> lat = ncfile_vel.variables["lat"]
> ---cut---
> while lon = lon(x,y) and lat = lat(x,y) are 2D arrays
>
> I tried using
> ---cut---
> tempres.sfXArray = lon[:,:]
> tempres.sfYArray = lat[:,:]
> ...
> co = Ngl.contour_map(wks,temp[0,0,:,:],tempres)
> ---cut---
>
> but I get this error message:
> warning:ScalarFieldInitialize: 2d coordinate array sfXArray has an incorrect dimension size: defaulting sfXArray
> warning:ScalarFieldInitialize: 2d coordinate array sfYArray has an incorrect dimension size: defaulting sfYArray
>
> This data is plotted on the map, but the locations correspond to the x-y coordinates temp(x,y) instead of temp(lon,lat).
>
> Cheers Mario
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

Received on Wed Jun 10 2009 - 10:31:45 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 16 2009 - 10:06:42 MDT