Re: ncl_convert2nc: filetype 'dat' not supported.

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 24 2013 - 15:19:41 MDT

The nc could be created via:

   x@long_name = "..."
   x@units = "..."

   x!0 = "time"
   x!1 = "lev"
   x!2 = "lat"

Ideally,

   x&time = ... array of times ...
   x&lev = ... levels ...
   x&lat = ... .....

Then use Method 1 at:

http://www.ncl.ucar.edu/Applications/o-netcdf.shtml

On 6/24/13 3:11 PM, Dennis Shea wrote:
> Reading binary can be a hassle because several factors
> need be explicitly know.
>
> The data provider (eg, whoever created the original file)
> should state if the file was generated on a 'big-endian' or
> 'little-endian' machine. Further, was the data written as
> a flat binary file or via a fortran sequential write
> statement. If the latter is true, the fortran embeds
> 'hidden' record separators that result in the file
> being slightly larger than is expected.
>
> ===
> ncl 0> nlat = 37
> ncl 1> klev = 23
> ncl 2> ntim = 16314
> ncl 3> bytes = ntim*klev*nlat*4 ; 4 is 4 bytes per float
> ncl 4> print(bytes)
>
> Variable: bytes
> [snip]
> Coordinates:
> (0) 55532856
>
> This matches the size of your file:
>
> 55532856 Jun 24 14:48 ERA40Tzm.dat
>
> Hence, it is a flat binary file. This means either
> fbindirread or cbinread can be used to read the file.
>
> ==============================================
> Next, what endian are associated with the binary values?
>
> Try:
> ncl 5> x = fbindirread("ERA40Tzm.dat", 0, (/16314,23,37/) )
> ncl 6> print(x)
>
> If the numbers look good ... then you have
> successfully read the binary file.
>
> Note it could also be: (/16314,37,23/) but this is less common.
> =================================================
>
> If the numbers do not look realistic, it likely means the file
> was created on a different system than you are using.
>
> EG: if you are on a big-endian system then use
> setfile option to tell NCL to switch the bytes:
>
> setfileoption("bin","ReadByteOrder","LittleEndian")
>
> Please red:
> http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
>
> Good luck
>
>
>
> On 06/24/2013 02:45 PM, Erika Folova wrote:
>> I forgot to mention that
>> the timestep of the data is daily from 1958 to 2002.
>> in total ntime = 16314
>>
>> I look forward to your response,
>>
>> -- Erika
>>
>>
>>
>>
>> On Tue, Jun 25, 2013 at 5:42 AM, Erika Folova <e.folova@gmail.com
>> <mailto:e.folova@gmail.com>> wrote:
>>
>> Hi Everyone,
>>
>> I need a bit help,
>> I have a binary data *.dat with dimendsions (lat, level, time),
>>
>> nlat =37
>> nlevel=23
>> ntime= 16314
>>
>> the latitude extending from equator (0) to 90oN (only northern
>> hemisphere).
>> I have been strugling to convert this *binary file to *nc*,
>> but was still failed,, I really appreciate if anyone willing to help
>> me for this case,
>> I put the data in ftp cd incoming by name:
>>
>> *ERA40Tzm.dat*
>> *
>> *
>> Thank you so much,
>> -- Erika,
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 24 15:19:48 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT