Re: netcdf to binary question

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 29 Jun 2007 15:18:37 -0600

Hi Erik,

Change:
in = addfile ("afoifa.pg0004.nc", "r")
to:
fi = addfile ("afoifa.pg0004.nc", "r")
Adam

Erik Noble wrote:
> Hi. Thank you.
>
> I now keep getting an error that NCL does not recognize the "fi->" syntax.
>
> fatal:Undefined identifier: (fi) is undefined, can't continue
> fatal:Execute: Error occurred at or near line 9 in file net2bin.ncl
>
>
> But the "fi" lines of in my code are looks defined as presented in the
> example at http://www.ncl.ucar.edu/Applications/o-binary.shtml:
>
> Any suggestions?
> Thank you for the help.
> Erik
>
> ;*****************************************************
> ;*****************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;*****************************************************
> begin
> ; read in a netCDF variable and output to binary
> in = addfile ("afoifa.pg0004.nc", "r")
> shwg = fi->$"specific_humidity_wind_grid"$ ; read in netCDF
> variable
> pmsl = fi->pmsl ;
> read in netCDF variable
> t = fi->temperature ;
> read in netCDF variable
> V = fi->$"wind_v-comp"$
> vc = fi->$"10m_wind_v-comp"$ ; read
> in netCDF variable
> U = fi->$"wind_u-comp"$
> uc = fi->$"10m_wind-comp"$
> rh = fi->relative_humidity
> t15 = fi->$"temperature_at_1-5m"$
> gh = fi->geopotential_height
> w = fi->$"wind_w-comp"$
> wc = fi->$"10m_wind_u-comp"$
> sh15= fi->$"specific_humidity_at_1-5m"$
>
>
>
> On 6/29/07 4:52 PM, "Adam Phillips" <asphilli_at_cgd.ucar.edu> wrote:
>
>> Hi Erik,
>>
>> I am guessing that NCL does not like the "-" in the variable name. Try
>> encasing the array name in $" "$:
>> t15 = fi->$"temperature_at_1-5m"$
>>
>> The $ sign tells ncl to evaluate a string as a variable name, and the
>> quotes convert temperature_at_1-5m to a string so we can use the $ signs..
>>
>> Good luck,
>> Adam
>>
>> Erik Noble wrote:
>>> I wrote a code to turn a netCDF file into a binary file.
>>>
>>> I resulted with two errors:
>>>
>>> fatal:syntax error: line 12 in file net2bin.ncl before or near m
>>> t15 = fi->temperature_at_1-5m
>>> ---------------------------------^
>>>
>>> fatal:syntax error: line 16 in file net2bin.ncl before or near m
>>> sh15= fi->specific_humidity_at_1-5m
>>> ---------------------------------------^
>>>
>>> fatal:Syntax Error in block, block not executed
>>> fatal:error at line 46 in file net2bin.ncl
>>>
>>>
>>> But these two variables in my netCDF file are:
>>>
>>> float temperature_at_1-5m(time, latitude, longitude) ;
>>> temperature_at_1-5m:_FillValue = -1.073742e+09f ;
>>> temperature_at_1-5m:name = "temperature_at_1-5m" ;
>>> temperature_at_1-5m:long_name = "TEMPERATURE AT 1.5M" ;
>>> temperature_at_1-5m:units = "K" ;
>>> temperature_at_1-5m:standard_name = "temperature_at_1-5m" ;
>>> temperature_at_1-5m:cell_methods = "time: mean" ;
>>> temperature_at_1-5m:axis = "TXY" ;
>>>
>>> and
>>>
>>> float specific_humidity_at_1-5m(time, latitude, longitude) ;
>>> specific_humidity_at_1-5m:_FillValue = -1.073742e+09f ;
>>> specific_humidity_at_1-5m:name = "specific_humidity_at_1-5m" ;
>>> specific_humidity_at_1-5m:long_name = "SPECIFIC HUMIDITY AT 1.5M" ;
>>> specific_humidity_at_1-5m:units = "1" ;
>>> specific_humidity_at_1-5m:standard_name =
>>> "specific_humidity_at_1-5m" ;
>>> specific_humidity_at_1-5m:cell_methods = "time: mean" ;
>>> specific_humidity_at_1-5m:axis = "TXY" ;
>>>
>>>
>>> DOES NCL have a problem with "m" in a variable name?
>>> -Erik
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 29 2007 - 15:18:37 MDT

This archive was generated by hypermail 2.2.0 : Mon Jul 02 2007 - 07:40:50 MDT