Re: Error message concerning latitude and longitude

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Dec 12 2013 - 07:50:02 MST

Actually, the CDO produced coordinates are 'coordinate arrays'
[one dimensional with the named dimension the same as the
  variable name: rlat(rlat) and rlon(rlon)].

An issue is that the coordinate array units are "degrees"
for both rlon and rlat.

         double rlon(rlon) ;
                 rlon:standard_name = "grid_longitude" ;
                 rlon:long_name = "longitude in rotated pole grid" ;
                 rlon:units = "degrees" ;
                 rlon:axis = "X" ;
         double rlat(rlat) ;
                 rlat:standard_name = "grid_latitude" ;
                 rlat:long_name = "latitude in rotated pole grid" ;
                 rlat:units = "degrees" ;
                 rlat:axis = "Y" ;

NCL is looking for 'degrees_east' and 'degrees_north' when plotting.
This is easy to change

     T=f->var167(0,0,:,:)
     T&rlat@units = "degrees_north" ; <== units needed for plotting
     T&rlon@units = "degrees_east"

As noted, there is currently one example of plotting rotated grids

http://www.ncl.ucar.edu/Applications/

Under "Map Projections", click "Rotated lat-lon"
The is a bit more complicated than is needed but you should
look at the code anyway.

The attached shows assorted options.

Good luck

On 12/12/13, 7:35 AM, Mary Haley wrote:
> Dear Stephan,
>
> It looks like you have a curvilinear grid (2D lat/lon arrays). You need to associate rlat/rlon with your data when you call gsn_csm_xxx_map, otherwise NCL won't know where on a map to plot your data.
>
> Try adding these three lines:
>
> res@sfXArray = f->rlon
> res@sfYArray = f->rlat
> res@gsnAddCyclic = False
>
> Also, since you have a rotated grid, you may want to plot the data in the correct rotated projection. Please see the first (only) example at:
>
> http://www.ncl.ucar.edu/Applications/rotatedltln.shtml
>
> Read the description on the above page about how to get the correct map projection.
>
> I would recommend writing an NCL script in a UNIX editor, rather than trying to do all of this interactively. Once you save the script, calling it something like "plot_temp.ncl", you run it on the UNIX command line with:
>
> ncl plot_temp.ncl
>
> Good luck,
>
> --Mary
>
> On Dec 12, 2013, at 6:47 AM, Stephan Herrmann <stephan.w.herrmann@t-online.de> wrote:
>
>>
>>
>> Hello everybody,
>>
>> I have calculated the mean temperature of Bolivia (1961-1970) with Climate Data Operators. The result is saved in the file: MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1970_167_timemean.nc. I want to plot the result with NCL and get the following error message:
>>
>> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
>> lines 1-1/1 (END)
>>
>> I need the plot for my diploma thesis in Meteorology.
>>
>> The NCL code is as follows:
>>
>> Copyright (C) 1995-2013 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 6.1.2
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>> ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> ncl 2> begin
>> ncl 3> f = addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1970_167_timemean.nc","r")
>> ncl 4> T=f->var167(0,0,:,:)
>> ncl 5> wks=gsn_open_wks("ps","Bolivia_Timemean_1961-1970")
>> ncl 6> res = True
>> ncl 7> res@gsnMaximize = True
>> ncl 8> res@tiMainString = "Bolivia_Timemean_1961-1970"
>> ncl 9> plot = gsn_csm_contour_map(wks,T,res)
>> ncl 10> end
>>
>> I have seen this problem before in this list, but I could not make it work using those tips.
>>
>> Here are the information about the variable "var167" and the variable "T":
>>
>> Variable: var167
>> Type: float
>> Total Size: 18544 bytes
>> 4636 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [time | 1] x [height | 1] x [rlat | 76] x [rlon | 61]
>> Coordinates:
>> time: [19710101..19710101]
>> height: [ 2.. 2]
>> rlat: [-20.68..12.32]
>> rlon: [157.56..183.96]
>> Number Of Attributes: 1
>> grid_mapping : rotated_pole
>>
>> Variable: T
>> Type: float
>> Total Size: 18544 bytes
>> 4636 values
>> Number of Dimensions: 2
>> Dimensions and sizes: [rlat | 76] x [rlon | 61]
>> Coordinates:
>> rlat: [-20.68..12.32]
>> rlon: [157.56..183.96]
>> Number Of Attributes: 3
>> height : 2
>> time : 19710101
>> grid_mapping : rotated_pole
>>
>> I have renamed rlat to lat and rlon to lon but this does not solve the problem. The error message still occur. I hope you can help me.
>>
>> Attachment: file MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1970_167_timemean.nc
>>
>>
>> Best regards
>>
>> Stephan<MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1970_167_timemean.nc>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

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

Received on Thu Dec 12 07:50:11 2013

This archive was generated by hypermail 2.1.8 : Fri Dec 13 2013 - 11:39:30 MST