Re: fatal error

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 29 2010 - 20:53:54 MDT

You have done something wrong..

        a = addfile("vwnd.1999.nc","r")
        v = short2flt(a->vwnd(0,:,:,:))
        printVarSummary(v)

[SNIP]

        hyam = a->hyam ; read from file
        hybm = a->hybm
        P0mb = a->P0*0.01
        ps = a->ps ; these are in Pa
        v = a->V

wei huang wrote:
> Hi,
> when i replace "v" to "a" it does not working and the error is given below:
> fatal:Either file (a) isn't defined or variable (hyam) is not a variable
> in the file
> fatal:Execute: Error occurred at or near line 24 in file stf1.ncl
> thanks again,
> wei
> On Mon, Mar 29, 2010 at 10:17 PM, Mary Haley <haley@ucar.edu
> <mailto:haley@ucar.edu>> wrote:
>
> Wei,
>
> The error is telling you what's wrong. It's saying that you are
> trying to access "v" as if it were a file pointer.
> This means you are trying to do something like this:
>
> x = v->x
>
> "v" is not a file pointer, but "a" is. A file pointer is what's
> returned when you call "addfile".
>
> You need to replace your "v->" with "a->".
>
> For example:
>
> hyam = v->hyam
>
> should be:
>
> hyam = a->hyam
>
> --Mary
>
> On Mar 29, 2010, at 4:40 AM, wei huang wrote:
>
>> Hello NCL talk,
>> Could anyone fix the problem given below:
>> fatal:(v) does not reference a file
>> fatal:Execute: Error occurred at or near line 25 in file stf1.ncl
>>
>>
>>
>> And also the code is attached:
>> Thanks
>> wei
>>
>> 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"
>> begin
>> ;************************************************
>> ; read in netCDF file
>> ;************************************************
>> a = addfile("vwnd.1999.nc <http://vwnd.1999.nc/>","r")
>> ;a1 = addfile("pres.sfc.1999.nc <http://pres.sfc.1999.nc/>","r")
>> ;************************************************
>> ; read in data required for calculation
>> ;************************************************
>> v = short2flt(a->vwnd(0,:,:,:))
>> ;ps = short2flt(a1->pres(0,:,:))
>> printVarSummary(v)
>>
>> ; vinth2p requires the lev_p to be expressed in mb [hPa]
>> lev_p = (/300,500,850,1000 /)
>> lev_p!0 = "lev_p" ; variable/dim name
>> lev_p&lev_p = lev_p ; create coordinate variable
>> lev_p@long_name = "pressure" ; attach some attributes
>> lev_p@units = "hPa"
>> lev_p@positive = "down"
>>
>> hyam = v->hyam ; read from file
>> hybm = v->hybm
>> P0mb = v->P0*0.01
>> ps = v->ps ; these are in Pa
>> v = v->V
>> ; convert to pressure levels
>> vp = vinth2p(v,hyam,hybm,lev_p,ps,intyp,P0mb,1,False)
>> ; calculate zonal meridional streamfunction
>> psi = zonal_mpsi_Wrap(vp,lat,lev_p*100.,ps)
>> wks = gsn_open_wks("x11","h_lat") ; open a ps file
>> plot= gsn_csm_pres_hgt(wks,psi,False) ; create plot
>> end
>> ===================
>> Variable: v
>> Type: float
>> Total Size: 714816 bytes
>> 178704 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [level | 17] x [lat | 73] x [lon | 144]
>> Coordinates:
>> level: [1000..10]
>> lat: [90..-90]
>> lon: [ 0..357.5]
>> Number Of Attributes: 16
>> time : 17549208
>> long_name : mean Daily V wind
>> valid_range : ( -125, 160 )
>> actual_range : ( -81.77499, 82.47501 )
>> units : m/s
>> precision : 2
>> least_significant_digit : 1
>> GRIB_id : 34
>> GRIB_name : VGRD
>> var_desc : v-wind
>> V
>> dataset : NCEP Reanalysis Daily Averages
>> level_desc : Multiple levels
>> F
>> statistic : Mean
>> M
>> parent_stat : Individual Obs
>> I
>> _FillValue : 32766
>> missing_value : 32766
>> _______________________________________________
>> 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 Mon Mar 29 20:53:55 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 01 2010 - 11:31:45 MDT