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

20051229: MODIS effective radius



------- Forwarded Message

        by unidata.ucar.edu (UCAR/Unidata) with ESMTP id jBTCXL7s009851;
        Thu, 29 Dec 2005 05:33:22 -0700 (MST)
Organization: UCAR/Unidata
X-ListServer: CommuniGate Pro LIST 4.2.9
List-Unsubscribe: <mailto:address@hidden>
List-ID: <mcidas-users.ssec.wisc.edu>
List-Archive: <https://ssec.wisc.edu:443/Lists/mcidas-users/List.html>
Message-ID: <address@hidden>
Sender: "McIDAS Users list" <address@hidden>
To: "McIDAS Users list" <address@hidden>
Precedence: list
X-Original-Message-ID: <address@hidden>
Date: Thu, 29 Dec 2005 12:31:49 +0000
From: "Miguel A. Martinez" <address@hidden>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: Re: MODIS effective radius

Dear Andrew:

        Several years ago I made one to convert values of TPW from MOD07
product for McIDAS version 7.8 using  (in current versions, we work with
McIDAS 2002d modified version don't work well). You will need to adapt
to your problem, but could give you an idea of the task to do. 

        The procedure is based on:
        a) From the MODIS hdf file extract a binary file for every field on the
hdf file using a binary converter. 

NOTE: I needed this because my version of PV-WAVE was old and not read
the HDF-EOS file properly, IF YOU HAVE IDL YOU CAN AVOID THIS PART AND
READ THE PARAMETERS DIRECTLY).

 I use the hdf2bin-solaris program downloaded from the web page with the
tools recommended on the MODIS web page
(http://modis-atmos.gsfc.nasa.gov -> TOOLS). As example if you have the
file MOD07_L2.A2000338.1810.002.2000359193958.hdf and run the program:
         hdf2bin-solaris MOD07_L2.A2000338.1810.002.2000359193958.hdf
you will obtain something like this:
SWATH_mod07_Tropopause_Height.dat
SWATH_mod07_Surface_Temperature.dat
SWATH_mod07_Surface_Pressure.dat
SWATH_mod07_Surface_Elevation.dat
SWATH_mod07_Solar_Zenith.dat
SWATH_mod07_Solar_Azimuth.dat
SWATH_mod07_Sensor_Zenith.dat
SWATH_mod07_Sensor_Azimuth.dat
SWATH_mod07_Scan_Start_Time.dat
SWATH_mod07_Processing_Flag.dat
SWATH_mod07_Pressure_Level.dat
SWATH_mod07_Longitude.dat
SWATH_mod07_Latitude.dat
SWATH_mod07_Guess_Temperature_Profile.dat
SWATH_mod07_Cloud_Mask.dat
SWATH_mod07_Brightness_Temperature.dat
SWATH_mod07_Band_Number.dat
SWATH_mod07_Retrieved_Temperature_Profile.dat
SWATH_mod07_Guess_Moisture_Profile.dat
SWATH_mod07_Water_Vapor_Low.dat
SWATH_mod07_Water_Vapor_High.dat
SWATH_mod07_Water_Vapor.dat
SWATH_mod07_Total_Totals.dat
SWATH_mod07_Total_Ozone.dat
SWATH_mod07_Retrieved_Moisture_Profile.dat
SWATH_mod07_Retrieved_Height_Profile.dat
SWATH_mod07_Quality_Assurance.dat
SWATH_mod07_Lifted_Index.dat
SWATH_mod07_K_Index.dat
SWATH_mod07_Quality_Assurance_Infrared.dat

Every SWATH_mod07*.dat file is a binary file. The dimensions and kind of
every field are in the output of the hdf2bin program; as example:
 int16  SWATH_mod07_Water_Vapor.dat
(Cell_Along_Swath=406,Cell_Across_Swath=270)
  Data type: signed 16-bit integer
  Number of Dimensions: 2
    Dim 1:  "Cell_Along_Swath" = 406
    Dim 2:  "Cell_Across_Swath" = 270

 int16  SWATH_mod07_Water_Vapor_Low.dat
(Cell_Along_Swath=406,Cell_Across_Swath=270)
  Data type: signed 16-bit integer
  Number of Dimensions: 2
    Dim 1:  "Cell_Along_Swath" = 406
    Dim 2:  "Cell_Across_Swath" = 270

 int16  SWATH_mod07_Water_Vapor_High.dat
(Cell_Along_Swath=406,Cell_Across_Swath=270)
  Data type: signed 16-bit integer
  Number of Dimensions: 2
    Dim 1:  "Cell_Along_Swath" = 406
    Dim 2:  "Cell_Across_Swath" = 270

        b) Once I have the binary files, with the Longitude, Latitude and the
desired dat files I have created some PV-WAVE (similar to IDL) programs
than they read the binary files and generate one McIDAS area file. The
program use an true MODIS McIDAS AREA file as pattern. The most
difficult it is to generate the navigation block (because the MODIS
navigation block it is constituted by matrix of data with the longitude
and latitude). The process of generation of the navigation block work
well in McIDAS7.8 but something it is bad in McIDAS2002d version; but I
think that you can adapt to your version.


Here are the PV-WAVE files (sorry because the comment are in Spanish but
I think that if you know WAVE or IDL, you can follow the procedure:

b.1) swatch2area. This procedure it is a launcher that I provide the
name of the MOD07 MODIS file and generates five AREAs with the
Water_Vapor, etc. The number of five AREAS begin in area_ini. 
On this procedure I open and read the longitude, latitude and the five
parameter to convert to area. The conversion to area is made on the call
to the hdf2area procedure (see bellow)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PRO swatch2area,prefijo,area_ini
; quitamos rotar de parametro PRO swatch2area,prefijo,area_ini,rotar


; WAVE Version 6.21 (solaris sparc)
; Journal File for tei@salsa
; Working directory: /export/home/tei/tango/swg/modis/edc
; Date: Wed Jul 31 15:33:47 2002

 
; leemos solo unos pocos
;SWATH_mod07_Lifted_Index.dat
;SWATH_mod07_Water_Vapor.dat
;SWATH_mod07_Water_Vapor_Direct.dat
;SWATH_mod07_Water_Vapor_High.dat
;SWATH_mod07_Water_Vapor_Low.dat

nombre=' '
s=dc_read_free('/export/home/tei/tango/rtt/edc/lista_parametros.txt',nombre,/resize)
numero=size(nombre,/nele)


; vamos a mandar cada uno a un area
fill=[-32768, -9999, -9999, -9999, -9999 ]


; hemos visto con jhv en vaguada cuales son los que estan mal (fill)
; las unidades para las WV son cm
; las unidades para lifted es k
; la escala para las WV es 0.001
; la escala para lifted es 0.01


; esperamos que prefijo se introduzca de fuera
;prefijo='/export/home/tei/tango/swg/modis/edc/A2002207.2135/'

; la idea es que en el directorio AYYYYJJJ.HHMM este los ficheros SWATCH
correspondientes
tokens=strsplit(prefijo,'/')
dia=tokens(size(tokens,/nele)-2)
        sdia=strmid(dia,4-1,5)
        shora=strmid(dia,10-1,4)+'00'

;area_ini=9991



; tenemos que leer lat y lon
lon=fltarr(270,406)
openr,unit,prefijo+'SWATH_mod07_Longitude.dat',/get_lun
        readu,unit,lon
        free_lun,unit
lat=fltarr(270,406)
openr,unit,prefijo+'SWATH_mod07_Latitude.dat',/get_lun
        readu,unit,lat
free_lun,unit

; si la latitud en fila 0 es menor que en fila 406 hay que rotar 2
rotar=0L
        t=dblarr(270,406)
                openr,unit,'SWATH_mod07_Scan_Start_Time.dat',/get_lun
                        readu,unit,t
                free_lun,unit
if ( t(0,1) lt t(0,406-1) ) then begin 
        rotar=2L
endif


lon=rotate(lon(0:268-1,*),rotar)
lat=rotate(lat(0:268-1,*),rotar)

eliminando_rayas_en_lonylat,lon,lat



; todos los parametros a validar son todas integer
hdf=intarr(270,406)

;SWATH_mod07_Lifted_Index.dat
;SWATH_mod07_Water_Vapor.dat
;SWATH_mod07_Water_Vapor_Direct.dat
;SWATH_mod07_Water_Vapor_High.dat
;SWATH_mod07_Water_Vapor_Low.dat

i=0
; signo es para si hay que invertir al escalar (solo lifted)
    signo    = [   -1.,      1,     1,     1,     1]
    factor   = [  0.01,   0.01,  0.01,  0.01,  0.01]
; minh y maxh tienen que ser iguales a los de nnhdf2area
;;; antes era 20 LI    minh     = [  -20.,     0.,    0.,    0.,    0.]
    minh     = [  -25.,     0.,    0.,    0.,    0.]
    maxh     = [   15.,    70.,   70.,   20.,   35.]
    num_ss   = [ 2505L,  2501L, 2502L, 2503L, 2504L]
; cambiamos los maximos para ajustarnos a lo que hay en cada parametro
SWAC
; antes tenia maxh  = [ 15.,  75., 75.,                 8., 35.]
;                  LI   WVmeta WVdire  WVhigh  WVlow
;           =LImod =TPWmo =TPWm  =HL        =BL
; las escalas de los WV son cm y multiplico por 0.01 para pasarlas a mm.
???

for i=0,numero-1 do begin
openr,unit,prefijo+nombre(i),/get_lun
        readu,unit,hdf
        free_lun,unit

        bien=where( hdf ne fill(i) )
        mal =where( hdf eq fill(i) )

; insertamos el path a hdf_2_area
!path=!path+':/export/home/tei/tango/rtt/edc/hdf_2_area'
;!path=!path+':/export/home/tei/tango/swg/modis/edc/hdf_2_area'

        ima=bytscl(hdf)
        ima(mal)=255B
        ima(bien)=8B+bytscl(signo(i)*hdf(bien)*factor(i)
,min=minh(i),max=maxh(i),top=120)
        ima=rotate( ima(0:268-1,*), rotar)
pm,'parametro=',i+1,min(hdf(bien)),max(hdf(bien))*factor(i)   
        hdf2area,1441,area_ini+i,ima,lon,lat,sdia, shora   
,ss=num_ss(i) 

endfor
return
end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


b.2) hdf2area. This procedure generates an McIDAS AREA file (with number
area_ini+i) with the matrix ima. It use lon, lat matrix to generate the
navigation blocks. 
The procedure made:
        -) look for an MODIS AREA file to be used as host
        -) open the host AREA and read the header and navigation
        -) With the data of our MODIS hdf matrix changes the header,
navigation, etc
        -) write the header, navigation and data in the desired AREA file

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PRO
hdf2area,area_fuente,area_destino,xhdf,xlon_hdf,xlat_hdf,yyddd,hhmmss,ss=num_ss

hdf=xhdf
lon_hdf=xlon_hdf
lat_hdf=xlat_hdf

; pasar un array asociativo con numero lineas, col, etc. como parametro

; Working directory: /export/home/tei/tango/swg/modis/esa/hdf_2_area
; Date: Fri Jun  7 09:07:06 2002

 
; !!!!!!! construir mas adelante entero sin AREA_FUENTE !!!!!!
; lo primero es traer el AREA huesped
; asumimos que area_fuente esta en vaguada
nombre_area=
strcompress('AREA'+string(area_fuente,format='(I4.4)'),/remove_all)
        spawn,'cp $HOME/mcidas/data/'+nombre_area+' . '

; empezamos a leer y a ir cambiando la cabecera
; leemos la cabecera
openr,unit,nombre_area,/get_lun
        header=lonarr(64)
                readu,unit,header

; en header 2 copiamos el header de AREA fuente    
header2=header

; word 3: ponemos el numero de ss para saber que parametro es la imagen
     header2(3-1)=long(num_ss)

; word 4:  YYYDDD  nuestra imagen es del 14 de agosto(8) de 2001
;     (ver journal ==> poniendo_fecha_0) 
     header2(4-1)=long('1'+yyddd)
;pm,'cambio en palabra 4 = ',header(4-1),' <== por  ==>',header2(4-1),'
<<<'


; word 5:  hhmmss nominales   nuestra imagen es 9:59:08.84
    header2(5-1)= long(hhmmss)
;pm,'cambio en palabra 5 = ',header(5-1),' <== por  ==>',header2(5-1),'
<<<'


