[ncl-talk] Trouble converting dat to netcdf

Dennis Shea shea at ucar.edu
Mon Mar 21 10:36:37 MDT 2016


Station data and netCDF: See Chapter 9
   http://cfconventions.org/cf-conventions/v1.6.0/cf-conventions.pdf

Punch line ... this can be a bit of a nuisance!
As noted by RickB, even with the following a good portion of the data will
likely be _FillValue. I suggest you write netCDF4 to take advantage of
compression.

  http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
           *setfileoption*("nc","Format","NetCDF4")
===

7020019480101039999   8
21 98600B    7  -210B-9999  360  150
10 85000  1088B -272B-9999   10  230
10 70000  2497B -278B-9999  350  140
10 50000  4870B -371B-9999  170  130
10 40000  6386B -463B-9999  140  150
10 30000  8242B -561B-9999  150  130
10 25000  9400B -552B-9999  160   70
10 20000 10824B -547B-9999-9999-9999
#7020019480101169999   5
21 99000B    7  -292B-9999  330  130
10 85000  1091B -286B-9999  360  130
10 70000  2478B -290B-9999  350  200
10 50000  4866B -365B-9999   30   70
10 40000  6375B -475B-9999   70   40
[snip]

[a] header has ID / time stamp / # observations
[b] The 1st line after each header is (I speculate) the 'surface' values
[c] Subsequent values are associated with standard pressure levels

[1]
Create a 'time' array  ... find the 1st and last dates on the file  and
create a time array yyymmdd that spans all days including leap years

   time at units = "days since 1948-01-01 ....."

You may wish to look at the code used by

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

These times are not CF compliant. If they are not to your liking, extract
the code from contributed.ncl and change to your liking.

[2] create PSFC(time), TSFC(time), ...

     PSFC = new (ntime, "float", -9999.0)
     etc

[3] create coordinate pressure array (say) plevel(klev)
     plevel = (/100000, 85000, ... /)
     plevel at long_name = "standard pressure level"
     plevel at units  = "Pa"
     plevel!0          = "plevel"
     plevel&plevel = plevel
     klev   = dimsizes(plevel)

[4] create T(time,plevel), ...... for each variable

     T = new( (/ntim,klev/), "float", -9999.0)
     etc'

[5]
Loop: For each date (time) use 'ind' to associate the observation with the
appropriate 'time' and 'level





On Mon, Mar 21, 2016 at 9:35 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi,
>
> The script you sent runs to completion, and creates a NetCDF file.  You
> don't say what's wrong with it. The variables do seem to be comprised of
> mostly _FillValues (?)
>
> Rick
>
> On Sat, Mar 19, 2016 at 3:43 PM, Stanley Edwin <sedwin at alaska.edu> wrote:
>
>>>>  70200.dat.gz
>> <https://drive.google.com/a/alaska.edu/file/d/0B5e9G7If5LpKNnpnYXc0a3NfODg/view?usp=drive_web>
>>>> I could not get this dat file to convert properly to NetCDF, files from
>> NWS
>>
>> Thank You
>>
>> Stanley G. Edwin
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160321/05d0ccfa/attachment.html 


More information about the ncl-talk mailing list