[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nex2image and displaying output in NCEP N-AWIPS



Gregg,

I see the problem. Your version does not allow for ichan to
be greater than 5 (so you probably can't look at the sounder
products on NOAAPORT either which have values of 41-59)!
My product is using "27" for N0R.

This really isn't going to work well if the GINI has to use a sensor and
channel that you might- but if you don't mind using GOES-7 for now, we
can call it a channel 5 (which maps to sensor 33, imtype 16) which will
work in your:
        IF ( ichan .eq. 1 ) THEN
            imtype = 1
          ELSE IF ( ichan .eq. 2 ) THEN
            imtype = 2
          ELSE IF ( ichan .eq. 3 ) THEN
            imtype = 4
          ELSE IF ( ichan .eq. 4 ) THEN
            imtype = 8
          ELSE IF ( ichan .eq. 5 ) THEN
            imtype = 16
          ELSE
            iret = -4
            RETURN
        END IF

and

        IF ( isat .eq. 10 .and. ichan .ne. 1 ) THEN
            imsorc = 33
            IF ( ichan .eq. 3 ) imtype = 512
            IF ( ichan .eq. 4 ) imtype = 128



Note that what I have for the ichan to imtype instead of that
set of IF statetemts above is:
        IF (( ichan .ge. 1 ) .and. ( ichan .le. 32 )) THEN
           imtype = 2**(ichan - 1)
        ELSE IF ( ( ichan .ge. 33 ) .and. ( ichan .lt. 64 ) ) THEN
C
C*         assign channels 33-63 as channel ID- won't overlap 2**x
C
           imtype = ichan
        ELSE
           iret = -4
           RETURN
        END IF

The first IF handles all the channels 1-32. The second maps channels
33-63 (which is needed to use the NOAAPOR GINI imager of
sounder products which are channels 41-59 as mentioned above).

I've attatched a modified version of giniid.c which will rechannel 
the product to "5". This channel number is configuratble in a table
used by nex2gini on creation, so wouldn't require a code mod.

Use a imgtyp.tbl line of:
RADAR                N0R           0    105     33     16      1 upc_rad24.tbl

Steve Chiswell
Unidata User Support

On Thu, 2006-02-16 at 09:10, Gregory Grosshans wrote:
> Steve,
> 
> I've attached the NCEP version of imgi2gm.f, it appears GOES-7 is set
> for imsorc = 32.  So, I changed imgtyp.tbl N0R's entry from 33 to 32
> and ran GPMAP by hand, after using a gpend, and still receive an
> error:
> 
>  [IM 1]  No image type entry for file N0R_20060215_2015
> 
> I've also attached our imgtyp.tbl that I'm trying to use in this whole
> process. 
> 
> Should I try changing the satellite ID from 10 to 14, and hence change
> the imgtyp.tbl entry from 32 to 76?
> 
> Thanks,
> Gregg
> 
> 
> Steve Chiswell wrote: 
> > Gregg,
> > 
> > Your file is identical to mine. After modifying imgtyp.tbl,
> > try running gpmap with:
> > satfil = N0R_20060215_2015
> > proj = sat
> > garea = dset
> > 
> > (when making changes to imgtyp.tbl, you have to run gpend and 
> > rerun gpmap so that the image pixmap isn't cached).
> > 
> > If that works, then NMAP2 should work, but again, the default behavior
> > in the xw driver (xsatim.c) is that if the file name is the same, it
> > won't reread the file if you try to reload it, so you have to close
> > NMAP2 and rerun after editing imgtyp.tbl.
> > 
> > Steve Chiswell
> > Unidata User Support
> > 
> > On Wed, 2006-02-15 at 16:12, Gregory Grosshans wrote:
> >   
> > > Steve,
> > > 
> > > Thanks for all of your help.  However, I'm still obtaining the same IM 
> > > error in NMAP2.  I've attached the updated GINI file that I created from 
> > > your program.   Am I overlooking something?  I also updated the 
> > > imgtyp.tbl to change the satellite ID from 11 to 33.
> > > 
> > > Thanks,
> > > Gregg
> > > 
> > > Steve Chiswell wrote:
> > > 
> > >     
> > > > Gregg,
> > > > 
> > > > Here is a quick pipe program to flip the 99 in to 10 (goes 7),
> > > > which will be treated as ID=33 in imgtyp.tbl:
> > > > 
> > > > --------------------giniid.c----------------------
> > > > #include <stdio.h>
> > > > #include <unistd.h>
> > > > 
> > > > main()
> > > > {
> > > > int isinit=!0;
> > > > size_t nbytes;
> > > > unsigned char buf[8192];
> > > > 
> > > > while ( ( nbytes = read(STDIN_FILENO, buf, (size_t)8192) ) > 0 )
> > > >   {
> > > >   if ( isinit )
> > > >      {
> > > >      if ( buf[22] == 99 ) buf[22] = (unsigned char)10;
> > > >      isinit = 0;
> > > >      }
> > > >   write(STDOUT_FILENO, buf, nbytes);
> > > >   }
> > > > 
> > > > }
> > > > 
> > > > ----------------------------------------------------------
> > > > run the program as: cat inputgini | giniid > output gini
> > > > 
> > > > I can now plot the image using the imgtyp.tbl entry:
> > > > RADAR                N0R           0    105     33  2**26      1 
> > > > upc_rad24.tbl
> > > > 
> > > > Steve Chiswell
> > > > Unidata User Support
> > > > 
> > > > 
> > > > On Wed, 2006-02-15 at 14:56, Gregory Grosshans wrote:
> > > >  
> > > > 
> > > >       
> > > > > Steve,
> > > > > 
> > > > > Do you know if its possible to manually/easily change the satellite 
> > > > > ID 
> > > > > in the AREA file to a "known" number, like GOES-7,
> > > > > so SPC can see what the image looks like? 
> > > > > 
> > > > > Thanks,
> > > > > Gregg
> > > > > 
> > > > > Steve Chiswell wrote:
> > > > > 
> > > > >    
> > > > > 
> > > > >         
> > > > > > Gregg,
> > > > > > 
> > > > > > OK...bummer....
> > > > > > 
> > > > > > In nex2gini, I define the gini satellite ID as 99 to not conflict 
> > > > > > with
> > > > > > the defined GOES satellite numbers. In gemlib/im/imgi2gm.f, the
> > > > > > routine has a set of IF statements:
> > > > > > C
> > > > > > C*      Set the satellite number. (Octet 2)
> > > > > > C*
> > > > > > Where I added 
> > > > > >         ELSE IF ( isat .eq. 99 ) THEN
> > > > > >           imsorc = 11
> > > > > > 
> > > > > > 
> > > > > > This all has to do with mapping the GINI satellite ID to the AREA 
> > > > > > file
> > > > > > satellite ID used in imgtyp.tbl. Its ugly already since GINI files
> > > > > > don't use the same numbers as the AREA files do.
> > > > > > 
> > > > > > So, to use NCEP's distribution, out of the box, we would have to
> > > > > > modify my nex2gini code to use one on the "known" numbers like
> > > > > > GOES-7 (which isn't broadcast currently, or work with NCEP to modify
> > > > > > that routine.
> > > > > > 
> > > > > > Sorry about that!
> > > > > > 
> > > > > > Steve Chiswell
> > > > > > Unidata User Support
> > > > > > 
> > > > > > 
> > > > > > On Wed, 2006-02-15 at 13:54, Gregory Grosshans wrote:
> > > > > > 
> > > > > > 
> > > > > >      
> > > > > > 
> > > > > >           
> > > > > > > Steve,
> > > > > > > 
> > > > > > > I've updated imgtyp.tbl with the information you provided below 
> > > > > > > and
> > > > > > > have the upc_rad24.tbl file in the local directory.  I reset SAT 
> > > > > > > and
> > > > > > > RAD to the current directory, made a subdirectory call "N0R" and
> > > > > > > placed the image file in the "N0R" directory.
> > > > > > > 
> > > > > > > In NMAP2 the image appears in the timeline but the following 
> > > > > > > error is
> > > > > > > in the "Error Message" window:
> > > > > > > 
> > > > > > > [IM 1} No image type entry for file $RAD/N0R/N0R_20060215_2015
> > > > > > > [GEMPLT -60] NIMCORD - Invalid image display coordinates
> > > > > > > [IM 1} No image type entry for file $RAD/N0R/N0R_20060215_2015
> > > > > > > 
> > > > > > > The above error occurs when trying to load the image as a 
> > > > > > > "SAT"ellite
> > > > > > > image and also as a "RAD"ar image.
> > > > > > > 
> > > > > > > Am I overlooking something that is causing this error?
> > > > > > > 
> > > > > > > Thanks,
> > > > > > > Gregg
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > Steve Chiswell wrote: 
> > > > > > >   
> > > > > > > 
> > > > > > >        
> > > > > > > 
> > > > > > >             
> > > > > > > > Gregg,
> > > > > > > > 
> > > > > > > > Attached is a 1km GINI as uncompressed. I do have another
> > > > > > > > addition to nex2image which writes the image portion as a png 
> > > > > > > > which
> > > > > > > > I added code to crgini.c to handle...but since that is 
> > > > > > > > configurable
> > > > > > > > on creation side, that wouldn't prevent you from using NCEP's
> > > > > > > > distribution for uncompressed GINI's.
> > > > > > > > 
> > > > > > > > As for the NetCDF grids for QPESUMS, they are very similar to 
> > > > > > > > the
> > > > > > > > file structure for the AWIPS NetCDF images that is already 
> > > > > > > > handled
> > > > > > > > in the IM_library, so I made a few additions there as you note.
> > > > > > > > 
> > > > > > > > At any rate, I have the following lines in my 
> > > > > > > > $GEMTBL/sat/imgtyp.tbl
> > > > > > > > file:
> > > > > > > > 
> > > > > > > > ! Unidata GINI composite RADAR (ranges as defined in 
> > > > > > > > unidata/nex2gini.tbl)
> > > > > > > > RADAR                N0Z           0    255     11  2**24      
> > > > > > > > 1 osf_ref16.tbl
> > > > > > > > RADAR                NET           0    255     11  2**25      
> > > > > > > > 1 upc_net.tbl
> > > > > > > > RADAR                N0R           0    105     11  2**26      
> > > > > > > > 1 upc_rad24.tbl
> > > > > > > > RADAR                NCR           0    105     11  2**27      
> > > > > > > > 1 upc_rad24.tbl
> > > > > > > > RADAR                NVL           0    255     11  2**28      
> > > > > > > > 1 upc_nvl.tbl
> > > > > > > > RADAR                N1P           0    255     11  2**29      
> > > > > > > > 1 upc_n1p.tbl
> > > > > > > > RADAR                NTP           0    255     11  2**30      
> > > > > > > > 1 upc_ntp.tbl
> > > > > > > > 
> > > > > > > > I've attached the upc_rad24.tbl file as well. If you place the 
> > > > > > > > images
> > > > > > > > under the $SAT duirectory for nmap, you can take advantage of 
> > > > > > > > more
> > > > > > > > than the 20 radar colors that GEMPAK uses for radar images!
> > > > > > > > 
> > > > > > > > Steve Chiswell
> > > > > > > > Unidata User Support
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > On Wed, 2006-02-15 at 12:58, Gregory Grosshans wrote:
> > > > > > > > 
> > > > > > > >     
> > > > > > > > 
> > > > > > > >          
> > > > > > > > 
> > > > > > > >               
> > > > > > > > > Steve,
> > > > > > > > > 
> > > > > > > > > Would it be possible for you to send an attached 1km GINI 
> > > > > > > > > radar mosaic 
> > > > > > > > > that I can try to display in NCEP
> > > > > > > > > NMAP2?  If this works then SPC can decide if we want to 
> > > > > > > > > create the 
> > > > > > > > > mosaic here via the nex2image code
> > > > > > > > > or possible obtain it via LDM in a non-operational manner.  
> > > > > > > > > The nice 
> > > > > > > > > thing about this is NCEP NMAP
> > > > > > > > > can display the data.  The QPESUMS NetCDF data I suspect 
> > > > > > > > > doesn't display 
> > > > > > > > > in NCEP NMAP.
> > > > > > > > > 
> > > > > > > > > Thanks for your help.
> > > > > > > > > Gregg
> > > > > > > > > 
> > > > > > > > > Steve Chiswell wrote:
> > > > > > > > > 
> > > > > > > > >   
> > > > > > > > >       
> > > > > > > > > 
> > > > > > > > >            
> > > > > > > > > 
> > > > > > > > >                 
> > > > > > > > > > Gregg,
> > > > > > > > > > 
> > > > > > > > > > The calibration bar units would be the only thing that the 
> > > > > > > > > > NCEP
> > > > > > > > > > distribution doesn't have. I can send you the 1km GINI 
> > > > > > > > > > radar files
> > > > > > > > > >     
> > > > > > > > > >         
> > > > > > > > > > 
> > > > > > > > > >              
> > > > > > > > > > 
> > > > > > > > > >                   
> > > > > > > > > 
> > > > > > > > > >from our LDM if that would be of use for you.
> > > > > > > > >   
> > > > > > > > >       
> > > > > > > > > 
> > > > > > > > >            
> > > > > > > > > 
> > > > > > > > >                 
> > > > > > > > > > However, you may want to investigate the 1km products that 
> > > > > > > > > > NSSL
> > > > > > > > > > is working to produce (Ken Howard and Steve Vasiloff 
> > > > > > > > > > provided some
> > > > > > > > > > background to their QPESUMS product to us last year). I did 
> > > > > > > > > > modify
> > > > > > > > > > our GEMPAK distribution to read their NetCDF tiled files-
> > > > > > > > > > and hoping that they were going to produce single files 
> > > > > > > > > > rather than
> > > > > > > > > > tiles. The point here being that they are doing the 3-D 
> > > > > > > > > > volume level 2
> > > > > > > > > > radar data, and the AP/clutter removal). See the March 2005 
> > > > > > > > > > and
> > > > > > > > > > May 2005 links at:
> > > > > > > > > > http://www.unidata.ucar.edu/community/seminars/
> > > > > > > > > > 
> > > > > > > > > > We are hoping to be able to distribute the QPESUMS products 
> > > > > > > > > > when they
> > > > > > > > > > are ready...but I haven't heard an update on the status 
> > > > > > > > > > recently.
> > > > > > > > > > 
> > > > > > > > > > Steve Chiswell
> > > > > > > > > > Unidata User Support
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > On Tue, 2006-02-14 at 14:31, Gregory Grosshans wrote:
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > >     
> > > > > > > > > >         
> > > > > > > > > > 
> > > > > > > > > >              
> > > > > > > > > > 
> > > > > > > > > >                   
> > > > > > > > > > > Hi Steve,
> > > > > > > > > > > 
> > > > > > > > > > > I was talking to Scott today and heard you stopped by 
> > > > > > > > > > > NCEP last week. I 
> > > > > > > > > > > hope your visit went well.
> > > > > > > > > > > 
> > > > > > > > > > > There is renewed interest at the SPC in 1km radar 
> > > > > > > > > > > mosaics. Some time ago 
> > > > > > > > > > > through email exchanges with you it
> > > > > > > > > > > appeared things would work except for the calibration bar 
> > > > > > > > > > > from the GINI 
> > > > > > > > > > > data in the N-AWIPS core code (i.e. see email
> > > > > > > > > > > below).
> > > > > > > > > > > 
> > > > > > > > > > > Can you tell me if this would still be the case, that is 
> > > > > > > > > > > if we were to 
> > > > > > > > > > > run nex2image to create a 1km mosaic from
> > > > > > > > > > > level-III radar products and then displaying the GINI 
> > > > > > > > > > > data in NCEP 
> > > > > > > > > > > N-AWIPS (i.e. NMAP2)? Are you aware of
> > > > > > > > > > > any other limitations that may result from running the 
> > > > > > > > > > > nex2image program 
> > > > > > > > > > > with the rest of the N-AWIPS being
> > > > > > > > > > > core NCEP code?
> > > > > > > > > > > 
> > > > > > > > > > > Thanks,
> > > > > > > > > > > Gregg
> > > > > > > > > > > 
> > > > > > > > > > > Steve Chiswell wrote:
> > > > > > > > > > > 
> > > > > > > > > > >  
> > > > > > > > > > > 
> > > > > > > > > > >       
> > > > > > > > > > >           
> > > > > > > > > > > 
> > > > > > > > > > >                
> > > > > > > > > > > 
> > > > > > > > > > >                     
> > > > > > > > > > > > Gregg,
> > > > > > > > > > > > 
> > > > > > > > > > > > You can get the distribution via the web. If you are 
> > > > > > > > > > > > running Linux,
> > > > > > > > > > > > then the easiest way would be to grab the binary and 
> > > > > > > > > > > > take the programs
> > > > > > > > > > > >    
> > > > > > > > > > > > 
> > > > > > > > > > > >         
> > > > > > > > > > > >             
> > > > > > > > > > > > 
> > > > > > > > > > > >                  
> > > > > > > > > > > > 
> > > > > > > > > > > >                       
> > > > > > > > > > > 
> > > > > > > > > > > >from bin/linux. Also, you will need the $GEMTBL/unidata 
> > > > > > > > > > > >directory for
> > > > > > > > > > >  
> > > > > > > > > > > 
> > > > > > > > > > >       
> > > > > > > > > > >           
> > > > > > > > > > > 
> > > > > > > > > > >                
> > > > > > > > > > > 
> > > > > > > > > > >                     
> > > > > > > > > > > > nex2image to place the appropriate platformID and 
> > > > > > > > > > > > calibration numbers in
> > > > > > > > > > > > the GINI header (Also grab the entries from 
> > > > > > > > > > > > $GEMTBL/sat/imgtype.tbl and
> > > > > > > > > > > > the color enhancements from $GEMTBL/luts mentioned in 
> > > > > > > > > > > > the imgtype.tbl file).
> > > > > > > > > > > > 
> > > > > > > > > > > > With NCEP's plotting, you won't get a calibration bar 
> > > > > > > > > > > > from the GINI.
> > > > > > > > > > > > Our distribution has additional code to create read the 
> > > > > > > > > > > > calibration
> > > > > > > > > > > > section from the GINI.
> > > > > > > > > > > > 
> > > > > > > > > > > > Steve Chiswell
> > > > > > > > > > > > 
> > > > > > > > > > > > 
> > > > > > > > > > > > 
> > > > > > > > > > > >    
> > > > > > > > > > > >         
> > > > > > > > > > > >             
> > > > > > > > > > > > 
> > > > > > > > > > > >                  
> > > > > > > > > > > > 
> > > > > > > > > > > >                       
> > > > > > > > > > > 
> > > > > > > > > > > ______________________________________________________________
> > > > > > > > > > > ! upc_ref24.tbl
> > > > > > > > > > > !
> > > > > > > > > > > ! Color table for 24-level NIDS Reflectivity
> > > > > > > > > > > !
> > > > > > > > > > > !Color name    Abrev   Red  Green   Blue  X color name
> > > > > > > > > > >                        0      0      0
> > > > > > > > > > >                        0      0     00
> > > > > > > > > > >                        0      0     00
> > > > > > > > > > >                        0      0     00
> > > > > > > > > > >                        0      0     00
> > > > > > > > > > >                        0      0    000
> > > > > > > > > > >                        0      0    020
> > > > > > > > > > >                        0      0    040
> > > > > > > > > > >                        0      0    060
> > > > > > > > > > >                        0    236    236
> > > > > > > > > > >                        1    160    246
> > > > > > > > > > >                        0      0    246
> > > > > > > > > > >                        0    255      0
> > > > > > > > > > >                        0    200      0
> > > > > > > > > > >                        0    144      0
> > > > > > > > > > >                      255    255      0
> > > > > > > > > > >                      231    192      0
> > > > > > > > > > >                      255    144      0
> > > > > > > > > > >                      255      0      0
> > > > > > > > > > >                      214      0      0
> > > > > > > > > > >                      192      0      0
> > > > > > > > > > >                      255      0    255
> > > > > > > > > > >                      153     85    201
> > > > > > > > > > >                      255    255    255
> > > > > > > > > > >           
> > > > > > > > > > > 
> > > > > > > > > > >                
> > > > > > > > > > > 
> > > > > > > > > > >                     
> > 
> >   
> 
> 
> 
> ______________________________________________________________________
> 
> ! IMGTYP.TBL
> !
> ! This table contains the minimum and maximum image pixel values
> ! for use in setting the colors when displaying satellite or radar images.
> ! A default look up table (LUT) file is also assigned per image type.
> !
> ! For satellite images, the comparisons are based on the satellite ID number,
> ! the image type and whether the image is a "raw" image or not.
> !
> ! The IMGTYP is a coded number representing the channel of the image.
> ! The value is equal to 2**(channel-1).
> !
> ! For RADAR images, the NIDS product code is used to identify different radar
> ! types.
> !
> ! (Do not use tabs when adding to the table.)
> !!
> ! Log:
> ! S. Jacobs/NCEP      12/97   Updated info for radar images
> ! S. Jacobs/NCEP       2/98   Updated per UNISYS product catalog
> ! J. Partain/MPC         3/98   Added GOES-10 images
> ! S. Jacobs/NCEP       4/98   Fixed spelling of abbreviations
> ! S. Jacobs/NCEP       7/98   Added METEOSAT7
> ! J. Carr/HPC          7/98   Updated a topography table
> ! J. Carr/HPC          7/98   Updated a topography table
> ! S. Jacobs/NCEP       8/98   Added SND data from GOES-8
> ! J. Partain/MPC        12/98   Added SSMI data
> ! G. Grosshans/SPC     2/99   Added two precip products for Unisys radar
> ! J. Carr/HPC            3/99   Added EST-RAIN and PWAT ssmi data.
> ! J. Partain/MPC      11/99   Added QuickSCAT data
> ! S. Jacobs/NCEP      12/99   Fix for GMS images satellite ID
> ! G. Grosshans/SPC       2/00   Added GOES Sounder data
> ! G. Grosshans/SPC       8/00   Added GOES Composite data
> ! G. Grosshans/SPC       2/01   Added FIRE Composite data
> ! S. Jacobs/NCEP         9/02   Changed all IR images to default to a GRAY LUT
> ! D.W.Plummer/NCEP       2/03   Additions/changes for 2-byte images
> ! D.W.Plummer/NCEP       4/03   chg GOES-12 VIS entry from 30-220 to 0-255
> ! S. Jacobs/NCEP         5/03   Replaced NIDS with LOCAL for local products
> ! S. Jacobs/NCEP         5/03   Added more entries for METEOSAT5
> ! m.gamazaychikov/SAIC  06/03   changed ssmi_mpc to ssmi_opc
> ! A. Hardy/NCEP          4/04   Added GOES-10 10-bit imagery (max = 1024)
> ! A. Hardy/NCEP         12/04   Added METEOSAT7 sensor source number 58
> ! S. Jacobs/NCEP     5/05   Added AMSU, TRMM, SSMI-WINDS; allow exponents
> ! S. Jacobs/NCEP     5/05   Added CAPE-CINH and LIX-PWX
> ! S. Jacobs/NCEP        11/05   Added new MTS entries for satid=84
> !------------------------------------------------------------------------------
> !
> ! SATELLITE IMAGE TYPES
> ! ---------------------
> !                   |IMG     |      |      |SAT ID|IMGTYP| PIXEL| DEFAULT     
>  |
> !SAT ID             |TYP     |   MIN|   MAX|NUMBER|NUMBER| DEPTH| LUT FILE    
>  |
> !(20)               |(8)     |   (6)|   (6)|   (6)|   (6)|   (6)|      (14)   
>  |
> !                   |        |      |      |      |      |      |             
>  |
> FIRE                 FIRE          0      8     99      1      1 firemask.tbl
> COMPOSITE            CAPE          0    255     75    128      1 GRAY 
> GOES-SOUNDER         SOUNDER       0    255     75      1      1 gdpw1.tbl
> TOPO                 VIS          52    226     11      1      1 upc_topo.tbl
> AMSU-PWAT            IR            0    255     10  2**23      1 GRAY
> AMSU-RAIN            IR            0    255     10  2**21      1 GRAY
> AMSU-89GHZ           IR            0    255     10  2**15      1 GRAY
> QSCAT                IR            0    255     10     64      1 ir_nmc.tbl
> TRMM-RAIN            IR            0    255     10      1      1 GRAY
> SSMI                 IR            0    255      9     64      1 ssmi_opc.tbl
> SSMI-WINDS           IR            0    255      9      4      1 ssmi_opc.tbl
> EST-RAIN             IR            0    255      9      2      1 ssmi_opc.tbl
> PWAT                 IR            0    255      9     32      1 ssmi_opc.tbl
> GOES6                VIS          30    220     30      1      1 GRAY
> GOES6                IR            0    255     31    128      1 ir_sab.tbl
> GOES6                WV            0    255     31    512      1 watvap.tbl
> GOES7                VISPC         0    255     32    128      1 GRAY
> GOES7                VIS          30    220     32      1      1 GRAY
> GOES7                IR            0    255     33    128      1 ir_sab.tbl
> GOES7                WV            0    255     33    512      1 watvap.tbl
> GOES7-RAW            IR         1280  18000     33    128      2 ir_sab.tbl
> GOES7-RAW            WV            0  18000     33    512      2 watvap.tbl
> GOES8                VIS          30    220     70      1      1 GRAY
> GOES8                IR2           0    255     70      2      1 ir_sab.tbl
> GOES8                WV            0    255     70      4      1 watvap.tbl
> GOES8                IR            0    255     70      8      1 ir_sab.tbl
> GOES8                IR5           0    255     70     16      1 sabir.tbl
> GOES8                IR            0    255     70    128      1 ir_sab.tbl
> GOES8                VIS           0  30240     70      1      2 GRAY
> GOES8                IR2           0    255     70      2      2 ir_sab.tbl
> GOES8                WV            0    255     70      4      2 watvap.tbl
> GOES8                IR            0    255     70      8      2 ir_sab.tbl
> GOES8                IR5           0    255     70     16      2 sabir.tbl
> GOES8                IR            0    255     70    128      2 ir_sab.tbl
> GOES8                SND           0    255     71      1      1 GRAY
> GOES9                VIS          30    220     72      1      1 GRAY
> GOES9                IR2           0    255     72      2      1 ir_sab.tbl
> GOES9                WV            0    255     72      4      1 watvap.tbl
> GOES9                IR            0    255     72      8      1 ir_sab.tbl
> GOES9                IR5           0    255     72     16      1 ir_sab.tbl
> GOES9                IR            0    255     72    128      1 ir_sab.tbl
> GOES9                VIS           0  30240     72      1      2 GRAY
> GOES9                IR2           0    255     72      2      2 ir_sab.tbl
> GOES9                WV            0    255     72      4      2 watvap.tbl
> GOES9                IR            0    255     72      8      2 ir_sab.tbl
> GOES9                IR5           0    255     72     16      2 ir_sab.tbl
> GOES9                IR            0    255     72    128      2 ir_sab.tbl
> GOES10               VIS          30    220     74      1      1 GRAY
> GOES10               VIS           0   1024     74      1      2 GRAY
> GOES10               IR2           0    255     74      2      1 ir_sab.tbl
> GOES10               IR3           0    255     74      4      1 watvap.tbl
> GOES10               IR4           0    255     74      8      1 ir_sab.tbl
> GOES10               IR5           0    255     74     16      1 ir_sab.tbl
> GOES10               IR4           0    255     74    128      1 ir_sab.tbl
> GOES10               VIS           0  30240     74      1      2 GRAY
> GOES10               IR2           0    255     74      2      2 ir_sab.tbl
> GOES10               IR3           0    255     74      4      2 watvap.tbl
> GOES10               IR4           0  26624     74      8      2 GRAY
> GOES10               IR5           0  26624     74     16      2 GRAY
> GOES10               IR4           0  26624     74    128      2 GRAY
> CAPE-CINH            IR            0    255     75      2      1 GRAY
> LIX-PWX              IR            0    255     75      1      1 GRAY
> GOES12               VIS           0    255     78      1      1 GRAY
> GOES12               IR2           0    255     78      2      1 ir_sab.tbl
> GOES12               IR3           0    255     78      4      1 watvap.tbl
> GOES12               IR4           0    255     78      8      1 GRAY
> GOES12               IR5           0    255     78     16      1 sabir.tbl
> GOES12               IR6           0    255     78     32      1 GRAY 
> GOES12               IR4           0    255     78    128      1 ir_sab.tbl
> GOES12               VIS           0  30240     78      1      2 GRAG
> GOES12               IR2           0    255     78      2      2 ir_sab.tbl
> GOES12               IR3           0    255     78      4      2 watvap.tbl
> GOES12               IR4           0    255     78      8      2 ir_sab.tbl
> GOES12               IR5           0    255     78     16      2 ir_sab.tbl
> GOES12               IR6           0    255     78     32      2 GRAY 
> GOES12               IR4           0    255     78    128      2 ir_sab.tbl
> GLOBAL               VIS          30    220     70      1      1 GRAY
> GLOBAL               IR2           0    255     70      2      1 ir_sab.tbl
> GLOBAL               WV            0    255     70      4      1 watvap.tbl
> GLOBAL               IR            0    255     70      8      1 ir_sab.tbl
> GLOBAL               IR5           0    255     70     16      1 sabir.tbl
> GLOBAL               IR            0    255     70    128      1 ir_sab.tbl
> GLOBAL               VIS           0  30240     70      1      2 GRAY
> GLOBAL               IR2           0    255     70      2      2 ir_sab.tbl
> GLOBAL               WV            0    255     70      4      2 watvap.tbl
> GLOBAL               IR            0  26624     70      8      2 ir_sab.tbl
> GLOBAL               IR5           0  26624     70     16      2 sabir.tbl
> GLOBAL               IR            0  26624     70    128      2 ir_sab.tbl
> METEOSAT3            VIS           0    255     54      1      1 GRAY
> METEOSAT3            IR           20    250     54    128      1 GRAY
> METEOSAT3            WV            0    255     54    512      1 watvap.tbl
> METEOSAT5            VIS           0    255     56      1      1 GRAY
> METEOSAT5            WV            0    255     56      4      1 watvap.tbl
> METEOSAT5            IR           20    250     56      8      1 GRAY
> METEOSAT5            IR           20    250     56    128      1 GRAY
> METEOSAT5            WV            0    255     56    512      1 watvap.tbl
> METEOSAT6            VIS           0    255     57      1      1 GRAY
> METEOSAT6            IR            0    255     57    128      1 GRAY
> METEOSAT6            WV            0    255     57    512      1 watvap.tbl
> METEOSAT7            VIS           0    255     58      1      1 GRAY
> METEOSAT7            IR            0    255     58      8      1 GRAY
> METEOSAT7            IR            0    255     58    128      1 GRAY
> METEOSAT7            WV            0    255     58    512      1 watvap.tbl
> GMS                  VIS          30    220     83      1      1 GRAY
> GMS                  VIS          30    220     12      1      1 GRAY
> GMS                  IR            0    255     83      2      1 ir_sab.tbl
> GMS                  IR            0    255     13      2      1 ir_sab.tbl
> GMS                  IR            0    255     83      8      1 ir_sab.tbl
> GMS                  IR            0    255     13      8      1 ir_sab.tbl
> GMS                  IR            0    255     83    128      1 ir_sab.tbl
> GMS                  IR            0    255     13    128      1 ir_sab.tbl
> MTS                  VIS          30    220     84      1      1 GRAY
> MTS                  IR            0    255     84      2      1 GRAY
> MTS                  WV            0    255     84      8      1 GRAY
> MTS                  IR2           0    255     84     16      1 GRAY
> !
> TERRAIN              FT            0    255     71      1      0 terrain.tbl
> TERRAIN              FT            0    255     71      1      1 terrain.tbl
> TERRAIN              FT            0    255     71      0      0 terrain.tbl
> TERRAIN              FT            0    255     71      0      1 terrain.tbl
> !
> !------------------------------------------------------------------------------
> !
> ! RADAR IMAGE TYPES
> ! -----------------
> !                   |IMG     |      |      |RAD ID|PROD  | PIXEL| DEFAULT     
>  |
> !RAD ID             |TYP     |   MIN|   MAX|NUMBER|NUMBER| DEPTH| LUT FILE    
>  |
> !(20)               |(8)     |   (6)|   (6)|   (6)|   (6)|   (6)|    (14)     
>  |
> !                   |        |      |      |      |      |      |             
>  |
> ! Used for the UNISYS data feed.
> NIDS  1 KM  BASE     REFLECT       0     15      7     19      1 osf_ref16.tbl
> NIDS  2 KM  BASE     REFLECT       0     15      7     20      1 osf_ref16.tbl
> NIDS  1 KM  RADIAL   VELOCITY      0     15      7     27      1 
> nids_vel16.tbl
> NIDS  4 KM  COMPOSIT REFLECT       0      7      7     36      1 osf_ref8.tbl
> NIDS  4 KM  COMPOSIT REFLECT       0     15      7     38      1 osf_ref16.tbl
> NIDS  4 KM  ECHO     TOPS          0     15      7     41      1 nids_tops.tbl
> NIDS  1 KM  STRM REL VELOCITY      0     15      7     56      1 
> nids_vel16.tbl
> NIDS  4 KM           VIL           0     15      7     57      1 nids_vil.tbl
> NIDS  4 KM  L1 REFL  MAX           0      7      7     65      1 osf_ref8.tbl
> NIDS  4 KM  L2 REFL  MAX           0      7      7     66      1 osf_ref8.tbl
> NIDS  2 KM  1HR PREC ACCUM         0     15      7     78      1 nids_pre.tbl
> NIDS  2 KM  3HR PREC ACCUM         0     15      7     79      1 nids_pre.tbl
> NIDS  2 KM  TOT PREC ACCUM         0     15      7     80      1 nids_pre.tbl
> NIDS  4 KM  L3 REFL  MAX           0      7      7     90      1 osf_ref8.tbl
> !
> ! Used for data from other vendors.
> NIDS  1 KM  BASE     REFLECT       0      7      7     16      1 osf_ref8.tbl
> NIDS  2 KM  BASE     REFLECT       0      7      7     17      1 osf_ref8.tbl
> NIDS  4 KM  BASE     REFLECT       0      7      7     18      1 osf_ref8.tbl
> NIDS  4 KM  BASE     REFLECT       0     15      7     21      1 osf_ref16.tbl
> NIDS .25 KM  RADIAL  VELOCITY      0      7      7     22      1 nids_vel8.tbl
> NIDS .50 KM  RADIAL  VELOCITY      0      7      7     23      1 nids_vel8.tbl
> NIDS  1 KM  RADIAL   VELOCITY      0      7      7     24      1 nids_vel8.tbl
> NIDS .25 KM  RADIAL  VELOCITY      0     15      7     25      1 
> nids_vel16.tbl
> NIDS .50 KM  RADIAL  VELOCITY      0     15      7     26      1 
> nids_vel16.tbl
> NIDS .25 KM SPECTRUM WIDTH         0      7      7     28      1 nids_swid.tbl
> NIDS .50 KM SPECTRUM WIDTH         0      7      7     29      1 nids_swid.tbl
> NIDS  1 KM  SPECTRUM WIDTH         0      7      7     30      1 nids_swid.tbl
> NIDS  1 KM  COMPOSIT REFLECT       0      7      7     35      1 osf_ref8.tbl
> NIDS  1 KM  COMPOSIT REFLECT       0     15      7     37      1 osf_ref16.tbl
> NIDS  1 KM SEVERE WX REFLECT       0     15      7     43      1 osf_ref16.tbl
> NIDS .25KM SEVERE WX VELOCITY      0     15      7     44      1 
> nids_vel16.tbl
> NIDS .25KM SEVERE WX SWIDTH        0      7      7     45      1 nids_swid.tbl
> NIDS .50KM SEVERE WX SHEAR         0     15      7     46      1 
> nids_rsher.tbl
> NIDS .50KM COMBINED  MOMENT        0     15      7     49      1 
> nids_cmref.tbl
> NIDS  1 KM X-SECTION REFLECT       0     15      7     50      1 osf_ref16.tbl
> NIDS  1 KM X-SECTION VELOCITY      0     15      7     51      1 
> nids_vel16.tbl
> NIDS  1 KM X-SECTION SWIDTH        0      7      7     52      1 nids_swid.tbl
> NIDS  1 KM WEAK ECHO REGION        0      7      7     53      1 
> nids_wecho.tbl
> NIDS .50 KM STRM REL VELOCITY      0     15      7     55      1 
> nids_vel16.tbl
> NIDS  4 KM  L1 REFL  AVE           0      7      7     63      1 osf_ref8.tbl
> NIDS  4 KM  L2 REFL  AVE           0      7      7     64      1 osf_ref8.tbl
> NIDS  4 KM  L1 TURB  AVE           0      7      7     67      1 osf_ref8.tbl
> NIDS  4 KM  L2 TURB  AVE           0      7      7     68      1 osf_ref8.tbl
> NIDS  4 KM  L3 TURB  AVE           0      7      7     69      1 osf_ref8.tbl
> NIDS  4 KM  L1 TURB  MAX           0      7      7     70      1 osf_ref8.tbl
> NIDS  4 KM  L2 TURB  MAX           0      7      7     71      1 osf_ref8.tbl
> NIDS  4 KM  L3 TURB  MAX           0      7      7     72      1 osf_ref8.tbl
> NIDS  COMBINED       SHEAR         0     15      7     87      1 
> nids_csher.tbl
> NIDS  4 KM  L3 REFL  AVE           0      7      7     89      1 osf_ref8.tbl
> !------------------------------------------------------------------------------
> ! Used for the UNISYS data feed.
> NATIONAL  4 KM  COMP REFLECT       0     15      8     27      1 osf_ref16.tbl
> NATIONAL  8 KM  COMP REFLECT       0     15      8     28      1 osf_ref16.tbl
> NATIONAL  4 KM  COMP REFLECT       0     15      8     30      1 osf_ref16.tbl
> NATIONAL  8 KM  COMP REFLECT       0     15      8     35      1 osf_ref16.tbl
> NATIONAL  4 KM  COMP REFLECT       0      7      8     50      1 osf_ref8.tbl
> NATIONAL  8 KM  COMP REFLECT       0      7      8     65      1 osf_ref8.tbl
> NATIONAL  4 KM  1HR  PRECIP        0     15      8     90      1 nids_pre.tbl
> NATIONAL  8 KM  1HR  PRECIP        0     15      8     91      1 nids_pre.tbl
> NATIONAL  4 KM  ECHO TOPS          0     15      8     95      1 nids_tops.tbl
> NATIONAL  8 KM  ECHO TOPS          0     15      8     96      1 nids_tops.tbl
> NATIONAL  4 KM  CML  PRECIP        0     15      8    100      1 nids_pre.tbl
> NATIONAL  4 KM  CML  PRECIP        0     15      8    101      1 nids_pre.tbl
> NATIONAL  4 KM  CML  PRECIP        0     15      8    101      2 nids_pre.tbl
> NATIONAL  4 KM  24HR PRECIP        0     15      8    102      1 nids_pre.tbl
> NATIONAL  4 KM  COMP REFLECT       0     15      8    103      1 osf_ref16.tbl
> NATIONAL  8 KM  COMP REFLECT       0     15      8    104      1 osf_ref16.tbl
> NATIONAL  8 KM  CML  PRECIP        0     15      8    107      1 nids_pre.tbl
> NATIONAL  8 KM  24HR PRECIP        0     15      8    108      1 nids_pre.tbl
> NATIONAL  2 KM  BASE REFLECT       0     15      8    137      1 osf_ref16.tbl
> NATIONAL  2 KM  BASE REFLECT       0     15      8    138      1 osf_ref16.tbl
> NATIONAL  2 KM  BASE REFLECT       0     15      8    140      1 osf_ref16.tbl
> NATIONAL  4 KM  BASE REFLECT       0     15      8    141      1 osf_ref16.tbl
> NATIONAL  8 KM  BASE REFLECT       0     15      8    142      1 osf_ref16.tbl
> NATIONAL  4 KM  BASE REFLECT       0     15      8    144      1 osf_ref16.tbl
> NATIONAL  4 KM  LYRL REFLECT       0      7      8    145      1 osf_ref8.tbl
> NATIONAL  4 KM  LYRM REFLECT       0      7      8    146      1 osf_ref8.tbl
> NATIONAL  4 KM  LYRH REFLECT       0      7      8    147      1 osf_ref8.tbl
> NATIONAL  4 KM       VIL           0     15      8    148      1 nids_vil.tbl
> NATIONAL  8 KM       VIL           0     15      8    149      1 nids_vil.tbl
> !
> ! Used for data from other vendors.
> NATIONAL  4 KM  COMP REFLECT       0     15      8      5      1 osf_ref16.tbl
> NATIONAL  8 KM  COMP REFLECT       0     15      8     10      1 osf_ref16.tbl
> NATIONAL  4 KM  COMP REFLECT       0      7      8     13      1 osf_ref8.tbl
> NATIONAL  8 KM  COMP REFLECT       0      7      8     25      1 osf_ref8.tbl
> NATIONAL  4 KM  COMP REFLECT       0     15      8     26      1 osf_ref16.tbl
> NATIONAL  2 KM  BASE REFLECT       0     15      8     70      1 osf_ref16.tbl
> NATIONAL  4 KM  BASE REFLECT       0     15      8     75      1 osf_ref16.tbl
> NATIONAL  8 KM  BASE REFLECT       0     15      8     80      1 osf_ref16.tbl
> !------------------------------------------------------------------------------
> ! Used for the UNISYS data feed.
> REGIONAL  4 KM  COMP REFLECT       0     15      9     30      1 osf_ref16.tbl
> REGIONAL  2 KM  CML  PRECIP        0     15      9    105      1 nids_pre.tbl
> REGIONAL  2 KM  24HR PRECIP        0     15      9    106      1 nids_pre.tbl
> REGIONAL  2 KM  BASE REFLECT       0     15      9    137      1 osf_ref16.tbl
> REGIONAL  2 KM  BASE REFLECT       0     15      9    138      1 osf_ref16.tbl
> REGIONAL  2 KM  BASE REFLECT       0     15      9    140      1 osf_ref16.tbl
> REGIONAL  4 KM  BASE REFLECT       0     15      9    141      1 osf_ref16.tbl
> !------------------------------------------------------------------------------
> WSI NOWRAD  8 KM US  MOSAIC        0     15      7      1      1 osf_ref16.tbl
> WSI NOWRAD  2 KM US  MOSAIC        0     15      7      2      1 osf_ref16.tbl
> !------------------------------------------------------------------------------
> ! Unidata GINI composite RADAR (ranges as defined in unidata/nex2gini.tbl)
> RADAR                N0Z           0    255     11  2**24      1 osf_ref16.tbl
> RADAR                NET           0    255     11  2**25      1 upc_net.tbl
> !RADAR                N0R           0    105     11  2**26      1 
> upc_rad24.tbl
> RADAR                N0R           0    105     32  2**26      1 upc_rad24.tbl
> RADAR                NCR           0    105     11  2**27      1 upc_rad24.tbl
> RADAR                NVL           0    255     11  2**28      1 upc_nvl.tbl
> RADAR                N1P           0    255     11  2**29      1 upc_n1p.tbl
> RADAR                NTP           0    255     11  2**30      1 upc_ntp.tbl
> 
> ______________________________________________________________________
> 
>       SUBROUTINE IM_GI2GM  ( imgfil, ignhdr, rnvblk, iret )
> C************************************************************************
> C* IM_GI2GM                                                           *
> C*                                                                    *
> C* This subroutine reads the header information from a AWIPS GINI file        
> *
> C* and sets the navigation                                            *
> C*                                                                    *
> C* IM_GI2GM  ( IMGFIL, IGNHDR, RNVBLK, IRET )                         *
> C*                                                                    *
> C* Input parameters:                                                  *
> C*    IMGFIL          CHAR*           Image file name                 *
> C*                                                                    *
> C* Output parameters:                                                 *
> C*    IGNHDR (135)    INTEGER         GINI header array               *
> C*    RNVBLK (LLNNAV) REAL            Navigation block                *
> C*    IRET            INTEGER         Return code                     *
> C*                                      0 = normal return             *
> C*                                     -2 = Error opening/reading file*
> C*                                     -3 = Invalid image file format *
> C*                                     -4 = Invalid image file header *
> C*                                     -5 = Invalid image navigation  *
> C**                                                                   *
> C* Log:                                                                       
> *
> C* T. Lee/GSC          7/96   Copied from IM_GNHD                     *
> C* T. Lee/GSC          7/96   Output to navigation block              *
> C* S. Jacobs/NCEP      7/96   Changed to use GR_MNAV; Changed calling *
> C*                            sequence to MV_BTOI; Added ignhdr       *
> C* J. Cowie/COMET     12/96   Fixed Mercator mapping bug              *
> C* J. Cowie/COMET      1/97   Changed IMGDEF common variable names    *
> C* J. Cowie/COMET     12/97   Added imradf                            *
> C* T. Lee/GSC          2/00   Y2K bug fix                             *
> C************************************************************************
>       INCLUDE         'GEMPRM.PRM'
>       INCLUDE         'IMGDEF.CMN'
> C*
>       CHARACTER*(*)   imgfil
>       INTEGER         ignhdr (*)
>       REAL            rnvblk (*)      
> C*
>       CHARACTER       proj*3
>       LOGICAL         negflg
> C------------------------------------------------------------------------
>       iret = 0
>       sign = 1.
>       dangl1 = 90.
>       imradf = 0
> C
> C*    Open the file and read the file header. (WMO and GINI headers)
> C
>       CALL FL_DOPN  ( imgfil, 135, .false., lunmf, iret )
>       CALL FL_READ  ( lunmf, 1, 135, ignhdr, ier )
>       IF  ( ier .ne. 0 )  THEN
>           iret = -1
>           RETURN
>       END IF
>       CALL FL_CLOS ( lunmf, ier )
> C
> C*    Determine the start of the GINI product. Starts after the WMO
> C*    header at either byte 22 or 26, depending on the WMO hdr length..
> C
>       istart = 21 - 1
>       nbytes = 1
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, ihdr1, ier )
>       istart = 25 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, ihdr2, ier )
>       IF ( ihdr1 .eq. 10 ) THEN
>           igstrt = 21
>         ELSE IF ( ihdr2 .eq. 10 ) THEN
>           igstrt = 25
>         ELSE
>           iret = -4
>       END IF
> C
> C*      Set the satellite number. (Octet 2)
> C*
> C*       Value       Sat
> C*      -----------------------
> C*           9       METEOSAT
> C*          10       GOES-7
> C*          11       GOES-8
> C*          12       GOES-9
> C*          13       GOES-10
> C*          14       GOES-11
> C*          15       GOES-12  
> C
>       istart = igstrt + 2 - 1
>       nbytes = 1
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, isat, ier )
>       IF ( isat .eq. 9 ) THEN
>           imsorc = 56
>         ELSE IF ( isat .eq. 10 ) THEN
>           imsorc = 32
>         ELSE IF ( isat .eq. 11 ) THEN
>           imsorc = 70
>         ELSE IF ( isat .eq. 12 ) THEN
>           imsorc = 72
>         ELSE IF ( isat .eq. 13 ) THEN
>           imsorc = 74
>         ELSE IF ( isat .eq. 14 ) THEN
>           imsorc = 76
>         ELSE IF ( isat .eq. 15 ) THEN
>           imsorc = 78
>         ELSE
>           iret = -4
>           RETURN
>       END IF  
> C
> C*    Set the channel number. (Octet 4)
> C*
> C*       Value      Channel
> C*      --------------------------
> C*          1       VIS
> C*          2       3.9 micron (IR)
> C*          3       6.7 micron (WV)
> C*          4       11  micron (IR)
> C*          5       12  micron (IR)
> C*          6       derived #1        
> C*          7       derived #2        
> C*          8       derived #3        
> C*          9       derived #4        
> C
>       istart = igstrt + 4 - 1
>       nbytes = 1
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, ichan, ier )
>       IF ( ichan .eq. 1 ) THEN
>           imtype = 1
>         ELSE IF ( ichan .eq. 2 ) THEN
>           imtype = 2
>         ELSE IF ( ichan .eq. 3 ) THEN
>           imtype = 4
>         ELSE IF ( ichan .eq. 4 ) THEN
>           imtype = 8
>         ELSE IF ( ichan .eq. 5 ) THEN
>           imtype = 16
>         ELSE
>           iret = -4
>           RETURN
>       END IF
> C
> C*    Adjust the source and channel for some image types to conform
> C*    to AREA file numbering.
> C
> C*    GOES-7
> C
>       IF ( isat .eq. 10 .and. ichan .ne. 1 ) THEN
>           imsorc = 33
>           IF ( ichan .eq. 3 ) imtype = 512
>           IF ( ichan .eq. 4 ) imtype = 128
> C
> C*    Meteosat
> C
>         ELSE IF ( isat .eq. 9 .and. ichan .ne. 1 ) THEN
>           IF ( ichan .eq. 3 ) imtype = 512
>           IF ( ichan .eq. 4 ) imtype = 128
>       END IF
> C
> C*    Get the date and time. (Octets 9-14)
> C
>       istart = igstrt + 9 - 1
>       nbytes = 1
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, iyear, ier )
>       istart = igstrt + 10 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, imon, ier )
>       istart = igstrt + 11 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, iday, ier )
>       istart = igstrt + 12 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, ihour, ier )
>       istart = igstrt + 13 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, imin, ier )
>       istart = igstrt + 14 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, isec, ier )
> C
> C*    Determine century (year between 70 and 99; must be 1900's)
> C     
>       IF  ( iyear .gt. 70 )  THEN
>           iyear = 1900 + iyear
>         ELSE
>           iyear = 2000 + iyear
>       END IF
>       imdate = iyear * 10000 + imon * 100 + iday
>       imtime = ihour * 10000 + imin * 100 + isec
> C
> C*    Image size (Octets 17-18, 19-20). Set subset area to full image
> C
>       istart = igstrt + 17 - 1
>       nbytes = 2
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, imnpix, ier )
>       istart = igstrt + 19 - 1
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, imnlin, ier )
>       imdpth = 1
>       imleft = 1
>       imtop  = 1
>       imrght = imnpix
>       imbot  = imnlin
>       rmxysc = 1.
> C
> C*    Determine offset to start of data and data length
> C
>       imdoff = igstrt + 512
>       imldat = imnlin * ( imnpix * imdpth )
> C
> C*    Verify that image scanning mode is left to right, top to bottom
> C
>       istart = igstrt + 38 - 1
>       nbytes = 1
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, iscmod, ier )
>       IF ( iscmod .ne. 0 ) THEN
>           iret = -4
>           RETURN
>       END IF
> C
> C*    Map projection type. (Octet 16)
> C*
> C*       Value   Projection
> C*     ---------------------
> C*         1       Mercator
> C*         3       Lambert
> C*         5       Stereographic
> C
>       istart = igstrt + 16 - 1
>       nbytes = 1
>       negflg = .false.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, imapty, ier )
>       IF ( imapty .eq. 1 ) THEN
>           proj = 'MER'
>       ELSE IF ( imapty .eq. 3 ) THEN
>           proj = 'LCC'
>       ELSE IF ( imapty .eq. 5 ) THEN
>           proj = 'STR'
>       ELSE
>           iret = -4
>           RETURN
>       END IF
> C
> C*    Get navigation items used in all projections.
> C*
> C*    Get lat/lon of lower left point. (Octets 21-23, 24-26)
> C
>       istart = igstrt + 21 - 1
>       nbytes = 3
>       negflg = .true.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, lat1, ier )
>       rlat1 = ( lat1 / 10000. ) * DTR
> C
>       istart = igstrt + 24 - 1
>       nbytes = 3
>       negflg = .true.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, lon1, ier )
>       rlon1 = ( lon1 / 10000. ) * DTR
> C
> C*    std - lat at which cone or cylinder intersects earth.
> C*    (Octets 39-41)
> C
>       istart = igstrt + 39 - 1
>       nbytes = 3
>       negflg = .true.
>       CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, latin, ier )
>       std = latin / 10000.
> C     
> C*    Get items specific to each projection.
> C
>       IF ( proj .eq. 'LCC' .or. proj .eq. 'STR' ) THEN
> C
> C*        Lov - orientation of the grid (center longitude).
> C*        (Octets 28-30)
> C
>           istart = igstrt + 28 - 1
>           nbytes = 3
>           negflg = .true.
>           CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, lov, ier )
>           clon = lov / 10000.
>           CALL PRNLON ( 1, clon, ier )
>           cntlon = clon * DTR   
> C
> C*        tdx and tdy direction grid increments. (Octets 31-33, 34-36)
> C
>           istart = igstrt + 31 - 1
>           nbytes = 3
>           negflg = .true.
>           CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, jdx, ier )
>           tdx = jdx / 10.  
>           istart = igstrt + 34 - 1
>           CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, jdy, ier )
>           tdy = jdy / 10.  
> C
> C*        Projection center flag (NP=0, SP=1). (Octet 37) 
> C
>           istart = igstrt + 37 - 1
>           nbytes = 1
>           negflg = .false.
>           CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, ipole, ier )
>           IF ( ipole .eq. 1 ) THEN
>               sign   = - 1.  
>               dangl1 = - 90.
>           END IF
>       ELSE        
>           istart = igstrt + 28 - 1
>           nbytes = 3
>           negflg = .true.
>           CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, lat2, ier )
>           rlat2 = ( lat2 / 10000. ) * DTR
>           istart = igstrt + 31 - 1
>           CALL MV_BTOI ( ignhdr, istart, nbytes, negflg, lon2, ier )
> C
> C*        Check for lon2 bug. Sign of lon2 was wrong in sample image
> C
>           IF ( rlon1 .lt. 0 .and. lon2 .gt. 0 ) lon2 = - lon2
>           rlon2 = ( lon2 / 10000. ) * DTR
>       END IF
> C
> C*    ***************************
> C*    *** Polar Stereographic ***
> C*    ***************************
> C
>       IF ( proj .eq. 'STR' ) THEN
> C
> C*        Linear coordinates of lower left point. (1+sin 90) is
> C*        excluded.
> C
>           x1 =   RADIUS * TAN ( PI4TH - sign * rlat1 / 2. ) *
>      +                   SIN ( rlon1 - cntlon )
>           y1 = - RADIUS * TAN ( PI4TH - sign * rlat1 / 2. ) *
>      +                   COS ( rlon1 - cntlon ) * sign
> C
> C*        Compute grid spacing on the pole plane. (1+sin 90) is
> C*        also excluded.
> C
>           dx = tdx / ( 1. + SIN ( PI / 3. ) )
>           dy = tdy / ( 1. + SIN ( PI / 3. ) )
> C
> C*        Compute the linear coordinates of the upper right point.
> C*        Assumes left to right, top to bottom image scanning.
> C
>           x2 = x1 + ( imnpix - 1 ) * dx
>           y2 = y1 + ( imnlin - 1 ) * dy * sign
> C
> C*        Set lat/lon of upper right point and projection angles.
> C
>           dlat2  = sign * ( HALFPI - 2. * ATAN2 ( SQRT ( ( x2 * x2 ) 
>      +                     + ( y2 * y2 ) ), RADIUS ) ) * RTD
>           y2     = - sign * y2
>           dlon2  = ( cntlon + ATAN2 ( x2, y2 ) ) * RTD
>           CALL PRNLON ( 1, dlon2, ier ) 
> C
> C*          Set lat/lon of lower left point.
> C
>             dlat1 = lat1 / 10000.
>             dlon1 = lon1 / 10000.
> C
> C*        Set projection angles. Angle1 is set to be 90 or -90.
> C
>           dangl2 = clon
>           dangl3 = 0.
> C
>       ELSE IF ( proj .eq. 'LCC' ) THEN
> C
> C*        *************************
> C*        *** Lambert Conformal ***
> C*        *************************
> C
> C*        Compute the constant of the tangent cone. 
> C
>           psi    = HALFPI - ( ABS ( std ) * DTR )
>           ccone  = COS ( psi )
>           rearth = RADIUS / ccone
> C
> C*        Compute the linear coordinate for the lower left grid point.
> C*        The auxiliary function is excluded. 
> C
>           x1 =   rearth * ( TAN ( ( HALFPI - sign * rlat1 ) / 2. ) ** 
>      +                   ccone ) * SIN ( ccone * ( rlon1 - cntlon ) )
>           y1 = - rearth * ( TAN ( ( HALFPI - sign * rlat1 ) / 2. ) ** 
>      +                   ccone ) * COS ( ccone * ( rlon1 - cntlon ) ) * sign
> C
> C*        Recompute grid spacing. Alpha is the constant term in the 
> C*        map scale factor.
> C
>           alpha = SIN ( psi ) / ( TAN ( psi / 2. ) ** ccone ) 
>           dx    = tdx / alpha
>           dy    = tdy / alpha
> C
> C*        Compute the linear coordinates for the upper right grid 
> C*        point.  Assumes left to right, top to bottom image scanning.
> C
>           x2 = x1 + ( imnpix - 1 ) * dx
>           y2 = y1 + ( imnlin - 1 ) * dy * sign
> C
> C*        Compute the lat/lon coordinates of the upper right point.
> C
>           rlat2 = sign * ( HALFPI - 2. * ATAN ( ( SQRT ( ( x2 * x2 ) +
>      +                    ( y2 * y2 ) ) / rearth ) ** ( 1. / ccone ) ) ) 
>           dlat2 = rlat2 * RTD
>           y2    = - sign * y2
>           rlon2 = cntlon + ATAN2 ( x2, y2 ) * ( 1. / ccone )
> C
>           dlon2 = rlon2 * RTD
>           CALL PRNLON ( 1, dlon2, ier ) 
> C
> C*          Set the lat/lon coordinates of the lower left point.
> C
>             dlat1 = lat1 / 10000.
>             dlon1 = lon1 / 10000.
> C
> C*        Set projection angles.
> C
>           dangl1 = std
>           dangl2 = clon 
>           dangl3 = dangl1
> C
>       ELSE IF ( proj .eq. 'MER' ) THEN
> C
> C*        ****************
> C*        *** Mercator ***
> C*        ****************
> C
> C*        Compute lat/lon of lower left and upper right points.
> C*        Make sure that the longitudes are between -180 and +180.
> C
>           IF ( rlat1 .gt. rlat2 ) THEN
>               temp  = rlat1 * RTD
>               dlat1 = rlat2 * RTD
>               dlat2 = temp
> C
>               temp  = rlon1 * RTD
>               dlon1 = rlon2 * RTD
>               dlon2 = temp
>           ELSE
>               dlat1 = rlat1 * RTD
>               dlat2 = rlat2 * RTD
>               dlon1 = rlon1 * RTD
>               dlon2 = rlon2 * RTD    
>           END IF 
> 
>           CALL PRNLON ( 1, dlon1, ier )
>           CALL PRNLON ( 1, dlon2, ier )
> C
> C*        Set projection angles.
> C
>           dangl1 = 0.
>           dangl2 = 0.
>           dangl3 = 0.
>       END IF
> C
> C*    Set navigation block.
> C
>       CALL GR_MNAV  ( proj, imnpix, imnlin, dlat1, dlon1, dlat2,
>      +                        dlon2, dangl1, dangl2, dangl3, .true.,
>      +                        rnvblk, ier )
> C
> C*    Set the map projection.
> C
>       CALL GSMPRJ ( proj, dangl1, dangl2, dangl3,
>      +                      dlat1, dlon1, dlat2, dlon2, ier )
> C*
>       IF ( ier .ne. 0 ) iret = -5
> C
>       RETURN
>       END
#include <stdio.h>
#include <unistd.h>

main()
{
int isinit=!0;
size_t nbytes;
unsigned char buf[8192];

while ( ( nbytes = read(STDIN_FILENO, buf, (size_t)8192) ) > 0 )
   {
   if ( isinit )
      {
      if ( buf[22] == 99 ) buf[22] = (unsigned char)10;
      if ( buf[24] == 27 ) buf[24] = (unsigned char)5;
      isinit = 0;
      }
   write(STDOUT_FILENO, buf, nbytes);
   }

}