; word 6: upperleft image line
; construccion de la posicion de nuestro caso
; creo que la resolucion 1 es de 250m. como esta imagen es de 1Km. 
;     resolucion_lonlat es la proporcion de LONLAT frente linele
;        y como son de 1km multiplico por 1000/250=4
  header2(6-1)=1L
;pm,'cambio en palabra 6 = ',header(6-1),' <== por  ==>',header2(6-1),'
<<<'

; word 9: numero lineas
 header2(9-1)= 406
;pm,'cambio en palabra 9 = ',header(9-1),' <== por  ==>',header2(9-1),'
<<<'

; word 10: numero elementos
;        1356
; en este caso deberian ser 1354 pero el Save as HDF dejan en 1350
;pm,1350 mod 4
;       2
;pm,(1350/4)*4
;    1348
; duda que pongo 1348, 1350, 1352, 1354, 1356
   header2(10-1)= (270L/4L)*4L
;pm,'cambio en palabra 10 = ',header(10-1),' <== por 
==>',header2(10-1),' <<<'

; cambio la resolucion a la que tengo aqui (una de cada 4)
   header2(12-1)= 4*5L
   header2(13-1)= 4*5L

; word 33: reservadas
;        1441
; debo poner aqui el numero de AREA que creo ???
   header2(33-1) = area_destino
;pm,'cambio en palabra 33 = ',header(33-1),' <== por 
==>',header2(33-1),' <<<'


; word 34: byte offset to the start  de data block
;     2202804
;      cambiar luego cuando calculo lo que ocupan ahora mi LONLAT +
ofsets
; AREA_MODIS=
directorio(64*4)+navegacion(128*4)+calibracion_brillo?(128*4)+aux_lat(24)+lat(lalo_size*4)+aux_lon(28)+lon(lalo_size*4)
  
  header2(34-1) = 64L*4L + 128L*4L + 128L*4L +24L+ size(lon_hdf,/nele)*4
+ 28L + size(lat_hdf,/nele)*4 
;pm,'cambio en palabra 34 = ',header(34-1),' <== por 
==>',header2(34-1),' <<<'

; word 64: numero de coments cards
;           1
; ponemos word 64: numero de coments cards = 0 para no tener que
escribir comentarios
 header2(64-1)=0
;pm,'cambio en palabra 64 = ',header(64-1),' <== por 
==>',header2(64-1),' <<<'


; luego bloque de navegacion empieza en  word 35==>256bytes y finaliza
en principio bloque calibracion (word 63: byte offset al bloque de
calibracion =768)
tama_nav=header(63-1)-header(35-1)
;         512
;pm,tama_nav/4
;         128
; luego array NAV es un lonarr de tama_nav/4

navegacion= lonarr( tama_nav/4)
        readu,unit,navegacion

; !!!!!! hacer mas adelante pasando de area fuente !!!!!!
; en navegacion2 copiamos navegacion de AREA fuente    
navegacion2= navegacion


; del fichero de navegacion lalo (nvxlalo.dlm) parte de nvxini puede
verse que son importantes las siguientes palabras


; las palabras 3 a la 65 varian depediendo de la fuente 
; para tipo 'AREA' son:
; word_nav 3:  area numero (int)
;        1441
; cambiar por el numero de area que construyamos
    navegacion2(3-1)= area_destino 
;pm,'cambio en nav 3 = ',navegacion( 3-1),' <== por  ==>',navegacion2(
3-1),' <<<'


; word_nav 66: numero de lineas de la imagen de LAT y LON
; en nuestro caso cambiar por 202
    navegacion2(66-1)= 406          
;pm,'cambio en nav 66 = ',navegacion( 66-1),' <== por  ==>',navegacion2(
66-1),' <<<'


; word_nav 67: numero de columnas de la imagen de LAT y LON
; (en nuestro caso son 271)
;   navegacion2(67-1)= 270        
    navegacion2(67-1)= 268        
;pm,'cambio en nav 67 = ',navegacion( 67-1),' <== por  ==>',navegacion2(
67-1),' <<<'

; a continuacion viene palabras que son float*4 (he investigado como
hacer truco equivalence FORTRAN)
;       la sentencia resultado_en_float= float(
expr_en_bytes_o_cualquiera, offset) y poner ofsset =0 permite
interpretar como float
; word_nav 68 69: minima lon y lat (en real)  
;!!!!!!!! parece que aqui el W es negativo y no positivo como es usual
en McIDAS $$$$$$$$$
;pm, float(navegacion(68-1)  ,0)
;      17.5169
;pm, float(navegacion(69-1)  ,0)
;     -92.9020
             navegacion2( 68-1) = long( min(lat_hdf) ,0)
;pm,'cambio en nav 68 (minlat)= ',float( navegacion( 68-1) ,0) ,' <==
por  ==>', float( navegacion2( 68-1) ,0) ,' <<<'
             navegacion2( 69-1) = long( min(lon_hdf) ,0)
;pm,'cambio en nav 69 (minlon)= ',float( navegacion( 69-1) ,0) ,' <==
por  ==>', float( navegacion2( 69-1) ,0) ,' <<<'

; word_nav 70 71: maxima lon y lat (en real)  
;!!!!!!!! parece que aqui el W es negativo y no positivo como es usual
en McIDAS $$$$$$$$$
;pm, float(navegacion(70-1)  ,0)
;      64.9977
;pm, float(navegacion(71-1)  ,0)
;     -45.7858
             navegacion2( 70-1) = long( max(lat_hdf) ,0)
;pm,'cambio en nav 70 (maxlat)= ',float( navegacion( 70-1) ,0) ,' <==
por  ==>', float( navegacion2( 70-1) ,0) ,' <<<'
             navegacion2( 71-1) = long( max(lon_hdf) ,0)
;pm,'cambio en nav 71 (maxlon)= ',float( navegacion( 71-1) ,0) ,' <==
por  ==>', float( navegacion2( 71-1) ,0) ,' <<<'


; el problema inverso de escribir las palabras 68-71 (minimos, maximos
como float binarios)
; se puede resolver de la siguiente forma
;          supongamos   g=50.0 y queremos escrbirlo en navegacion( xx-1)
;g=50.0
;pm,g
;      50.0000
;navegacion(xx-1) =long(g,0)
;pm,lg
;  1112014848

; luego esta la manera de leer y convertir como si equivalence






; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; !!!!! ESTO ESTA MAL EN LOS COMENTARIOS DE NVXLALO !!!!!!!!!!!
; !!!!! word_nav 74 : puntero en bytes a los ficheros de LAT
; !!!!! pm, navegacion(74 -1)  
; !!!!!   512
; !!!!! word_nav 75 : puntero en bytes a los ficheros de LON
; !!!!!    pm, navegacion(75 -1)  
; !!!!!    1101248
; a pesar que usa palabras 81 y 82 en area hay que poner 74 y 75 para
cuando envia navegacion FRAME
;  la palabra 74 es el tamano bloque navegacion (investigado en
modsaget.cp)
        navegacion2( 74-1)= 128L*4L
;  la palabra 75 es =74 mas tamano lalo_size    (investigado en
modsaget.cp)
        navegacion2( 75-1)= 128L*4L + navegacion2(66-1)*navegacion2(67-1)*4L
; para corregir problemas con imgremap pongo ulllon y ulllat
;       navegacion2( 76-1) = long( lat_hdf(0,0) ,0)
;       navegacion2( 77-1) = long( lon_hdf(0,0) ,0)

; la palabra 78-1 es diferencia entre el offset de datos y el offset del
bloque auxliar(1280)
         navegacion2( 78-1)= header2(34-1) - header2(60-1)
; navegacion 79-1 es tamano bloque auxiliar lat que es de 24
         navegacion2(79-1)= 24L
; navegacion(80-1) nav(78-1)+lalo_size+28   (donde 28 es el tamano
bloque auxiliar longitud)
         navegacion2( 80-1)= navegacion2( 79-1)+
navegacion2(66-1)*navegacion2(67-1)*4L + 28L

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; !!!!! ESTO ESTA MAL EN LOS COMENTARIOS DE NVXLALO !!!!!!!!!!!
; !!!!! word_nav 80-128: sin usar 
; de la experiencia se deduce que:
; word_nav 81: es el byte offset global a los datos de LON  
; word_nav 82: es el byte offset global a los datos de LAT 
; ver luego la lectura

; vamos a construir los punteros a lon_hdf y lat_hdf
    
; ponemos los offsets globales bien   
    navegacion2( 81-1) = 64L*4L + 128L*4L + 128L*4L +24L 
    navegacion2( 82-1) = 64L*4L + 128L*4L + 128L*4L +24L+
size(lon_hdf,/nele)*4 + 28L  

;vamos a construir ahora los bloques auxiliares de navegacion
; construimos aux_lat
        laux_lat =lonarr(24/4 )
; la primera palabra es un numero magico
        laux_lat(0)= long([04B,03B,02B,01B],0,1)
; siguiente es tamano aux_lat + lalo_size
        laux_lat(1)= 24L + size(lon_hdf,/nele)*4
; siguiente es 8                          
        laux_lat(2)= 8                             
; siguiente es tamano lalo_size
        laux_lat(3)=  size(lon_hdf,/nele)*4
; siguiente es la palabra "LATITUDE" 
        laux_lat(4)= long(byte("LATI"),0,1) 
        laux_lat(5)= long(byte("TUDE"),0,1) 
; ahora hay que darle la vuelta a todos los bytes (parece que esto es lo
que se envia para dibujar mapas
        aux_lat= darle_vuelta(laux_lat,6)

; construimos aux_lon
        laux_lon =lonarr(28/4 )
; la primera palabra es un numero magico
        laux_lon(0)= long([04B,03B,02B,01B],0,1)
; siguiente es tamano aux_lon + lalo_size
        laux_lon(1)= 28L + size(lon_hdf,/nele)*4
; siguiente es 12                         
        laux_lon(2)=12                             
; siguiente es tamano lalo_size
        laux_lon(3)=  size(lon_hdf,/nele)*4
; siguientes palabras son "LONGITUDE    "
        laux_lon(4)= long(byte("LONG"),0,1) 
        laux_lon(5)= long(byte("ITUD"),0,1) 
        laux_lon(6)= long(byte("E   "),0,1) 
; ahora hay que darle la vuelta a todos los bytes (parece que esto es lo
que se envia para dibujar mapas
        aux_lon= darle_vuelta(laux_lon,7)



; BLOQUE CALIBRACION
; lectura parametros de calibracion aunque parece para BRIT son todos
cero
calibracion=lonarr(512/4)
 readu,unit,calibracion
info,calibracion
;pm,(64+128)*4
;     768
;pm,(64+128+128)*4
;    1280
; luego creo bloque calibracion son 128 palabras =512 bytes
;for i=1,128 do begin pm,i,calibracion(i-1),lon2clit( calibracion(i-1))
; el bloque de calibracion al ser BRIT es todo cero (todas las 128
palabras del bloque de calibracion son cero


; como vimos en la palabra 61 del header no hay bloque suplementario



; cerramos unit
free_lun,unit

; escribir un area
; construimos nombre area destino
nombre_area=
strcompress('AREA'+string(area_destino,format='(I4.4)'),/remove_all)
        openw,unit,nombre_area,/get_lun



; escribo header2
writeu,unit,header2

; escribo navegacion2
writeu,unit,navegacion2

; escribo calibracion
writeu,unit,calibracion

; escribo bloque auxiliar_lat
writeu,unit,aux_lat      

; escribo lat_hdf      
writeu,unit,lat_hdf      


; escribo bloque auxiliar_lon
writeu,unit,aux_lon      

; escribo lon_hdf      
writeu,unit,lon_hdf      

; escribo hdf      
hdf=hdf(0:header2( 10-1) -1, *)
n_hdf= size(hdf,/nele) & p1=header2(34-1)    & p2= p1+n_hdf   
        hdf=reform(hdf, n_hdf     )
writeu,unit,hdf

free_lun,unit


return
end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


b.3) Needed auxiliary functions and routines.

mi_swyt4 change the order on the bytes on a 4bytes's word
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FUNCTION  mi_swyt4,palabra

bytes= byte( palabra, 0L, 4)


reves=indgen(4)-1

bytes_reves=bytes( reves)
 palabra_reves= long(bytes_reves,0,1)
return,palabra_reves
end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


darle_vuelta change the order on the bytes on several words (the number
it is numero)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FUNCTION darle_vuelta,datos_lon,numero

; ejemplo llamada        aux_lat= darle_vuelta(laux_lat,6)

for i=0L,numero-1L do begin 
     palabra= datos_lon(i)
     datos_lon(i)= mi_swyt4( palabra  )
endfor


return,datos_lon
end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


an auxiliary routine that filter the pixel with value -9999 on longitude
and latitude matrix
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PRO eliminando_rayas_en_lonylat,lon,lat
; el objetivo es eliminar los -999 que aparecen en algunos ficheros de
lon y lat

; construimos array para almacenar los minimos de cada linea
; y buscamos el minimo de cada linea
min_latlon=fltarr( size(lat(0,*),/nele) )
for i=0,size(lat(0,*),/nele) -1L do begin
        min_latlon(i)= min( [lat(*,i),lon(*,i)] ) 
endfor

aux_lineas_mal=where( min_latlon lt -360.0 ,count)
if (count gt 0 and count lt size(min_latlon,/nele) ) then begin
        lineas_mal = aux_lineas_mal
        lineas_bien=where( min_latlon gt -360.0)

        if (lineas_mal(0) eq 0) then begin
                lon(*,0) = lon(*,lineas_bien(*,0))
                lat(*,0) = lat(*,lineas_bien(*,0))
                lineas_mal=lineas_mal(1:size(lineas_mal,/nele)-1L) 
        endif
        if (lineas_mal(size(lineas_mal,/nele)-1L) eq
size(lat(0,*),/nele)-1L ) then begin
                lon(*,size(lat(0,*),/nele)-1L) =
lon(*,lineas_bien(*,size(lineas_bien,/nele)-1L))
                lat(*,size(lat(0,*),/nele)-1L) =
lat(*,lineas_bien(*,size(lineas_bien,/nele)-1L))
                lineas_mal=lineas_mal(0:size(lineas_mal,/nele)-2L) 
        endif
        for i=0,size( lineas_mal ,/nele)-1 do begin 
                aux_a=where( lineas_mal(i) lt lineas_bien  ,count)
                if ( count gt 0 ) then begin
                a=aux_a
                lon(*,lineas_mal(i)) = lon(*,lineas_bien(a(0)-1))+ $
                        (lineas_mal(i)-lineas_bien(a(0)-1)) * $
                        
(lon(*,lineas_bien(a(0)))-lon(*,lineas_bien(a(0)-1))) / $
                                (lineas_bien(a(0))-lineas_bien(a(0)-1))
                lat(*,lineas_mal(i)) = lat(*,lineas_bien(a(0)-1))+ $
                        (lineas_mal(i)-lineas_bien(a(0)-1)) * $
                        
(lat(*,lineas_bien(a(0)))-lat(*,lineas_bien(a(0)-1))) / $
                                (lineas_bien(a(0))-lineas_bien(a(0)-1))
                endif
        endfor

endif
return
end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


If you need more information, or example could contact with me.



Andrew Tupper wrote:
> 
> Hi all,
> 
> Can anybody please tell me how to convert the raw values in band 49
> (particle effective radius) of the MODIS level 6 product to real values
> (0-58 um) in McIDAS?
> 
> thanks and regards,
> 
> Andrew Tupper
> Senior Meteorologist
> Darwin Volcanic Ash Advisory Centre
> Bureau of Meteorology, Australia
> Mobile / Cell Phone: + 61 (0)418-110182
> Phone: +61 8 8920 3867
> http://www.bom.gov.au/info/vaac
> 
> #############################################################
> This message is sent to you because you are subscribed to
>   the mailing list <address@hidden>.
> To unsubscribe, E-mail to: <address@hidden>
> To switch to the DIGEST mode, E-mail to <address@hidden>
> To switch to the INDEX mode, E-mail to <address@hidden>
> Send administrative queries to  <address@hidden>

- -- 
Dr. Miguel A. Martinez Rubio 
  Jefe Unidad Satelites. Servicio de Teledeteccion
  Instituto Nacional de Meteorologia (I.N.M.). Madrid. SPAIN
  e-mail: address@hidden  Tfno: +34 91 5819 662 
                      Fax:  +34 91 5819 846

#############################################################
This message is sent to you because you are subscribed to
  the mailing list <address@hidden>.
To unsubscribe, E-mail to: <address@hidden>
To switch to the DIGEST mode, E-mail to <address@hidden>
To switch to the INDEX mode, E-mail to <address@hidden>
Send administrative queries to  <address@hidden>


------- End of Forwarded Message