Re: reading in binary data

From: Hahmann, Andrea N. <ahah_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 28 2011 - 09:40:36 MDT

Hi Joe

In this cases I think it is better to write a fortran wrapper. BTW, I
have heard of others reading/writing these files. Maybe sending a message
to the WRF users group could be useful.

Regards, Andrea

----
Andrea N. Hahmann
Senior Scientist
Wind Energy Division
Risų DTU
Technical University of Denmark
Risų National Laboratory for Sustainable Energy
Frederikborgvej 399, P.O. Box 49
4000 Roskilde, Denmark
Direct +45 4677 5471
Mobil: +45 2133 0550
ahah@risoe.dtu.dk
http://www.risoe.dtu.dk
On 10/28/11 5:23 PM, "Joe Grim" <grim@ucar.edu> wrote:
>Hi Dave,
>
>Thank you for your help.  I think I'm getting on the right track.  I have
>found out that this file was written out by a C subroutine
>(write_geogrid.c)
>within the WPS geogrid code.  Even though I hardly know any C, I think
>that
>I will eventually arrive at a solution.
>
>By the way, when I try the "file" command, I get the name of the file in
>return, followed by ": data".
>
>Joe
>
>-----Original Message-----
>From: Dave Allured [mailto:dave.allured@noaa.gov]
>Sent: Thursday, October 27, 2011 3:57 PM
>To: Joe Grim; ncl-talk@ucar.edu
>Subject: Re: reading in binary data
>
>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#_
>Wr
>iting_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
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 28 09:40:17 2011

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