Re: read .nc file

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 26 2013 - 10:53:47 MDT

Problem solved. Please remember to include the user list in all
technical replies.

--Dave

On Sat, Aug 24, 2013 at 8:41 PM, 宋靜 <kolrsong@gmail.com> wrote:
> thanks to reply.
>
> i tried this:
>
> f = addfile("dz.nc","r")
>
> vNam = getfilevarnames(f)
>
> do n=0,dimsizes(vNam)-1
>
> printVarSummary(f->$vNam(n)$)
>
> end do
>
> ...
>
> then if i want to use the data to plot,
>
> i tried:
>
> data = f->$vNam(3)$
>
> ...
>
> and it will work.
>
>
> 2013/8/22 Dave Allured - NOAA Affiliate <dave.allured@noaa.gov>
>>
>> All,
>>
>> The backslashes are not really in the variable name. Ncdump adds
>> backslashes to escape special characters. See ncdump and "CDL"
>> documentation. To read this variable, use Will's suggestion and take
>> out the backslashes. Also be sure there are no spaces in the name
>> string:
>>
>> vnam = "Width(Horizontal)" ; variable name as string
>> width = f->$vnam$ ; use string to reference the variable
>>
>> --Dave
>>
>> On Wed, Aug 21, 2013 at 8:19 PM, Will Hobbs <Will.Hobbs@utas.edu.au>
>> wrote:
>> > Kolrsong
>> >
>> > Am I to understand from your post that the variable name is '
>> > Width\(Horizontal\) '? If so it might that NCL is trying to interpret
>> > the
>> > back slashes and parentheses as an array definition (it's a pretty
>> > awkward
>> > variable name).
>> >
>> > If so, maybe try using a string reference to get the variable:
>> >
>> >> vnam = "Width\(Horizontal\) " ;store variable name as a string
>> >> width = f->$vnam$ ;use string to reference the
>> >> variable.
>> >
>> > Will
>> >
>> >
>> >
>> >
>> >
>> > From: kolrsong <kolrsong@gmail.com>
>> > Reply-To: kolrsong <kolrsong@gmail.com>
>> > Date: Thursday, 22 August 2013 12:10 PM
>> > To: ncl-talk <ncl-talk@ucar.edu>
>> > Subject: [ncl-talk] read .nc file
>> >
>> >
>> > hello,
>> >
>> > for a .nc file, with ncdump to look into it, i got:
>> >
>> > netcdf \9477CHE--01-WH {
>> > dimensions:
>> > Azimuth = 872 ;
>> > Gate = 480 ;
>> > variables:
>> > float Azimuth(Azimuth) ;
>> > Azimuth:Units = "Degrees" ;
>> > float Beamwidth(Azimuth) ;
>> > Beamwidth:Units = "Degrees" ;
>> > float GateWidth(Azimuth) ;
>> > GateWidth:Units = "Meters" ;
>> > float Width\(Horizontal\)(Azimuth, Gate) ;
>> > Width\(Horizontal\):Units = "m/s" ;
>> >
>> > // global attributes:
>> > :TypeName = "Width(Horizontal)" ;
>> > :DataType = "RadialSet" ;
>> > ...
>> > :Height = 120 ;
>> > :Time = -1 ;
>> > :FractionalTime = 0. ;
>> > :attributes = "NyquistVelocity vcp radarName ColorMap" ;
>> > :NyquistVelocity-unit = "MetersPerSecond" ;
>> > :NyquistVelocity-value = "31.62" ;
>> > :vcp-unit = "dimensionless" ;
>> > :vcp-value = "xxxx" ;
>> > :radarName-unit = "dimensionless" ;
>> > :radarName-value = "9477CHE" ;
>> > :ColorMap-unit = "dimensionless" ;
>> > :ColorMap-value = "SpectrumWidth" ;
>> > :Elevation = 1.5 ;
>> > :ElevationUnits = "Degrees" ;
>> > :MissingData = -99900. ;
>> > :RangeFolded = -99901. ;
>> > :RadarParameters = "PRF PulseWidth MaximumRange" ;
>> > :PRF-unit = "Hertz" ;
>> > :PRF-value = 1180 ;
>> > :PulseWidth-unit = "MicroSeconds" ;
>> > :PulseWidth-value = 0.4 ;
>> > :MaximumRange-unit = "KiloMeters" ;
>> > :MaximumRange-value = 120. ;
>> > :ConversionPlugin = "Vol2NetCDF Conversion for EDGE 5.0"
>> > ;
>> > data:
>> >
>> > Width\(Horizontal\) =
>> > -99900, -99900, -99900, -99900, -99900, -99900, -99900, -99900,
>> > -99900,
>> > -99900, -99900, -99900, -99900, -99900, -99900, -99900, -99900,
>> > 6.572832,
>> > 6.3248, -99900, 5.952753, 4.340549, 7.688972, -99900, 6.820863,
>> > 6.820863,
>> >
>> > ...
>> >
>> > how can i read for the varivable:
>> >
>> > float Width\(Horizontal\)(Azimuth, Gate) ;
>> > Width\(Horizontal\):Units = "m/s" ;
>> >
>> > if it is
>> >
>> > f->Width\(Horizontal\),
>> >
>> > then the error is:
>> >
>> > fatal:syntax error: line 47 in file radar_1.ncl before or near dsizes
>> > dsizes
>> > -------^
>> >
>> > plz show me how to do, many thanks.
>> >
>> >
>> >
>> >
>> >
>> > ________________________________
>> > kolrsong
>> >
>> > _______________________________________________
>> > 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 Aug 26 10:53:55 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT