A freely distributed grid data analysis system, GrADS, may be obtained from the GrADS Home Page.
#!/bin/csh
touch sh.980924IR1.bin
foreach i ( 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 )
if ("2414" != $i && "2415" != $i ) then
rcp nimbus:/www/Public/sat/GAME/1998/Sep/IR1/GMS59809${i}IR1.pgm.gz .
zcat GMS59809${i}IR1.pgm.gz | pnmcut 1240 700 80 60 > sh.9809${i}IR1.pgm
rm GMS59809${i}IR1.pgm.gz
rcp nimbus:/www/Public/sat/GAME/1998/Sep/CAL/GMS59809${i}CAL.dat.gz .
zcat GMS59809${i}CAL.dat.gz | awk -F: '/IR1 Temperature/ {print $2}' > GMS59809${i}CAL-IR1.dat
./pgm2bin GMS59809${i}CAL-IR1.dat sh.9809${i}IR1.pgm >> sh.980924IR1.bin
rm GMS59809${i}CAL-IR1.dat GMS59809${i}CAL.dat.gz sh.9809${i}IR1.pgm
else
./undef >> sh.980924IR1.bin
endif
end
And, please do not forget to make the CAL data.
boreas% grads -l Grid Analysis and Display System (GrADS) Version 1.7Beta9 Copyright (c) 1988-1997 by Brian Doty Center for Ocean-Land-Atmosphere Studies Institute for Global Environment and Society All Rights Reserved Config: v1.7Beta9 32-bit big-endian readline sdf/xdf hdf-sds lats athena im/image-output Issue 'q config' command for more information. GX Package Initialization: Size = 11 8.5 ga-> open shbin.ctl Scanning description file: shbin.ctl Data file sh.980924IR1.bin is open as file 1 LON set to 132 135.95 LAT set to 32 34.95 LEV set to 1 1 Time values set: 1998:9:24:0 1998:9:24:0 ga-> set time 0z24sep1998 23z24sep1998 Time values set: 1998:9:24:0 1998:9:24:23 ga-> set lon 133.5 133.5 LON set to 133.5 133.5 ga-> d tbb Contouring: -60 to 20 interval 10
fgets(buf,80,fp); /* skip P5 */
fgets(buf,80,fp); /* skip comment */
fgets(buf,80,fp); /* read a line with width & height */
sscanf(buf,"%d %d",&width,&height);
fgets(buf,80,fp); /* skip 255 */
/* next comes raw byte stream */
for (y=0; y<height; y++) {
for (x=0; x<width; x++) {
data[y][x] = fgetc(fp);
}
}
Note that you must tackle with the libp?m in the netpbm package
if you care more on the PGM format variations.
pnmtorast GMSxxx.pgm | rasttopnm > GMSxxx-tmp.pgm