Re: a little help with reading binary: coordinates

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed, 16 Jul 2008 16:00:21 -0600

Eric,

I will assume that Dennis took care of your questions about
coordinates and looping.

Regarding the od command, it seems that there are different versions
of that utility program. The "-i" option works on mine, and
displays output as decimal four-byte integers. "od --version"
outputs "od (GNU coreutils) 6.9".

Try specifying "-f" because your precip data is REAL*4. Other
options are "-t f8" for REAL*8, and possibly "-t d4" for INTEGER*4
which is predominant.

Try "man od", also "od --help" because sometimes your man page may
be out of sync with the installed program version, and the built in
documentation is sure to match.

Also, od prints "*" to shorten the output when several lines of data
values are an exact match to the preceding line. So in your
examples below, I see subsections that are all zeros. HTH.

--Dave

Erik Noble wrote:
> Dear Dave
>
> Thank you for your help. Could you please help me clarify?
>
> If I understand the description that came with my data (below), I
> think all of my files are consistent and have the same dimension. I am
> given this description about my data:
>
> ["Each file is composed of 16 direct access binary
> ("big_endian") records that are defined as follows:
>
> Record 1: contains the merged microwave precipitation only for 00 UTC
> Record 2: contains the "CMORPH" precipitation estimates for 00 UTC
>
> Record 3: contains the merged microwave precipitation only for 03 UTC
> Record 4: contains the "CMORPH" precipitation estimates for 03 UTC
> .
> .
> .
> Record 15: contains the merged microwave precipitation only for 21 UTC
> Record 16: contains the "CMORPH" precipitation estimates for 21 UTC
>
> All units are "mm/hr". Missing data are denoted by values of "-9999."
> Each record contains a 1440 x 480 REAL*4 array of data which is oriented
> from 0.125E EASTward and from 59.875N SOUTHward, with a grid increment
> of 0.25 degrees of latitude and longitude. Thus, the grid locations
> are the centers of a 0.25 degree lat/lon grid box."]
>
> If I understand your suggestion correctly, this means changing lines 8
> through 11 to be just:
> do i = 0, 14 ; CMORPH binary file contains 16 records. NCL starts at
> counting at 0
> cpc_combined_MW = fbindirread
> ("./20060901_3hr-025deg_cpc+comb",i,(/480,1440/),"float")
> CMORPH = fbindirread
> ("./20060901_3hr-025deg_cpc+comb",i+1,(/480,1440/),"float")
> .
> .
>
> the rec-dims and rec_type arguments are correct, but now I am not sure
> how to create the lat and lon because they are not a specific record.
> In my earlier code, I say that they are the first two records. How can
> I get around this?
>
> Also, I tried using the "od" function as indicated in the ncl binary
> page, but i am not sure what I am seeing.
>
> ENOBLE_at_ATHENA: /usr/people/enoble> od -Ad -i -N80
> 20060901_3hr-025deg_cpc+comb
> Illegal option -- i
> Usage: od [-bcdDfFhoOsSvxX] [file] [[+]offset[.][b]]
> od [-v] [-A addr_base] [-j skip] [-N count] [-t type_str] ... [file...]
>
> ENOBLE_at_ATHENA: /usr/people/enoble> od -Ad -N80
> 20060901_3hr-025deg_cpc+comb
> 0000000 000000 000000 000000 000000 000000 000000 000000 000000
> *
> 0000080
>
> ENOBLE_at_ATHENA: /usr/people/enoble> od -Ad -N80 -j204
> 20060901_3hr-025deg_cpc+comb
> 0000204 000000 000000 000000 000000 000000 000000 000000 000000
> *
> 0000284
> ENOBLE_at_ATHENA: /usr/people/enoble>
>
> Your help is greatly appreciated.
> Sincerely,
> Erik

<snip>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 16 2008 - 16:00:21 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 18 2008 - 08:51:52 MDT