Re: Coordinate scripting for

From: Soyoung Ha <syha_at_nyahnyahspammersnyahnyah>
Date: Tue, 11 Dec 2007 11:57:19 -0700

Erik,

You should define lat/lon info first.
Add these lines at the 19th line, and try it again.

  rank = dimsizes(filevardimsizes(a,"XLAT")) ; # of dimensions
  if (rank.eq.3) then
      lat = a->XLAT(0,:,:) ; opt could bt "nt" f->XLAT(opt,:,:)
      lon = a->XLONG(0,:,:)
  else
    if (rank.eq.2) then
        lat = a->XLAT
        lon = a->XLONG
    else
        print ("Error: unexpected lat/lon rank: rank="+rank)
        exit
    end if
  end if

Soyoung

Erik Noble wrote:
> Thank you Dr. Shea,
> M variable has 109 rows and 139 columns.
> Does that change things?
>
> i tried the suggestions from the two pages you gave below by adding
>
> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
> printVarSummary(v_plane)
> v_plane!0 = "lat"
> v_plane!1 = "lon"
> v_plane&lat = lat
> v_plane&lon = lon
> V = v_plane({5:15},{-30:10})
> printVarSummary(V)
>
>
> I am now getting a different error:
>
> Variable: v_plane
> Type: float
> Total Size: 60604 bytes
> 15151 values
> Number of Dimensions: 2
> Dimensions and sizes: [109] x [139]
> Coordinates:
> Number Of Attributes: 4
> description : v Velocity
> units : m/s
> _FillValue : -999999
> PlotLevelID : 850 hPa
> fatal:Variable (lat) is undefined
> fatal:Execute: Error occurred at or near line 39 in file NCL_ascii_V700.ncl
>
> On Dec 11, 2007 1:13 PM, Dennis Shea <shea_at_ucar.edu> wrote:
>
>> [1] To use "coordinate subscripting" two conditions must be present:
>> [a] the dimensions must be named. The arrays below do not have
>> named dimensions.
>> [b] The named dimensions must have 1D [not 2D] monotonically
>> {in/de}creasing coordinates associated with each named
>> dimension.
>>
>> Note: These are netCDF rules and NCL adheres to the netCDF
>> variable model.
>> [2] If you have variables that have 2d variable arrays that contain
>> coordinates (like WRF XLAT and XLONG variables] you
>> can not use coordinate subscripting [See 1b above ]
>>
>> [3] Pls read
>> http://www.ncl.ucar.edu/Document/Language/cv.shtml
>> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml
>>
>> Erik Noble wrote:
>>
>>> Hi.
>>> I added a printVarSummary(v_plane) to the code to see the error more clearly.
>>> The error still remains (below).
>>>
>>> any suggestions?
>>> -erik
>>>
>>>
>>> Variable: v_plane
>>> Type: float
>>> Total Size: 60604 bytes
>>> 15151 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [109] x [139]
>>> Coordinates:
>>> Number Of Attributes: 4
>>> description : v Velocity
>>> units : m/s
>>> _FillValue : -999999
>>> PlotLevelID : 850 hPa
>>> fatal:Dimension (1) of (v_plane) is not named and therefore doesn't
>>> have an associated coordinate variable
>>> fatal:Execute: Error occurred at or near line 37 in file NCL_ascii_V700.ncl
>>>
>>>
>>> On Dec 11, 2007 12:31 PM, Erik Noble <enoble_at_giss.nasa.gov> wrote:
>>>
>>>
>>>> Dear NCL,
>>>> I am trying to use coordinate subscripting to pull data from an array:
>>>> V = v_plane({5:15},{-30:10})
>>>> I am getting the error below.
>>>> My code is attached.
>>>> My I have some help?
>>>> Thank you for your help.
>>>> -Erik
>>>>
>>>>
>>>> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:ncl NCL_ascii_V700.ncl
>>>> Copyright (C) 1995-2007 - All Rights Reserved
>>>> University Corporation for Atmospheric Research
>>>> NCAR Command Language Version 5.0.0
>>>> The use of this software is governed by a License Agreement.
>>>> See http://www.ncl.ucar.edu/ for more details.
>>>>
>>>>
>>>> Variable: times
>>>> Type: string
>>>> Total Size: 1948 bytes
>>>> 487 values
>>>> Number of Dimensions: 1
>>>> Dimensions and sizes: [487]
>>>> Coordinates:
>>>> Number Of Attributes: 2
>>>> description : times in file
>>>> _FillValue : missing
>>>>
>>>> Variable: v
>>>> Type: float
>>>> Total Size: 1636308 bytes
>>>> 409077 values
>>>> Number of Dimensions: 3
>>>> Dimensions and sizes: [27] x [109] x [139]
>>>> Coordinates:
>>>> Number Of Attributes: 2
>>>> description : v Velocity
>>>> units : m/s
>>>>
>>>>
>>>> Variable: u
>>>> Type: float
>>>> Total Size: 1636308 bytes
>>>> 409077 values
>>>> Number of Dimensions: 3
>>>> Dimensions and sizes: [27] x [109] x [139]
>>>> Coordinates:
>>>> Number Of Attributes: 2
>>>> description : u Velocity
>>>> units : m/s
>>>>
>>>>
>>>> Variable: u
>>>> Type: float
>>>> Total Size: 1636308 bytes
>>>> 409077 values
>>>> Number of Dimensions: 3
>>>> Dimensions and sizes: [27] x [109] x [139]
>>>> Coordinates:
>>>> Number Of Attributes: 2
>>>> description : u Velocity
>>>> units : m/s
>>>> fatal:Dimension (1) of (v_plane) is not named and therefore doesn't have an
>>>> associated coordinate variable
>>>> fatal:Execute: Error occurred at or near line 37 in file NCL_ascii_V700.ncl
>>>>
>>>>
>>>>
>>>> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:
>>>>
>>>>
>>>>
>>>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 11 2007 - 11:57:19 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 11 2007 - 14:19:21 MST