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

20051123: MAKNAV (maknav.pgm) mods (cont.)



>From: Unidata Support <address@hidden>
>Organization: UCAR/Unidata
>Keywords: 200511171722.jAHHMk7s019022 McIDAS MAKNAV

Hi Valentijn,

re: My inclination is to add support to MAKNAV to extract the navigation
block out an existing image and write it into the target.

>Do you have this adjusted MAKNAV program which can do this?

I modified ~mcidas/mcidas2005/src/maknav.pgm (v2005 source was the same
as v2004, so no worries if you are running v2004) and added the ability
to extract the navigation block out of an existing AREA file and put it
into an AREA created by MAKEAREA.  I also modified makearea.pgm to
increase the size of the navigation block section to the maximum
allowed by McIDAS (this made the modification to maknav.pgm easier and
is completely general).

I have attached the source code for MAKNAV (maknav.pgm) and MAKEAREA
(makearea.pgm) below.

To check it out, you need to do the following:

<as 'mcidas'>
cd ~mcidas/mcidas2005/src
mv maknav.pgm maknav.pgm.2005
mv makearea.pgm makearea.pgm.2005

- add attached maknav.pgm source 
make maknav.k maknav.hlp
rm ~/bin/maknav.k
rm -f ~/help/maknav.hlp
ln maknav.k ~/bin
ln maknav.hlp ~/help

make makearea.k makearea.hlp
rm ~/bin/makearea.k
ln makearea.k ~/bin

The invocation syntax for MAKEAREA remains the same

The new invocation syntax of MAKNAV is:

MAKNAV -- Create navigation entry for an area
     MAKNAV area <keywords>
Parameters:
      area - area to attach navigation (def=current frame)
Keywords:
      LAMB= npl npe slat1 slat2 qlon size pole | Lambert Conformal secant
      MERC= eql eqe slat qlon size             | Mercator
      PS=   npl npe slat qlon size pole        | Polar Stereographic
      RADR= cenl cene clat clon size rot       | Radar
      RECT= lin lat ele lon deglin degele      | Rectilinear
      SIN=  cenl cene clat clon size           | Sinusoidal Equal Area
      TANC= npl npe slat qlon size             | Tangent Cone
      MOLL= eql eqe qlon size                  | Mollweide
            cenl,cene - line (cenl) and element (cenl) of radar site
            clat,clon - lat (clat) and lon (clon) of radar site
            deglin,degele - degrees/line (deglin) and element (degele)
            ele,lon - image element (ele) of longitude (lon)
            eql,eqe - image line (eql) and element (eqe) of equator
            lin,lat - image line (lin) of latitude (lat)
            npl,npe - image line (npl) and element (npe) of pole
            pole - N(orth) or S(outh) pole (def=N)
            qlon - normal longitude (center)
            rot - rotation of radar picture (def=0)
            size - size of one pixel (km) at standard latitude
                 - or map scale factor (ratio)
            slat - standard latitude (PS def=60, MERC def=0)
            slat1- standard latitude (LAMB def=30)
            slat2- standard latitude (LAMB def=60)
      NOAA= kepler day time tmsec orient flip  - NOAA polar orbiter
            kepler - name of 3-line Keplerian element file (form in Notes)
            day    - nominal DAY for image
            time   - nominal TIME for image
            tmsec  - time of first line to navigate [msec from DAY]
            orient - ascending(+1)/descending(-1) pass (def=+1)
            flip   - inverted image flag (0-normal/1-flipped) (def=0)
      AREA= iarea ullin ulele lres eres
            iarea  - AREA number containing desired navigation (no default)
            ullin  - Image line coordinate of area line 0, elem 0
                       (def= ullin from iarea)
            ulele  - Image element coordinate of area line 0, elem 0
                       (def= ulele from iarea)
            lres   - Line Resolution; spacing in image-lines between
                       consecutive area lines (def= nlin from iarea)
            eres   - Element resolution; spacing in image-elements
                       between consecutive area elements (def= nele from
                       iarea)

 ...

I tested the new versions of MAKEAREA and MAKNAV with images containing
GOES and METEOSAT-7 navigation and both worked correctly.

The sequence taking uncompressed raster image data and adding it to 
an AREA file and then navigating it is as follows:

- get a raster image from somewhere
- determine the following for the raster image:

  - number of lines in the raster
  - number of elements in the raster
  - size of the header of the raster in bytes (number of bytes at the
      beginning of the raster before the data values)
  - how many bytes in the raster represent a data value; possible values
      are 1, 2, or 4
  - endiness of the raster (big endian or little endian)
  - minimum data value represented by the raster image values
  - maximum data value represented by the raster image values

- convert the raster to a McIDAS AREA file:

  MAKEAREA - Make a McIDAS area from a flat image file of brightnesses

  MAKEAREA file area nlins neles nhead nbyte min max

  Parameters:
    file   - name of flat image file (no default)
    area   - McIDAS area number (no default)
    nlins  - number of lines of data in flat file (no default)
    neles  - number of elements per line in flat file (no default)
    nhead  - size of flat image file header in bytes (default=0)
    nbyte  - number of bytes per pixel (default=1)
    min    - minimum value of data (default=0)
    max    - maximum value of data (default=depends on nbyte)

  Keywords:
    FLIP=YES - flip bytes in 2,4 byte images (default=NO)

  Remarks:
    MAKEAREA converts a flat file of brightnesses (1, 2, or 4-byte data)
    into a 1-byte AREA scaling the data appropriately

- identify an image in an AREA file that has the navigation you want
  to add to the newly created AREA from the raster

- add the navigation using MAKNAV:

MAKNAV area AREA=iarea
        ^          ^___ AREA file number of image containing desired navigation
        |______________ AREA file created by MAKEAREA

- you may need to play around with the 'ullin' 'ulele' 'lres' and 'eres'
    values to get the navigation registration correct

Please let me know when you have questions.

Cheers,

Tom
-
**************************************************************************** <
Unidata User Support                                    UCAR Unidata Program <
(303)497-8643                                                  P.O. Box 3000 <
address@hidden                                   Boulder, CO 80307 <
- <
Unidata WWW Service              http://my.unidata.ucar.edu/content/support  <
- <
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web.  If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.

Attachment: maknav.pgm
Description: Binary data