Changeset 142 for trunk/SRC/ToBeReviewed/LECTURE/ncdf_lec.pro
- Timestamp:
- 07/21/06 14:47:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/LECTURE/ncdf_lec.pro
r134 r142 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:ncdflec6 5 ; 7 ; PURPOSE:donne des infos sur un fichier netcdf et permet de recupere 8 ; les variables qui y sont ecrites 6 ; @file_comments 7 ; Give informations on a file net cdf and allows to recuperate 8 ; variables which are write in. 9 9 ; 10 ; CATEGORY:lecture de fichiers netcdf 10 ; @categories 11 ; Reading 11 12 ; 12 ; CALLING SEQUENCE: res=ncdflec('nom_de _fichier') 13 ; @param NOM {in}{required} 14 ; Name of a file net cdf situated in the directory stipulated by iodir. 13 15 ; 14 ; INPUTS:nom_de _fichier:nom d'un fichier net cdf situe ds e repertoire 15 ; stipule par iodir 16 ; @keyword ATT 17 ; 'global' or at the name of a variable. Allows to see all attributes 18 ; joined at a variable 16 19 ; 17 ; KEYWORD PARAMETERS: 20 ; @keyword DIM 21 ; Give the list of dimensions. 18 22 ; 19 ; ATT: 'global' ou au nom d'une variable. permet de voir tous les 20 ; attributs rattaches a une variable. 23 ; @keyword VAR 24 ; 1) /var: Gove the list of dimensions. 25 ; 2) var='nom de variable': in this case the function send back the variable. 21 26 ; 22 ; /DIM:donne la liste des dimensions 27 ; @keyword IODIR 28 ; String containing the directory containing the file to be read 23 29 ; 24 ; VAR:25 ; 1) /var: donne la liste des variables26 ; 2) var='nom de variable': ds ce cas la fonction retourne la variable30 ; @keyword _EXTRA 31 ; Allows to pass keywords defined by IDL to functions NETCDF ( particularly OFFSET 32 ; and COUNT in ncdf_varget) 27 33 ; 28 ; IODIR: string contenant le repertoire ou aller chercher le29 ; fichier a lire.34 ; @returns 35 ; -1 (exept if var='nom de variable', then the function send back the variable). 30 36 ; 31 ; _EXTRA: permet de passer les mots cles definits par IDL pour 32 ; les fonction NETCDF (en particulier OFFSET et COUNT ds ncdf_varget) 37 ; @restrictions 38 ; Variables's names of the program are similar to these used by the IDL manual 39 ; 'scientific data formats' 33 40 ; 34 ; OUTPUTS:-1 sauf si var='nom de variable' auquel cas la fonction retourne la variable 41 ; @history 42 ; Sebastien Masson (smasson@lodyc.jussieu.fr) 43 ; 4/1/98 35 44 ; 36 ; REMARQUE:les noms des variables du programme sont similaires a ceux employes37 ; ds le manuel IDL 'scientific data formats'45 ; @version 46 ; $Id$ 38 47 ; 39 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)40 ; 4/1/9841 48 ;- 42 49 ;------------------------------------------------------------ … … 57 64 endif 58 65 ;------------------------------------------------------------ 59 ; o uverture du fichier nom66 ; opening of the file name. 60 67 ;------------------------------------------------------------ 61 68 cdfid=ncdf_open(iodir+nom) 62 69 ;------------------------------------------------------------ 63 ; que contient le fichier??70 ; Wht does the file contain?? 64 71 ;------------------------------------------------------------ 65 72 wathinside=ncdf_inquire(cdfid) 66 ; print,' dans le fichier, ',iodir+nom,', il y a:'73 ; print,'in the file, ',iodir+nom,', there are:' 67 74 if keyword_set(dim) then begin 68 75 print,'nombre de dimensions: ',strtrim(wathinside.ndims,1) … … 76 83 endif 77 84 ;------------------------------------------------------------ 78 ; attributs globaux85 ; Global attributes 79 86 ;------------------------------------------------------------ 80 87 if keyword_set(att) then begin … … 82 89 print,'ATTRIBUTS GLOBAUX' 83 90 for attiq=0,wathinside.ngatts-1 do begin 84 name=ncdf_attname(cdfid,attiq,/global) ; nom de l''atribut85 ncdf_attget,cdfid,name,value,/global ; valeur de l''atribut91 name=ncdf_attname(cdfid,attiq,/global) ;attribute's name 92 ncdf_attget,cdfid,name,value,/global ;attribute's value 86 93 print,name,': ',string(value) 87 94 endfor … … 89 96 nonglobal: 90 97 ;------------------------------------------------------------ 91 ; affichage des differentes dimensions98 ; Display of different dimensions. 92 99 ;------------------------------------------------------------ 93 100 if keyword_set(dim) then begin … … 98 105 tailledim=lonarr(wathinside.ndims) 99 106 for dimiq=0,wathinside.ndims-1 do begin 100 ncdf_diminq,cdfid,dimiq,name,value ; nom et valeur de la dimension107 ncdf_diminq,cdfid,dimiq,name,value ; dimension's name and value 101 108 nomdim[dimiq]=name 102 109 tailledim[dimiq]=value … … 107 114 endfor 108 115 ;------------------------------------------------------------ 109 ; affichage des differentes variables116 ; Display of different variables. 110 117 ;------------------------------------------------------------ 111 118 ; 112 119 if keyword_set(att) or keyword_set(var) then begin 113 ; va ture de var ? string ou1120 ; var's value? string or 1 114 121 help, var, output = nature 115 122 if (strpos(nature, 'STRING'))[0] NE -1 then nature = 'string' ELSE nature = '1' 116 ; si on doit juste lire la variable123 ; If we just have to read the variable. 117 124 if nature EQ 'string' then begin 118 125 ncdf_varget, cdfid, var, res, _extra = ex 119 126 GOTO, sortie 120 127 ENDIF 121 ; si c''est pour avoir des renseignements128 ; If it is to have pieces of information. 122 129 if not keyword_set(att) then att='rien' 123 130 print, '----------------------------' 124 131 for varid=0,wathinside.nvars-1 do begin 125 varcontent=ncdf_varinq(cdfid,varid) ; que contient la variable132 varcontent=ncdf_varinq(cdfid,varid) ; What does variable contain?? 126 133 if strlowcase(att) eq strlowcase(varcontent.name) or keyword_set(var) $ 127 134 then begin
Note: See TracChangeset
for help on using the changeset viewer.