[2] | 1 | ;+ |
---|
[232] | 2 | ; |
---|
[127] | 3 | ; @file_comments |
---|
| 4 | ; lit les series temporelles se rapportant a une variable |
---|
[118] | 5 | ; sur maia: /u/rech/eee/reee217/TOTEM/REF/OUTPUTS |
---|
[127] | 6 | ; |
---|
[97] | 7 | ; @obsolete |
---|
[2] | 8 | ; |
---|
[231] | 9 | ; @categories |
---|
[157] | 10 | ; Reading |
---|
[2] | 11 | ; |
---|
[118] | 12 | ; @examples |
---|
[97] | 13 | ; IDL> res=nlecserie(nom, date1, date2) |
---|
[2] | 14 | ; |
---|
[231] | 15 | ; @param nom {in}{required} |
---|
| 16 | ; nom du tableau contenant le champ que l'on veut (le |
---|
[2] | 17 | ; trouver avec ncdflec,fichier,/var |
---|
| 18 | ; |
---|
[231] | 19 | ; @param date1 {in}{required} |
---|
| 20 | ; @param date2 {in}{required} |
---|
[127] | 21 | ; les dates vermairs qui delimitent la serie temporelle |
---|
[2] | 22 | ; |
---|
[231] | 23 | ; @keyword BOITE |
---|
| 24 | ; boite sur laquelle integrer (par defaut tt le domaine) |
---|
[2] | 25 | ; |
---|
[231] | 26 | ; @keyword GRILLE |
---|
| 27 | ; impose la grille a laquelle est rapporte le champ. rq permet |
---|
[118] | 28 | ; d'aller plus vite ds la lecture |
---|
[2] | 29 | ; |
---|
[231] | 30 | ; @keyword TOUT |
---|
[254] | 31 | ; oblige a lire le tableau entier en non pas celui reduit a <pro>domdef</pro> |
---|
[2] | 32 | ; |
---|
[231] | 33 | ; @keyword _EXTRA |
---|
| 34 | ; Used to pass keywords |
---|
[118] | 35 | ; |
---|
[231] | 36 | ; @returns |
---|
| 37 | ; tableau 2d (qd la serie ne fait que 1 pas de temps) ou |
---|
[2] | 38 | ; 3d (valable ds 1 premier tps que pour les tableaux 2d) |
---|
[118] | 39 | ; |
---|
[231] | 40 | ; @uses |
---|
| 41 | ; common.pro |
---|
[2] | 42 | ; |
---|
[231] | 43 | ; @restrictions |
---|
| 44 | ; appele par <pro>nlec</pro> |
---|
[2] | 45 | ; |
---|
[231] | 46 | ; @history |
---|
| 47 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[2] | 48 | ; |
---|
[231] | 49 | ; @version |
---|
| 50 | ; $Id$ |
---|
[118] | 51 | ; |
---|
[2] | 52 | ;- |
---|
| 53 | ;------------------------------------------------------------ |
---|
| 54 | ;------------------------------------------------------------ |
---|
| 55 | ;REF.sss.grid.T.nc |
---|
| 56 | ;------------------------------------------------------------ |
---|
[231] | 57 | ; |
---|
[2] | 58 | function nlecserie, nom, date1, date2,BOITE = boite, GRILLE=grille,TOUT=tout, _EXTRA = ex |
---|
[114] | 59 | ; |
---|
| 60 | compile_opt idl2, strictarrsubs, obsolete |
---|
| 61 | ; |
---|
[2] | 62 | @common |
---|
| 63 | ;------------------------------------------------------------ |
---|
| 64 | ;------------------------------------------------------------ |
---|
| 65 | res=-1 |
---|
| 66 | anneedepart=1979 |
---|
| 67 | ;------------------------------------------------------------ |
---|
| 68 | ; gestion du nom de la grille |
---|
| 69 | ; et ouverture du fichier |
---|
| 70 | ;------------------------------------------------------------ |
---|
| 71 | ; liste des fichiers pouvant convenir |
---|
| 72 | quelsfichiers = findfile(iodir+prefix+'.'+nom+'.grid.*') |
---|
| 73 | IF quelsfichiers[0] EQ '' THEN BEGIN ; liste vide |
---|
| 74 | ; print, 'LES FICHIERS: '+iodir+prefix+'.'+nom+'.grid... n''existe pas.' |
---|
| 75 | return, -1 |
---|
[118] | 76 | ENDIF ELSE BEGIN |
---|
[2] | 77 | vargrid=strmid(quelsfichiers[0],strpos(quelsfichiers[0],'grid')+5,1) ;nom de grille |
---|
[44] | 78 | IF !version.OS_FAMILY EQ 'unix' THEN spawn, '\file '+quelsfichiers[0]+' > /dev/null' |
---|
[2] | 79 | cdfid=ncdf_open(quelsfichiers[0]) |
---|
[118] | 80 | ENDELSE |
---|
[2] | 81 | ;------------------------------------------------------------ |
---|
| 82 | ; lecture de certains attributs et de l'axe des temps |
---|
| 83 | ;------------------------------------------------------------ |
---|
| 84 | ncdf_attget,cdfid,nom,'title',value |
---|
| 85 | varname=string(value) |
---|
| 86 | ncdf_attget,cdfid,nom,'units',value |
---|
| 87 | varunit=string(value) |
---|
| 88 | if rstrpos(varname,'(') eq -1 then varname=varname+' ('+varunit+')' |
---|
| 89 | ncdf_attget,cdfid,'file_name',value,/global |
---|
| 90 | varexp=string(value) |
---|
| 91 | varexp=strmid(varexp, 0, strpos(varexp, '.')) |
---|
| 92 | ;------------------------------------------------------------ |
---|
| 93 | ; lecture de l'axe des temps en entier on ja reperer la place des |
---|
| 94 | ; dates debut et fin pour faire l''extraction temporelle |
---|
| 95 | ;------------------------------------------------------------ |
---|
| 96 | ncdf_varget,cdfid,'time_counter',time |
---|
| 97 | time = long(time)+julday(1, 5, 1979) |
---|
| 98 | ; debut = where(time EQ juldate(date1)) |
---|
| 99 | ; fin = where(time EQ juldate(date2)) |
---|
| 100 | debut = where(time EQ date1) |
---|
| 101 | fin = where(time EQ date2) |
---|
| 102 | if debut[0] EQ -1 then $ |
---|
| 103 | return, report('l''axe des temps ne contient pas la date de debut '+strtrim(date1, 1)) |
---|
| 104 | if fin[0] EQ -1 then $ |
---|
| 105 | return, report('l''axe des temps ne contient pas la date de fin '+strtrim(date2, 1)) |
---|
| 106 | time = time[debut[0]:fin[0]] |
---|
| 107 | jpt=fin[0]-debut[0]+1 |
---|
| 108 | IF jpt EQ 1 THEN BEGIN |
---|
| 109 | caldat, time[0], month, day, year |
---|
| 110 | case 1 of |
---|
| 111 | year lt 10: s_year ='0'+string(format='(i1)',year) |
---|
| 112 | year lt 100 and year ge 10 :s_year = string(format='(i2)',year) |
---|
| 113 | year ge 100: s_year = string(format='(i2)',year-1900) |
---|
| 114 | endcase |
---|
| 115 | if month lt 10 then s_month='0'+string(format='(i1)',month) $ |
---|
| 116 | else s_month= string(format='(i2)',month) |
---|
| 117 | if day lt 10 then s_day='0'+string(format='(i1)',day) $ |
---|
| 118 | else s_day= string(format='(i2)',day) |
---|
| 119 | vardate=s_year+s_month+s_day |
---|
| 120 | endif |
---|
| 121 | ;------------------------------------------------------------ |
---|
| 122 | ;------------------------------------------------------------ |
---|
| 123 | ; extraction du tableau qui nous interesse |
---|
| 124 | ;------------------------------------------------------------ |
---|
| 125 | ;------------------------------------------------------------ |
---|
| 126 | ;------------------------------------------------------------ |
---|
| 127 | ; determination du domaine geographique |
---|
| 128 | ;------------------------------------------------------------ |
---|
| 129 | if keyword_set(tout) then begin |
---|
| 130 | nx=jpi |
---|
| 131 | ny=jpj |
---|
| 132 | nz=jpk |
---|
| 133 | premierx = 0 |
---|
| 134 | premiery = 0 |
---|
| 135 | premierz = 0 |
---|
[118] | 136 | endif else BEGIN |
---|
[2] | 137 | ;------------------------------------------------------------ |
---|
| 138 | ; redefinition eventuelle du domaine ajuste a boite (a 6 elements) |
---|
[297] | 139 | ; + on recupere la dim du nouveau domaine |
---|
[2] | 140 | ;------------------------------------------------------------ |
---|
[118] | 141 | if keyword_set(boite) then BEGIN |
---|
[2] | 142 | Case N_Elements(Boite) Of |
---|
| 143 | 1:Domdef, lon1, lon2, lat1, lat2, 0.,boite[0],GRILLE=vargrid, _EXTRA = ex |
---|
| 144 | 2:Domdef, lon1, lon2, lat1, lat2, boite[0],boite[1],GRILLE=vargrid, _EXTRA = ex |
---|
| 145 | 4:Domdef, [Boite, prof1, prof2],GRILLE=vargrid, _EXTRA = ex |
---|
| 146 | 5:Domdef, [Boite[0:3], 0, Boite[4]],GRILLE=vargrid, _EXTRA = ex |
---|
| 147 | 6:Domdef, Boite,GRILLE=vargrid, _EXTRA = ex |
---|
| 148 | Else:return, report('Mauvaise Definition de Boite') |
---|
| 149 | endcase |
---|
| 150 | ENDIF |
---|
| 151 | grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery |
---|
| 152 | ENDELSE |
---|
| 153 | ;------------------------------------------------------------ |
---|
| 154 | ncdf_varget,cdfid,nom,res $ |
---|
| 155 | ,offset=[premierx,premiery,debut[0]] $ |
---|
| 156 | ,count=[nx,ny,fin[0]-debut[0]+1] |
---|
| 157 | ;------------------------------------------------------------ |
---|
| 158 | ncdf_close,cdfid |
---|
| 159 | return,res |
---|
| 160 | ;------------------------------------------------------------ |
---|
| 161 | ;------------------------------------------------------------ |
---|
| 162 | end |
---|