Re: reading in binary data

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Thu Oct 27 2011 - 15:56:37 MDT

Joe,

Scratch that factoring suggestion, it was a bad idea in this case.
The discrepancy of 28872 bytes can not be explained by either of two
simple formats that might be read or written by Fortran. That
strange number suggests that metadata such as coordinates may be
included.

What are the chances that your file is *not* Geogrid binary format,
but rather WPS intermediate format, or Netcdf, or one of the other
formats in the WRF users guide? That file size would be a better
match for some of these.

http://www.mmm.ucar.edu/wrf/users/docs/user_guide/users_guide_chap3.html#_Writing_Meteorological_Data

What do you get from the command "file <filename>" ?

--Dave

On 10/27/2011 12:18 PM, Dave Allured wrote:
> There is a general writeup on how to figure out Fortran binary, at
> the bottom of this NCL page. Try factoring the file size 2908872,
> and see if it makes sense:
>
> http://www.ncl.ucar.edu/Applications/r-binary.shtml
>
> --Dave
>
> On 10/27/2011 12:13 PM, Joe Grim wrote:
>> Hi Dennis,
>>
>> 2908872, so it is barely over 1200x1200x2=2880000.
>>
>> Thanks for your help.
>>
>> Joe
>>
>> On 10/27/2011 12:08 PM, Dennis Shea wrote:
>>> What is the size of the file in bytes?
>>>
>>> %> ls -l file_name
>>>
>>> Is it 1200*1200*2 or 1200*1200*4 ?
>>>
>>> Or are there 'extra' bytes?
>>>
>>> ===
>>> The defuult in fortran is to write 'sequentail' mode
>>> which *silently* prepend and postpends extra bytes.
>>>
>>>
>>> On 10/27/11 12:00 PM, Joe Grim wrote:
>>>> Hi,
>>>>
>>>> I've been trying to read in some FORTRAN-formatted binary data using
>>>> fbindirread, but have been unsuccessful thus far. The data is described
>>>> by the following:
>>>>
>>>> type = continuous
>>>> signed = yes
>>>> projection = regular_ll
>>>> dx = 0.00833333
>>>> dy = 0.00833333
>>>> known_x = 1.0
>>>> known_y = 1.0
>>>> known_lat = -89.99583
>>>> known_lon = -179.99583
>>>> wordsize = 2
>>>> tile_x = 1200
>>>> tile_y = 1200
>>>> tile_z = 1
>>>> tile_bdr=3
>>>> units="meters MSL"
>>>> description="Topography height"
>>>>
>>>> I understand most of this (e.g., the data is 1200x1200, each data point
>>>> requires 2 bytes, the value can be positive or negative), but when I try
>>>> to read in the data using fbindirread, I can't find a single way that
>>>> works:
>>>> e.g., HGT_M = fbindirread(geog_data_path+filename,0,-1,"short")
>>>>
>>>> If someone knows how this works, would you please help me out? I really
>>>> appreciate it!
>>>>
>>>> Joe Grim
>> _______________________________________________
>> 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 Thu Oct 27 15:56:47 2011

This archive was generated by hypermail 2.1.8 : Fri Oct 28 2011 - 10:52:03 MDT