Re: [pyngl-talk] How to use 2D lon/lat (curvilinear) with gsn_contour_csm_map_ce and gsnZonalMean

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 15 Jul 2009 08:42:21 -0600

Hi Mario,

You posted your question to the PyNGL email list. This is more
appropriate for the ncl-talk email list.

I'm afraid the zonal means plot only works if you have 1D coordinate
arrays. The error message
is misleading because the script was written before 2D lat/lon arrays
were allowed.

I'm in the middle of a workshop right now and can't look at this.

You might try calculating the zonal mean yourself (using dim_avg) and
then generating an
XY plot of the data.

I'll try to look at this later this week.

--Mary

On Jul 14, 2009, at 3:21 AM, Mario Krapp wrote:

> Hi,
>
> I want to contour the data of a curvilinear grid using
> gsn_contour_csm_map_ce and add a zonal mean as in
> http://www.ncl.ucar.edu/Applications/Scripts/dev_1.ncl
> I use version 5.0.0.
>
> The lon, lat values are 2D arrays so I use
> res_at_sfXArray = lon
> res_at_sfYArray = lat
>
>
> Here is the part I changed according to the script mentioned above:
> ---cut---
> fn = "tho_6m_mean.nc" ; define filename
> in = addfile(fn,"r") ; open netcdf file
> ts = in->var2(0,0,:,:) ; select variable
> to ave
> lat = in->lat
> lon = in->lon
>
> ;************************************************
> ; plot parameters
> ;************************************************
> wks = gsn_open_wks("ps","stddev") ; Opens a ps file
> gsn_define_colormap(wks,"BlWhRe") ; choose colormap
>
> plot = new(2,graphic) ; create graphical
> array
> res = True ; plot mods desired
> ;************************************************
> ; original data
> ;************************************************
>
> res_at_gsnZonalMean = True ; add zonal plot
> res_at_mpOutlineOn = False
> res_at_sfXArray = lon
> res_at_sfYArray = lat
>
> res_at_vpWidthF = 0.7
>
> plot(0) = gsn_csm_contour_map_ce(wks,ts(:,:),res)
> ---cut---
>
> The message I receive is:
> (0) gsn_csm_contour_map_ce: Warning: The resource gsnZonalMean
> can only be set to True
> fatal:Plus: Dimension size, for dimension number 0, of operands
> does not match, can't continue
>
> So I uncomment
> ;res_at_gsnZonalMean = True ; add zonal plot
>
> now I receive:
> warning:ScalarFieldSetValues: 2d coordinate array sfXArray has an
> incorrect dimension size: defaulting sfXArray
> warning:ScalarFieldSetValues: 2d coordinate array sfYArray has an
> incorrect dimension size: defaulting sfYArray
>
> I don't know what this means and made a 'ncl_filedump':
> ---cut---
> Variable: f (file variable)
>
> filename: tho_6m_mean
> path: tho_6m_mean.nc
> file global attributes:
> CDI : Climate Data Interface version 1.3.2
> Conventions : CF-1.0
> dimensions:
> x = 362
> y = 192
> nv = 4
> lev = 1
> time = 1 // unlimited
> variables:
> float lon ( y, x )
> long_name : longitude
> units : degrees
> standard_name : longitude
> bounds : lon_bounds
>
> float lon_bounds ( y, x, nv )
>
> float lat ( y, x )
> long_name : latitude
> units : degrees
> standard_name : latitude
> bounds : lat_bounds
>
> float lat_bounds ( y, x, nv )
>
> double lev ( lev )
> long_name : generic
> units : level
>
> double time ( time )
> units : day as %Y%m%d.%f
> calendar : proleptic_gregorian
>
> float var2 ( time, lev, y, x )
> coordinates : lon lat
> _FillValue : -9e+33
> ---cut---
>
> If I plot the data just using gsn_contour_map everything works
> fine, but gsnZonalMean is not supported.
>
> Thanks and Regards
>
> Mario Krapp
>
>
> --
> Mario Krapp
> Max Planck Institute for Meteorology
>
> Bundesstraße 53
> 20146 Hamburg
> Germany
> tel. +49 40 41173 168
> email mario.krapp_at_zmaw.de
> www http://www.mpimet.mpg.de
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 15 2009 - 08:42:21 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 17 2009 - 15:27:02 MDT