From: ejh@khonshu.colorado.edu (Edward J. Hartnett)
Subject: help using Sun FORTRAN structures
Organization: Cooperative Institute for Research in the Environmental Sciences
Date: Wed, 2 Sep 1992 21:16:51 GMT

This is a question concerning the use of structures in a program I'm
writing to manipulate satellite data. I have 250 6250 bpi 9-track
tapes of these data, and the program I'm working on will thin that in
various ways as it takes the data from tape and writes files on disk
(which will be offloaded onto exabyte tapes. The original format of
the data is described in the data documentation, and to deal with that
I have a structure (NESDIS_tovs_sounding), which is below. The entire
structure takes up 280 bytes. I want to write the output file using a
similar structure, but with some unwanted fields not included (e.g.
there is room in the original for about 30 bytes worth of "spares,"
where NESDIS thought they might someday insert values into the format
- I don't want to write these empty bytes in my format). As you can
see from the structure statements below, my structure (ejh_tovs) is
almost identical to the NESDIS_tovs_sounding structure, but with a few
fields left out. My questions is: once I get some original data read
into an array of the NESDIS structure, what is the best way to
transfer it to an array of the ejh structure?



c
c     -- This is the structure of the data records themselves. The record statement establishes
c     -- and array of this stucture such that all of the records in one physical block on
c     -- the tape can fit into it. See page 5-12,14 of the Polar Orbiter's Guide for more info
c     -- on these data.
      structure /NESDIS_cat1/
         integer*2 plb, pub, lmtemp, q1
      end structure
      structure /NESDIS_cat2/ 
         integer*2 plb, pub, lpw, q2
      end structure
c
      structure /NESDIS_tovs_sounding/
         structure /NESDIS_snd_header/ N_hdr
            integer*2 sat_id
            byte year, month, day, hour, min, sec
            integer*2 lat, long, sza, elev
            integer*2 skint, modpres, icc, retmeth, sdll, sdml
            intger*2 n, box
            integer*2 sst, time1, time2 !-- we don't use these
            integer*2 flag
            integer*4 spec_counter
         end structure
         record /NESDIS_cat1/ dat1(15)        !-- category 1
         record /NESDIS_cat2/ dat2(3)         !-- category 2
         integer*2 tpres, ttemp, q3, spare    !-- category 3
         integer*2 o3, q4                     !-- category 4
         integer*2 cpres, camt                !-- category 5
         integer*2 hbbt(20), mbbt(4), sbbt(3), spare   !-- category 6
         character*20 junk
      end structure
      record /NESDIS_tovs_sounding/ snd(23)
c
c     -- These next structures are our own format with some of the stuff
c     -- left out.
      structure /ejh_cat1/
         integer*2 lmtemp, q1
      end structure
      structure /ejh_cat2/ 
         integer*2 lpw, q2
      end structure
c
      structure /ejh_tovs/
         structure /snd_header/ hdr
            byte sat_id, year, month, day, hour, min, sec
            integer*2 lat, long, sza, elev
            integer*2 skint, modpres, icc, retmeth, sdll, sdml
            intger*2 n, box
            integer*2 flag
         end structure
         record /ejh_cat1/ dat1(15)           !-- category 1
         record /ejh_cat2/ dat2(3)            !-- category 2
         integer*2 tpres, ttemp, q3, spare    !-- category 3
         integer*2 o3, q4                     !-- category 4
         integer*2 cpres, camt                !-- category 5
         integer*2 hbbt(20), mbbt(4), sbbt(3) !-- category 6
      end structure
c
-- 
Edward Hartnett			ejh@khonshu.colorado.edu

Newsgroups: comp.lang.fortran