;---------------------------------------------------------------------------------------; ; MSG_NATIVE2HDF.pro v1.0 ; ; *********************** ; ; ; ; Utilite : ; ; Permet la transfert des canaux MSG natif dans un fichier au format HDF. ; ; ; ; Utilisation : ; ; - Necessite l'installation prealable de la boite outils MSG (SPT Toolbox). ; ; (http://www.eumetsat.de/en/index.html?area=left7.html&body=/en/dps/ ; ; helpdesk/tools.html&a=760&b=1&c=700&d=700&e=0) ; ; - MSG_NATIF2HDF.pro doit etre copie dans le rpertoire ../source/ ; ; de la SPT Toolbox ; ; ; ; Limitations : ; ; - Sauvegarde uniquement les images VIS_IR (pas HRV) ; ; - Header non sauvegarde ; ; ; ; Auteur : ; ; ICARE/CGTD - F. Gabarrot ; ; ; ; Modifications : ; ; 22.02.04 : version 1.0 ; ;---------------------------------------------------------------------------------------; ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; Fonction MSG_NATIVE2HDF ; ; Transfert des canaux MSG natif dans un fichier au format HDF ; ; Input : ; ctx= Paramètres de configuration SPT Toolbox ; imgfile_input= nom complet du fichier natif en entree ; imgfile_output= nom complet du fichier hdf en sortie ; VBand= vecteur contenant l'indice des canaux souhaites ; VBandText= vecteur contenant le nom du canal ; disOnOff= parametre display au cours du processus (0:oui/1:non) ; ; Output : ; la fonction renvoie -1 en cas d'echec de creation du fichier hdf ; 0 si tout va bien ; ; Utilisation : ; VBand : ; VIS_06 : 0 ; VIS_08 : 1 ; IR_1_6 : 2 ; IR_3_9 : 3 ; IR_6_2 : 4 ; IR_7_3 : 5 ; IR_8_7 : 6 ; IR_9_7 : 7 ; IR_10_8 : 8 ; IR_12_0 : 9 ; IR_13_4 : 10 ; ;---------------------------------------------------------------------------------------- FUNCTION MSG_NATIVE2HDF, ctx, imgfile_input,imgfile_output,VBand,VBandText, disOnOff PRINT," " PRINT," " PRINT, "------------------------------------" PRINT, " MSG_NATIVE2HDF..." PRINT, "------------------------------------" PRINT," " ;PARAMETRES NECESSAIRES Dimgfile_output=ctx.OutputDir + imgfile_output Print,'Fichier de sortie :',Dimgfile_output Print," " st2=0 ;CREATION DU FICHIER HDF f_id=HDF_OPEN(Dimgfile_output,/ALL,/CREATE) IF (f_id eq -1) THEN BEGIN PRINT, "!!!!Erreur de creation du fichier HDF!!!!!" RETURN,-1 EXIT ENDIF ;PARAMETRES SUR LE NOMBRE DE BANDES taille=SIZE(VBand) imax=taille[1]-1 ;OUVERTURE INTERFACE SD SDinterface_id=HDF_SD_START(Dimgfile_output,/RDWR) FOR i=0,imax DO BEGIN ;LECTURE AU FORMAT NATIF BandID = VBand[i] PRINT, " " PRINT, "Bande : ",VBandText[i] PRINT,"------------------------" ;lecture header ;st1 = SPT_AC_READ_NATIVE_HEADER(ctx,imgfile,header) ;IF not (st1 eq 0) THEN BEGIN ; PRINT, "!!!!Erreur de lecture du header!!!!" ; RETURN,-1 ; EXIT ;ENDIF ;lecture image st1 = SPT_AC_READ_NATIVE_IMAGE(ctx,imgfile_input,BandID,image) ;COLUMN1=500,COLUMN2=1999,LINE1=1600,LINE2=3099) IF not (st1 eq 0) THEN BEGIN PRINT, "!!!!Erreur de lecture fichier natif!!!!" RETURN,-1 EXIT ENDIF ;VISUALISATION [optionnel] IF disOnOff eq 0 THEN st2 = SPT_DD_DISPLAY_IMAGE(ctx, image) IF not (st2 eq 0) THEN PRINT, "WARNING : !!!!Erreur d'affiche de l'image!!!!" ;ADAPTATION DE L'IMAGE image_data=ROTATE(image.IMG_data.data,3) image_data=REVERSE(image_data) ;PARAMETRES IMAGE type=HDF_IDL2HDFTYPE(SIZE(image_data,/type)) taille=SIZE(image_data) ; CREATION COUCHE SD SDdataset_id=HDF_SD_CREATE(SDinterface_id,VBandText[i],[taille[2],taille[1]],HDF_TYPE=type) HDF_SD_ADDDATA,SDdataset_id,image_data,/NOREVERSE HDF_SD_ENDACCESS,SDdataset_id ENDFOR ;FERMETURE DE L'INTERFACE SD HDF_SD_END,SDinterface_id ;FERMETURE DU FICHIER HDF HDF_CLOSE,f_id PRINT, " " PRINT, "-----------MSG_NATIVE2HDF END-------------------" RETURN,0 END ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; Fonction MSG_RAD2Temp ; ; Calcul de la temperature de brillance ; ; Input : ; image : tableau 2D contenant le canal IR MSG ; BandID : Identifiant du canal ; Output : ; MSG_RAD2TEMP retourne un tableau 2D contenant la temperature de brillance (K) ; ;---------------------------------------------------------------------------------------- FUNCTION MSG_RAD2TEMP, image, BandID print, " " print, "MSG_RAD2TEMP fonction....." ;PARAMETRES DE CONVERSION EN TEMPERATURE DE BRILLANCE c1=DOUBLE(0.0000119104) ;mWm-2sr-1 c2=DOUBLE(1.43877) ;K param=dindgen(11,4)*0.0-1.0 ;param: ; Numero du canal --- Frequence (cm-1) --- A (K) --- B (K) ; ---------------------------------------------------------------- ; 3 --- 2569.094 --- 0.9959 --- 3.471 (IR3.9) ; ---------------------------------------------------------------- ; 4 --- 1598.566 --- 0.9963 --- 2.219 (IR6.2) ; etc pour les canaux infrarouge jusqu'au IR13.4 ;remarque : les 3 premiers canaux (visible+pir) comporte -1 param[3,0]=3 param[3,1]=2569.094 param[3,2]=0.9959 param[3,3]=3.471 param[4,0]=4 param[4,1]=1598.566 param[4,2]=0.9963 param[4,3]=2.219 param[5,0]=5 param[5,1]=1362.142 param[5,2]=0.9991 param[5,3]=0.485 param[6,0]=6 param[6,1]=1149.083 param[6,2]=0.9996 param[6,3]=0.181 param[7,0]=7 param[7,1]=1034.345 param[7,2]=0.9999 param[7,3]=0.06 param[8,0]=8 param[8,1]=930.659 param[8,2]=0.9983 param[8,3]=0.627 param[9,0]=9 param[9,1]=839.661 param[9,2]=0.9988 param[9,3]=0.397 param[10,0]=10 param[10,1]=752.381 param[10,2]=0.9981 param[10,3]=0.576 if (param[BandID,0] eq -1.) then begin print, "!!! ERREUR : bande incorrecte (seulement IR)" RETURN,-1 exit endif QUOT=ALOG(c1*(param[BandID,1])^3/image+1.) T=(c2*param[BandID,1]/QUOT-param[BandID,3])/param[BandID,2] RETURN,T END