reading 2-bytes binary data (product 3B42RT)

From: Marjolaine Rouault <marjolaine_at_nyahnyahspammersnyahnyah>
Date: Fri, 29 Jun 2007 11:56:52 +0200

Hi,

How can I read 2-byte integer binary data. I have been using fbindirread but I
think that reads 1-byte data and not 2-bytes?

The data was ftped from ftp://ftp-tsdis.gsfc.nasa.gov/merged. Info on the data
is as follows:
--------------------------------------------------------------------------------------------------------------------------
Product Definition:

3B42RT

File Contents and Format

Table 1 File layout
-------------------------
      | 3B42RT
Block |Byte Count| Field
------+----------+-------
  1 | 2880 | header
  2 | 1382400& | precip
  3 | 1382400& | error
  4 | 691200@ | source
-------------------------
& INTEGER*2, 60 deg N-S
@ INTEGER*1, 60 deg N-S

Header
Each file starts with a header that is one 2-byte-integer row in
length, or 2880 bytes. The header is ASCII in a "PARAMETER=VALUE"
format that makes the file self-documenting (e.g.,
"algorithm_id=3B40RT"). As such, the header can be read with
standard text editors, dumped as text with simple application
programs, or parsed for input into applications. Successive
"PARAMETER=VALUE" sets are separated by spaces, and no spaces or "="
are permitted in PARAMETER or VALUE. The current PARAMETER entries and
definitions are:

        PARAMETER Definition
   algorithm_ID TRMM algorithm identifier (e.g., "3B40RT")
   algorithm_version Version of the science algorithm
   granule_ID TSDIS granule identifier (e.g.,
                        "3B40RT.2001121809.bin")
   header_byte_length Number of bytes in the header
   file_byte_length Number of bytes in the file, expressed as a
                        formula describing the file structure
   nominal_YYYYMMDD Nominal UTC year, month, and day of the month
   nominal_HHMMSS Nominal UTC hour, minute, and second
   begin_YYYYMMDD Start UTC year, month, and day of the month
   begin_HHMMSS Start UTC hour, minute, and second
   end_YYYYMMDD End UTC year, month, and day of the month
   end_HHMMSS End UTC hour, minute, and second
   creation_YYYYMMDD Date the file was created as year, month, and
                        day of the month
   west_boundary Longitude of the western edge of the data domain
   east_boundary Longitude of the eastern edge of the data domain
   north_boundary Latitude of the northern edge of the data domain
   south_boundary Latitude of the southern edge of the data domain
   origin Geographical direction of the first grid box
                        from the grid center
   number_of_latitude_bins Number of grid boxes in the meridional
                        direction
   number_of_longitude_bins Number of grid boxes in the zonal direction
   grid Size of one grid box
   first_box_center Geolocation of the first grid box center
   second_box_center Geolocation of the second grid box center
   last_box_center Geolocation of the last grid box center
   number_of_variables Number of data fields
   variable_name List of the data field names, separated by commas
   variable_units List of data field units, separated by commas, in
                        the same order as the variable_name list
   variable_scale List of data field scaling factors, separated by
                        commas, in the same order as the variable_name
                        list
   variable_type List of data field word types, separated by
                        commas, in the same order as the variable_name
                        list
   byte_order Order of bytes in a data word ("big_endian" or
                        "little_endian")
   flag_value List of special values, separated by commas
   flag_name List of special value names, separated by commas,
                        in the same order as the flag_value list
   contact_name Name of the person to contact with questions
   contact_address Postal address of the contact_name
   contact_telephone Telephone number of the contact_name
   contact_facsimile Facsimile number of the contact_name
   contact_email Email address of the contact_name

Thereafter the data fields follow. All the fields are on a 0.25-deg
lat./long. grid that increments most rapidly to the east (from the
Prime Meridian) and then to the south (from the northern edge). Grid
box edges are on multiples of 0.25 deg. The data fields are written
as binary data in big-endian byte order.

3B42RT

Following the header, 3 data fields appear:
   precipitation (2-byte integer)
   precipitation_error (2-byte integer)
   source (1-byte integer; -1, 0, 100 stand for none, HQ, VAR)
All fields are 1440x480 gridboxes (0-360 deg. E, 60 deg. N-S). The
first grid box center is at (0.125 deg. E,59.875 deg. N). Files are
produced every 3 hours on synoptic observation hours (00 UTC, 03 UTC,
..., 21 UTC) using that hour's 3B40RT and 3B41RT data sets. Valid
estimates are only provided in the band 50 deg. N-S.

-- 
Marjolaine Rouault
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 29 2007 - 03:56:52 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 04 2007 - 19:43:21 MDT