[ncl-talk] time_lat plot errors

Mary Haley haley at ucar.edu
Fri Dec 15 09:48:47 MST 2017


Guigma,

You are calling *gsn_csm_lat_time*, which expects your variable to be
ordered lat x time.
​Your variable is ordered time x lat, so you need to call *gsn_csm_time_lat*
.

You should *always* look at your variables with printVarSummary before you
try to plot them, to make sure they have the correct dimensions.  Here's
what
 printVarSummary(x_regrid_sj)
​ produces:​

Variable: x_regrid_SJ
Type: float
Total Size: 8096 bytes
            2024 values
Number of Dimensions: 2
Dimensions and sizes: [time | 92] x [lat | 22]
Coordinates:
            time: [1996.748657226562..1996.997314453125]
            lat: [21..0]
Number Of Attributes: 8
  _FillValue : -99999
  standard_name : precipitation
  long_name : precipitation
  units : mm/day
  dataset : GPCP 1DD V1.2 Combined Data Sets
  runave_op_ncl : runave_n: nave=10
  average_op_ncl : dim_avg_n over dimension(s): lon
  missing_value : -99999
(0) Latitude (degrees_north) : min=0   max=21


If you want lat on the Y axis, then you need to transpose the array before
you call *gsn_csm_lat_time*:

plot=gsn_csm_lat_time(wks, transpose(x_regrid_SJ), res)

​Second, the following two lines should be removed, beca​use both
gsn_csm_lat_time and gsn_csm_time_lat will automatically check x_regrid_SJ
for coordinate arrays:

res at sfXArray =x_regrid_SJ&lat

res at sfYArray =x_regrid_SJ&time


​--Mary
​



On Fri, Dec 15, 2017 at 5:17 AM, Kiswendsida Hyacinthe GUIGMA <
karongseba at gmail.com> wrote:
>
> Hi!
> I am trying to make a time-latitude plot of rainfall using NCL. From a
NetCDF that covers the region comprise between 0-20N and 10W-10E, I
averaged over the longitudes and so my data became 2D (time,lat). As my
original data are from GPCP where coordinates are n.5,(n+1).5 ... while me
I want my data on n, n+1 ... I interpolated grids using linint1_n_Wrap
function. But the problem is when I use the gsn_csm_lat_time function to
plot I first got this error:
> 1-
> (0)     check_for_y_lat_coord: Warning: Data either does not contain a
valid latitude coordinate array or doesn't contain one at all.
> (0)     A valid latitude coordinate array should have a 'units' attribute
equal
> to one of the following values:
> (0)         'degrees_north' 'degrees-north' 'degree_north' 'degrees
north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg
north'
> warning:cnFillPalette is not a valid resource in time_lat1996_contour at
this time
> (0)     get_lat_values: Warning: Your latitude values do not fall between
-90 and 90 inclusive.
> (0)     You will not get 'nice' latitude labels.
>
> Then after reading answers to similar problems in NCL-TALK I modified my
code to include sfXArray and sfYArray and also to have exactly the same
MetaData as in the original file for the latitude coordinate. Then the
error changed a bit and become:
> 2-
> (0)     get_lat_values: Warning: Your latitude values do not fall between
-90 and 90 inclusive.
> (0)     You will not get 'nice' latitude labels.
>
> In addition to that, the plot doesn't fit completely with the window (see
attached).
>
> Attached below: my code, the plot I got and the data I used.
>
> Your help is well appreciated.
>
>
> -----------------------------
> GUIGMA
>
> _______________________________________________
> 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/20171215/8bae9951/attachment.html>


More information about the ncl-talk mailing list