[ncl-talk] check_for_y_lat_coord: Warning:

Mary Haley haley at ucar.edu
Fri Sep 19 07:02:46 MDT 2014


Hi Noelia,

Thanks for the additional information. I admit I'm stumped, because it
looks like you are doing everything right.

However, there's an easier way to fix the longitudes, using the "lonFlip"
function. Try this code instead:

;***********************************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;************************************************************************
begin

    ozfil =
addfile("/work/users/nof/data/data_new/Ozone/grid1/seasons/Europe/
mda8.surfO3.EU.2000.2009.settabs_JJA.nc","r")

    wks = gsn_open_wks("X11","test")
    ;gsn_define_colormap(wks,"BlueDarkRed18")


    ;ozone
    oz = ozfil->MDA8_SurfO3
    oz = lonFlip(oz)

    res = True
    res at gsnAddCyclic = False
    res at mpMinLonF = min(oz&lon)
    res at mpMinLatF = min(oz&lat)
    res at mpMaxLonF = max(oz&lon)
    res at mpMaxLatF = max(oz&lat)


    printVarSummary(oz)
    printVarSummary(oz&lat)
    printVarSummary(oz&lon)
    plot = gsn_csm_contour_map(wks,oz(0,:,:),res)

end

--Mary


On Fri, Sep 19, 2014 at 3:09 AM, Noelia otero <noeli1680 at gmail.com> wrote:

> Hi Mary,
>
> Thanks for your answer. I know that this is a common mistake, but I
> checked the units and the coordinates array and they seem correct to me. I
> only changed the longitude values, because they span from 347 to 34, so I
> changed it to -13 34. This is why I was reattaching all of it, is it
> wrong?? Otherwise, I am having problems for trying to plot between 347 and
> 34 lon..
>
> The error that I get :
>
> (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'
> (0)     check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> (0)     A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)         'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
>
> The script is very simple,
>
> ;***********************************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> ;************************************************************************
> begin
>
>     ozfil =
> addfile("/work/users/nof/data/data_new/Ozone/grid1/seasons/Europe/
> mda8.surfO3.EU.2000.2009.settabs_JJA.nc","r")
>
>     wks = gsn_open_wks("X11","test")
>     ;gsn_define_colormap(wks,"BlueDarkRed18")
>
>
>     ;ozone
>     oz = ozfil->MDA8_SurfO3
>
>     ;change lon values -180 180
>     lon = ozfil ->lon
>     lon = where((lon.gt.180).and.(lon.lt.360),lon-360,lon)
>     lat = ozfil ->lat
>     oz&lon = lon
>    ; oz&lat = lat ; it might be unnecessary
>
>     res = True
>     res at gsnAddCyclic = False
>     res at mpMinLonF = min(lon)
>     res at mpMinLatF = min(lat)
>     res at mpMaxLonF = max(lon)
>     res at mpMaxLatF = max(lat)
>
>
>     printVarSummary(oz)
>     printVarSummary(oz&lat)
>     printVarSummary(oz&lon)
>     plot = gsn_csm_contour_map(wks,oz(0,:,:),res)
>
> end
> ;******************************************
>
> The summary of the variables:
> printVarSummary(oz):
>
> Variable: oz
> Type: double
> Total Size: 13777920 bytes
>             1722240 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 920] x [lon | 48] x [lat | 39]
> Coordinates:
>             time: [20000601..20090831]
>             lon: [ -13..  34]
>             lat: [  34..  72]
> Number Of Attributes: 2
>   units :       parts per billion = nmol/mol
>   description : Maximum daily 8-hr average (MDA8) of surface ozone (ppb)
> over Europe from 01/01/2000 - 12/31/2009
>
> printVarSummary(lat)
> Variable: lat (coordinate)
> Type: double
> Total Size: 312 bytes
>             39 values
> Number of Dimensions: 1
> Dimensions and sizes:   [lat | 39]
> Coordinates:
> Number Of Attributes: 4
>   axis :        Y
>   units :       degrees_north
>   long_name :   latitude
>   standard_name :       latitude
>
>
> printVarSummary(lon)
>
> Variable: lon (coordinate)
> Type: double
> Total Size: 384 bytes
>             48 values
> Number of Dimensions: 1
> Dimensions and sizes:   [lon | 48]
> Coordinates:
> Number Of Attributes: 4
>   axis :        X
>   units :       degrees_east
>   long_name :   longitude
>   standard_name :       longitude
>
>
>
> Many thanks in advance for the support,
>
> Cheers,
>
> Noelia.
>
>
>
> 2014-09-19 1:07 GMT+02:00 Mary Haley <haley at ucar.edu>:
>
>> Noelia,
>>
>> When you continue to have problems with a script, it helps to include any
>> new error messages you are getting.
>>
>> Also, your "printVarSummary" of "oz" seems to indicate that you have
>> coordinate arrays and the appropriate metadata, so I'm not sure why you are
>> reattaching all of it.
>>
>> Please look at your data right before you plot it, and not right before
>> you start adding metadata to it. Also, look at your lat/lon arrays to make
>> sure they look okay.
>>
>> To look at your data more thoroughly, add these three lines right before
>> you call gsn_csm_contour_plot:
>>
>> printVarSummary(oz)
>> printVarSummary(oz&lat)
>> printVarSummary(oz&lon)
>>
>> Make sure the "units" for the lat/lon arrays are correct, and that "oz"
>> has all the correct coordinate information attached.
>>
>> --Mary
>>
>>
>> On Thu, Sep 18, 2014 at 12:43 PM, Noelia otero <noeli1680 at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> Thanks karin, but even with this setting I can't plot. I don't know if
>>> this problem might be due to the data..actually, I don't know why this
>>> warning..
>>> Thanks again!
>>>
>>> Noelia.
>>>
>>> 2014-09-18 11:29 GMT+02:00 Karin Meier-Fleischer <
>>> meier-fleischer at dkrz.de>:
>>>
>>>>  Hi Noelia,
>>>>
>>>> maybe you have missed the setting
>>>>
>>>>  oz&lat = lat
>>>>
>>>> Hope this helps,
>>>> Karin
>>>>
>>>> Am 18.09.14 10:50, schrieb Noelia otero:
>>>>
>>>> Hi,
>>>>
>>>>  I have problems to plot one field, and although I have already dealt
>>>> with this error, I tried to fix it now in different ways..but I don't know
>>>> what I am missing, and I have no idea what I am doing wrong. The error is
>>>> always:
>>>>
>>>>  *"check_for_y_lat_coord: Warning: Data either does not contain a
>>>> valid latitude coordinate array or doesn't contain one at all......"*
>>>>
>>>>  I would appreciate any suggestion:
>>>>
>>>>   ;Variable
>>>>    oz = ozfil->MDA8_SurfO3
>>>>    printVarSummary(oz)
>>>>  ; Summary of variable: oz
>>>>   ;***Type: double
>>>>         Total Size: 13777920 bytes
>>>>           1722240 values
>>>>           Number of Dimensions: 3
>>>>           Dimensions and sizes: [time | 920] x [lon | 48] x [lat | 39]
>>>>           Coordinates:
>>>>            time: [20000601..20090831]
>>>>            lon: [ 347..  34]
>>>>            lat: [  34..  72]
>>>>
>>>>      ;change lon values into -180 180
>>>>     lon = ozfil ->lon
>>>>     lon = where((lon.gt.180).and.(lon.lt.360),lon-360,lon)
>>>>     lat = ozfil ->lat
>>>>     lon at long_name = "longitude"
>>>>     lon at units = "degrees_east"
>>>>     lat at long_name = "latitude"
>>>>     lat at units = "degrees_north"
>>>>     oz&lon = lon
>>>>     printVarSummary(oz)
>>>>
>>>> Now the summary of oz is:
>>>>  Variable: oz
>>>> Type: double
>>>> Total Size: 13777920 bytes
>>>>             1722240 values
>>>> Number of Dimensions: 3
>>>> Dimensions and sizes: [time | 920] x [lon | 48] x [lat | 39]
>>>> Coordinates:
>>>>             time: [20000601..20090831]
>>>>             lon: [ -13..  34]
>>>>             lat: [  34..  72]
>>>> Number Of Attributes: 2
>>>>
>>>>  ISo,  am trying to plot:
>>>> plot = gsn_csm_contour_map(wks,oz(0,:,:),res)
>>>>
>>>>  Any idea about how can I solve this???
>>>>  Thank you in advance,
>>>>
>>>>  Cheers,
>>>>
>>>>
>>>>  Noelia.
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>> --
>>>> Dipl. Geophys. Karin Meier-Fleischer
>>>> Visualization
>>>> Application Support
>>>>
>>>> Deutsches Klimarechenzentrum GmbH (DKRZ)
>>>> Bundesstrasse 45a - D20146 Hamburg - Germany
>>>>
>>>> Phone:    +49 (0)40 460094 126
>>>> Fax:      +49 (0)40 460094 270
>>>> E-Mail:   meier-fleischer at dkrz.de
>>>> URL:      www.dkrz.de
>>>>
>>>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>>>> Sitz der Gesellschaft: Hamburg
>>>> Amtsgericht Hamburg HRB 39784
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140919/c77295b0/attachment-0001.html 


More information about the ncl-talk mailing list