Re: Problem with assigning units to a variable

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 19 2012 - 21:10:42 MDT

Soumik,

You have assigned dimension names to uz_diff, but you have not
assigned coordinate variables. You need to have both for this to
work. Please study sections 2.10 and 2.11 of the Mini-Language
Manual. 2.11 shows a complete basic example of how to do this. Then
you can add the units attribute at the end:

http://www.ncl.ucar.edu/Document/Manuals/

However, there is a good shortcut if one of your previous variables
already has the dame dimensions and coordinates. Use this function to
copy all dimension names and coordinates in one command:

http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarCoords.shtml

copy_VarCoords is the better method if the information is previously
available, because it avoids re-typing the same information and
possibly creating errors.

--Dave

On Thu, Jul 19, 2012 at 7:00 PM, Soumik Basu <sbasu@iarc.uaf.edu> wrote:
> Hi,
>
> I am trying to plot a vertical cross section but I am having a problem
> with assigning the units of "mb" to the pressure levels.
> This is the variable to which I am trying assign the unit and the error
> message I am receiving.
>
> Variable: uz_diff
> Type: float
> Total Size: 2800 bytes
> 700 values
> Number of Dimensions: 2
> Dimensions and sizes: [lev | 14] x [lat | 50]
> Coordinates:
> Number Of Attributes: 3
> units :
> long_name :
> _FillValue : -999
> fatal:No coordinate variable exists for dimension (lev) in variable
> (uz_diff)
> fatal:(lev) is not coordinate variable in variable(uz_diff).
> fatal:Execute: Error occurred at or near line 159 in file
> uz_diff_x1.ncl
>
> Here is the part of the code doing that:
>
> ;***********************************************************
> ; Calculate uz difference for winter
> ;***********************************************************
>
> uz_diff = uz_var_ens - uz_var
> uz_diff@long_name = ""
> uz_diff@units = ""
> uz_diff!0 = "lev"
> uz_diff!1 = "lat"
>
> printVarSummary(uz_diff)
> uz_diff&lev@units = "mb"
> printVarSummary(uz_diff&lev)
> printVarSummary(uz_diff)
> printMinMax(uz_diff, True)
>
>
> Can anybody please suggest me what I am doing wrong here.
>
> Thanks,
> Soumik
>
> --
> "Numbing the pain for a while will make it worse when you finally feel
> it.
> ~J.K. Rowling"
> *****************************************
> Soumik Basu
> Graduate Student, Research Assistant
> International Arctic Research Center
> University of Alaska Fairbanks
> Fairbanks,Alaska,USA
> *****************************************
> _______________________________________________
> 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 Jul 19 21:10:54 2012

This archive was generated by hypermail 2.1.8 : Tue Jul 24 2012 - 09:48:26 MDT