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

20010817: Problems at UPRM (cont.)

>From: Unidata Mcidas Account <address@hidden>
>Organization:  University of Puerto Rico
>Keywords:  200106202036.f5KKab115440 McIDAS ADDE DATALOC DSINFO IMGLIST


>   I'm afraid I'm stuck again, I'm having problems with the area file to
>png conversion.  I know the area files I want to convert, when I run the
>decoder it seems to work fine, but when I try to display the .png, it
>won't work.

The problem you are probably having is that the compressed file is not
a PNG image.  We use the PNG technique to compress the image only.
The other thing is that the contents of an AREA file are not just an
image.  There are header words that contain various sets of inforation:

o general image information block
o navigation block
o calibration block
o etc

If all you had was the image portion of the AREA file, and if you
compressed that into a PNG image, then you could other programs to
display the compressed image.  That is not what you have after running
area2png.  What you have is the original AREA header blocks, followed,
if it existed, by the AREA file trailer block, which is then followed
by the PNG compressed image portion.  You would have to strip off all
of the header blocks in the compressed image to get to the PNG
compressed image, and that _would_ be viewable in other applications
(like ImageMagick).

>I first imgcopy'd the file into my dataset, then I ran the
>decoder on the file.

I assume that you mean you run the compressor, area2png.

>I also tried it on other area files and it didn't
>work either.  Here's a reproduction of the commands I tried. First I added
>the local dataset UPRM/PR1KM with the "dsserve add" command, I had done
>that a couple of days ago and it worked fine.

This looks good.

>I had it save the images on
>that dataset into the AREA2149 file, just like in your last example.


>Then I copied the image into the data set imgcopy.k GINIEAST/GPR1KVIS

This looks good as well.

>I looked around for the area file, it was located in
>in ~/workdata. then I tried to convert it into png format
>~ldm/decoders/area2png -l - -f ~workdata/AREA2149 /path/to/backup/test.png
>I then copied that into a web accessable directory and I couldn't see the
>file, I also tried to see it with xv and I couldn't.

This is because the resultant compressed file is not a true PNG image.

>Finally, I tried
>ImageMagick's convert program to try and convert it into JPG, but it
>wouldn't recognize it as a valid image.

Same comment as above.

>I tried it with another png I had
>and all these other things worked.  The file exists and is pretty big,
>~1MB, other times it had been around 300k.  Am I doing something wrong or
>is Murphy playing tricks on me?

The only problem here is a misunderstanding of exactly what the output
of the area2png compression is.

As to the size of the compressed image, this will vary depending on how
complex the image is (i.e., how many clouds, etc.).

>-rw-r--r--   1 root     root      1056221 Aug 17 00:54 test.png
>I copied it into the webserver's directory as "root", but all the other
>commands were done as "mcidas".  I've tried it a couple of times but I
>just can't find what's wrong.

If you want to create rasters that are usable by web servers, then you
will need to display the image into a McIDAS frame and then use
FRMSAVE to save the image display into a suitable form.  FRMSAVE can
save into GIF (tm), JPEG, BMP, PPM, PS, and CPS).  See the online
help for FRMSAVE for more information:


Here is an example of what the display and save might look like:

<set needed McIDAS environment variables as per example scripts mcbatch.sh
and mcrun.sh>

mcenv -f address@hidden << 'EOF'
imgdisp.k UPRM/PR1KM.1 MAG=-2 REFRESH='EG;MAP H'
frmsave.k 1 test.jpg FORM=JPG

Please let me know if anything above does not make sense.


>From address@hidden Sun Aug 19 11:38:27 2001
>Subject: Re: 20010817: Problems at UPRM (cont.) 

   Once again thank you for your help.  Worked perfecty.  I couldn't see
any cloud cover on the JPG image, but surely it's that the original image
didn't have any.  I'll try with other images to see if it works.
   I imagined that the area2png decoder was doing something apart from
saving a normal png.  I thought that maybe it was using a modified png
format(but then it would be called something else, wouldn't it? =)).  It
makes perfect sense now, that png has the headers that are used when
converting back to AREA format with the png2area format, it wasn't
intended to be used for displaying with "xv" or any other programs of that
sort.  I think there's nothing else to be done except for
modifying/finishing the image saving script.  Thanks again for your help
and time.

Luis Munoz
System Administrator
Caribbean Climate Center @ UPRM

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.