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