- Location:
- /trunk
- Files:
-
- 8 added
- 6 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
/trunk/condmag_from_orca.pro
r20 r30 77 77 ; 78 78 ; @history 79 ; reee522 2007-06-06T15:14:24Z rhodes (IRIX64) 80 ; replace call of initorca2_bab by initocemesh 81 ; reee522 2007-06-06T14:57:39Z rhodes (IRIX64) 82 ; correction for DRAKKAR_EXP usage 79 83 ; fplod 2007-03-21T13:23:55Z aedon.locean-ipsl.upmc.fr (Darwin) 80 84 ; create from condmag_on_orca to validate step1 of GEOMAG … … 138 142 ENDCASE 139 143 filename_oce = orcares + '-' + drakkar_exp + '_mesh_hgr.nc' 140 END 144 ENDIF ELSE BEGIN 145 msg = 'eee : unset DRAKKAR_EXP keyword' 146 ras = report(msg) 147 msg = 'eee : orcares must be G42 or G70' 148 ras = report(msg) 149 RETURN 150 ENDELSE 141 151 END 142 152 ELSE : BEGIN … … 324 334 ;---- 325 335 ; 326 CASE orcares OF 327 'ORCA2': BEGIN 328 @initorca2_bab 329 END 330 ENDCASE 336 initocemesh, orcares, DRAKKAR_EXP = drakkar_exp 331 337 ; 332 338 ;---- … … 425 431 ; ++ tri par ordre alpha , par ordre de pourcentage croissant ou décroissant 426 432 ; +++ d'utilisation 427 profiler,/REPORT 428 ; shut down all profiling (according to 433 profiler,/REPORT 434 ; shut down all profiling (according to 429 435 ; http://www.dfanning.com/code_tips/whyslow.html) 430 profiler, /CLEAR, /SYSTEM 436 profiler, /CLEAR, /SYSTEM 431 437 profiler, /CLEAR, /RESET 432 438 ENDIF -
/trunk/condmag_on_orca.pro
r20 r30 57 57 ; 58 58 ; @history 59 ; reee522 2007-06-06T14:57:39Z rhodes (IRIX64) 60 ; correction for DRAKKAR_EXP usage 59 61 ; reee522 2006-12-13T13:50:32Z rhodes (IRIX64) 60 62 ; add optional keyword drakkar_exp … … 135 137 ENDCASE 136 138 filename_oce = orcares + '-' + drakkar_exp + '_mesh_hgr.nc' 137 END 139 ENDIF ELSE BEGIN 140 msg = 'eee : unset DRAKKAR_EXP keyword' 141 ras = report(msg) 142 msg = 'eee : orcares must be G42 or G70' 143 ras = report(msg) 144 RETURN 145 ENDELSE 138 146 END 139 147 ELSE : BEGIN -
/trunk/divfred.pro
r20 r30 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 ;------------------------------------------------------------4 1 ;+ 5 ; NAME:div 6 ; 7 ; PURPOSE:calcule la divergence d'un champ 2D 8 ; 9 ; CATEGORY:calcule sur les matrices 10 ; 11 ; CALLING SEQUENCE:res=div(u,v) 12 ; 13 ; INPUTS: 14 ; u et v deux matrices representant les coordonnes d''un 15 ; champ de vecteur 16 ; 17 ; KEYWORD PARAMETERS: 18 ; 19 ; OUTPUTS:res: une matrice 2d 20 ; 21 ; COMMON BLOCKS: 22 ; common.pro 23 ; 24 ; SIDE EFFECTS: 25 ; 26 ; RESTRICTIONS: 27 ; les matrices u et v peuvent de 2 a 4 dimensions. 28 ; attention pour distinger les differents configurations de u et v 29 ; (xy, xyz, xyt, xyzt), on regarde la variable du common 2 ; @files_comments 3 ; calcule la divergence d'un champ 2D 4 ; 5 ; @categories 6 ; matrix 7 ; 8 ; @examples 9 ; IDL> res=Divfred(u,v) 10 ; 11 ; @param u {in}{required}{type=2D array} 12 ; Matrix representing the zonal coordinates (U point) 13 ; 14 ; @param v {in}{required}{type=2D array} 15 ; Matrix representing the zonal coordinates (V point) 16 ; 17 ; @returns 18 ; the divergence of the input data (with the same size) 19 ; 20 ; @uses 21 ; common.pro 22 ; 23 ; @restrictions 24 ; - Requires SAXO tools 25 ; - les matrices u et v peuvent de 2 a 4 dimensions. 26 ; attention pour distinguer les différentes configurations de u et v 27 ; (xy, xyz, xyt, xyzt), on regarde la variable du common 30 28 ; -time qui contient le calendrier en jour julien d''IDL auquel 31 ; se rapportent u et v ansi que la variable 32 ; -jpt qui est le nombre de pas de temps a considerer ds time. 33 ; les tableaux u et v sont decoupes sur le meme domaine 34 ; geographique. A cause du decalage des grilles T, U, V et F il est 35 ; possiible que ces 2 tableaux n''aient pas la meme taille et se 36 ; repportent a des indices differents. Si tel est le cas les tableaux 37 ; sont redecoupes sur les indices qu'ils ont en commun et le dommaine 38 ; est redefinit pour qu'il colle a ces indices communs. 39 ; pour eviter ces redecoupes utiliser le mot cles /memeindice ds 40 ; domdef.pro 41 ; 42 ; les points sur le bord du dessin sont mis a !values.f_nan 43 ; 44 ; EXAMPLE: 45 ; 46 ; MODIFICATION HISTORY:Guillaume Roullet (grlod\@ipsl.jussieu.fr) 29 ; se rapportent u et v ansi que la variable 30 ; -jpt qui est le nombre de pas de temps à considérer dans time. 31 ; les tableaux u et v sont découpés sur le même domaine 32 ; géographique. A cause du décalage des grilles T, U, V et F il est 33 ; possible que ces 2 tableaux n''aient pas la même taille et se 34 ; reportent à des indices différents. Si tel est le cas les tableaux 35 ; sont redécoupés sur les indices qu'ils ont en commun et le dommaine 36 ; est redéfini pour qu'il colle à ces indices communs. 37 ; pour éviter ces redécoupes utiliser le mot clé /memeindice dans 38 ; <pro>domdef</pro> 39 ; 40 ; les points sur le bord du dessin sont mis à !values.f_nan 41 ; 42 ; @todo 43 ; ++ pas fini de comprendre, tester (compatibilité saxo), adapter, commenter 44 ; nettoyer 45 ; ++ a comparer et merger avec SAXO_DIR/ToBeReviewed/CALCULS/div.pro 46 ; Written by: fplod 2006-03-27T13:45:14Z aedon.lodyc.jussieu.fr (Darwin) 47 ; 48 ; @history 49 ; fplod 2007-07-30T10:11:33Z aedon.locean-ipsl.upmc.fr (Darwin) 50 ; add header for idldoc 51 ; created from 52 ; /usr/work/sur/fvi/OPA/geomag/divfred.pro 53 ; Guillaume Roullet (grlod\@ipsl.jussieu.fr) 47 54 ; Creation : printemps 1998 48 55 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 49 56 ; adaptation pour marcher avec un domaine reduit 50 57 ; 12/1/2000 58 ; @version 59 ; $Id$ 60 ; 51 61 ;- 52 ;------------------------------------------------------------ 53 ;------------------------------------------------------------ 54 ;------------------------------------------------------------ 62 ; 55 63 FUNCTION divfred, uu, vv 56 64 tempsun = systime(1) ; pour key_performance … … 66 74 ; on trouve les points que u et v ont en communs 67 75 ;------------------------------------------------------------ 68 indicexu = (lindgen(jpi))[ premierxu:premierxu+nxu-1]69 indicexv = (lindgen(jpi))[ premierxv:premierxv+nxv-1]76 indicexu = (lindgen(jpi))[firstxu:firstxu+nxu-1] 77 indicexv = (lindgen(jpi))[firstxv:firstxv+nxv-1] 70 78 indicex = inter(indicexu, indicexv) 71 indiceyu = (lindgen(jpj))[ premieryu:premieryu+nyu-1]72 indiceyv = (lindgen(jpj))[ premieryv:premieryv+nyv-1]79 indiceyu = (lindgen(jpj))[firstyu:firstyu+nyu-1] 80 indiceyv = (lindgen(jpj))[firstyv:firstyv+nyv-1] 73 81 indicey = inter(indiceyu, indiceyv) 74 nx = n_elements(indicex) 82 nx = n_elements(indicex) 75 83 ny = n_elements(indicey) 76 84 indice2d = lindgen(jpi, jpj) … … 81 89 ;xyz 82 90 ;---------------------------------------------------------------------------- 83 (size(u))[0] EQ 3 AND date1 EQ date2 :BEGIN 91 (size(u))[0] EQ 3 AND date1 EQ date2 :BEGIN 84 92 ;------------------------------------------------------------ 85 93 ; extraction de u et v sur le domaine qui convient … … 88 96 (size(u))[0] NE 3 OR (size(v))[0] NE 3: return, -1 89 97 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 90 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 98 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 91 99 case 1 of 92 nxu NE nx:if indicex[0] EQ premierxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *]93 nxv NE nx:if indicex[0] EQ premierxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *]94 nyu NE ny:if indicey[0] EQ premieryu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *]95 nyv NE ny:if indicey[0] EQ premieryv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *]100 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 101 nxv NE nx:if indicex[0] EQ firstxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *] 102 nyu NE ny:if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 103 nyv NE ny:if indicey[0] EQ firstyv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *] 96 104 ELSE : 97 105 endcase 98 106 END 99 107 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $ 100 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 108 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 101 109 u = u[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *] 102 110 v = v[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *] 103 111 END 104 ELSE:BEGIN 112 ELSE:BEGIN 105 113 zdiv = -1 106 114 GOTO, sortie 107 115 end 108 116 109 117 endcase 110 118 ;------------------------------------------------------------ … … 114 122 zu = reform(zu, nx, ny, nzt, /over) 115 123 zu = temporary(u)*temporary(zu) $ 116 *(umask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]124 *(umask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt] 117 125 terreu = where(zu EQ 0) 118 126 ;;; if terreu[0] NE -1 then zu[temporary(terreu)] = !values.f_nan … … 121 129 zv = reform(zv, nx, ny, nzt, /over) 122 130 zv = temporary(v)*temporary(zv) $ 123 *(vmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]131 *(vmask())[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt] 124 132 terrev = where(zv EQ 0) 125 133 ;;; if terrev[0] NE -1 then zv[temporary(terrev)] = !values.f_nan … … 129 137 zdiv = reform(zdiv, nx, ny, nzt, /over) 130 138 zdiv = temporary(zdiv)*(zu-shift(zu, 1, 0, 0)+zv-shift(zv, 0, 1, 0)) $ 131 *tmask[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt]139 *tmask[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt] 132 140 ;------------------------------------------------------------ 133 141 ; mise a !values.f_nan de la bordure 134 142 ;------------------------------------------------------------ 135 if NOT keyword_set(key_periodi que) OR nx NE jpi then begin143 if NOT keyword_set(key_periodic) OR nx NE jpi then begin 136 144 zdiv(0, *, *) = !values.f_nan 137 145 zdiv(nx-1, *, *) = !values.f_nan … … 143 151 ; 144 152 if n_elements(valmask) EQ 0 THEN valmask = 1e20 145 terre = where(tmask[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, premierzt:dernierzt] EQ 0)153 terre = where(tmask[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt:lastzt] EQ 0) 146 154 if terre[0] NE -1 then zdiv[temporary(terre)] = valmask 147 155 ;------------------------------------------------------------ … … 151 159 varname = 'div' 152 160 varunits = '1e6*s-1' 153 domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t']161 domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], vert1, vert2, grille = ['t'] 154 162 if keyword_set(direc) then zdiv = moyenne(zdiv,direc,/nan, boite = boite) 155 163 END … … 159 167 ;---------------------------------------------------------------------------- 160 168 ;---------------------------------------------------------------------------- 161 date1 NE date2 AND (size(u))[0] EQ 3 :BEGIN 169 date1 NE date2 AND (size(u))[0] EQ 3 :BEGIN 162 170 ;------------------------------------------------------------ 163 171 ; extraction de u et v sur le domaine qui convient … … 166 174 (size(u))[0] NE 3 OR (size(v))[0] NE 3: return, -1 167 175 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 168 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 176 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 169 177 case 1 of 170 nxu NE nx:if indicex[0] EQ premierxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *]171 nxv NE nx:if indicex[0] EQ premierxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *]172 nyu NE ny:if indicey[0] EQ premieryu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *]173 nyv NE ny:if indicey[0] EQ premieryv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *]178 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 179 nxv NE nx:if indicex[0] EQ firstxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *] 180 nyu NE ny:if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 181 nyv NE ny:if indicey[0] EQ firstyv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *] 174 182 ELSE : 175 183 endcase 176 184 END 177 185 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $ 178 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 186 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 179 187 u = u[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *] 180 188 v = v[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *] … … 185 193 ; calcul de la divergence 186 194 ;------------------------------------------------------------ 187 zu = e2u[indice2d]*(umask())[indice2d+jpi*jpj* premierzt]195 zu = e2u[indice2d]*(umask())[indice2d+jpi*jpj*firstzt] 188 196 terreu = where(zu EQ 0) 189 197 ;;; if terreu[0] NE -1 then zu[temporary(terreu)] = !values.f_nan … … 192 200 zu = temporary(u)*temporary(zu) 193 201 ; 194 zv = e1v[indice2d]*(vmask())[indice2d+jpi*jpj* premierzt]202 zv = e1v[indice2d]*(vmask())[indice2d+jpi*jpj*firstzt] 195 203 terrev = where(zv EQ 0) 196 204 ;;; if terrev[0] NE -1 then zv[temporary(terrev)] = !values.f_nan … … 199 207 zv = temporary(v)*temporary(zv) 200 208 ; 201 zdiv = 1e6*tmask[indice2d+jpi*jpj* premierzt]/(e1t[indice2d]*e2t[indice2d])209 zdiv = 1e6*tmask[indice2d+jpi*jpj*firstzt]/(e1t[indice2d]*e2t[indice2d]) 202 210 zdiv = (zdiv)[*]#replicate(1, jpt) 203 211 zdiv = reform(zdiv, nx, ny, jpt, /over) … … 207 215 ; mise a !values.f_nan de la bordure 208 216 ;------------------------------------------------------------ 209 if NOT keyword_set(key_periodi que) OR nx NE jpi then begin217 if NOT keyword_set(key_periodic) OR nx NE jpi then begin 210 218 zdiv(0, *, *) = !values.f_nan 211 219 zdiv(nx-1, *, *) = !values.f_nan … … 222 230 varname = 'div' 223 231 varunits = '1e6*s-1' 224 domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t']232 domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], vert1, vert2, grille = ['t'] 225 233 if keyword_set(direc) then zdiv = grossemoyenne(zdiv,direc,/nan, boite = boite) 226 234 END … … 230 238 ;---------------------------------------------------------------------------- 231 239 ;---------------------------------------------------------------------------- 232 date1 NE date2 AND (size(u))[0] EQ 4:BEGIN 240 date1 NE date2 AND (size(u))[0] EQ 4:BEGIN 233 241 return, report('non code!') 234 242 END … … 240 248 ELSE:BEGIN ;xy 241 249 indice3d = lindgen(jpi, jpj, jpk) 242 indice3d = indice3d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, niveau -1]250 indice3d = indice3d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, firstzt] 243 251 ;------------------------------------------------------------ 244 252 ; extraction de u et v sur le domaine qui convient 245 253 ;------------------------------------------------------------ 246 254 case 1 of 247 (size(u))[0] NE 2 OR (size(v))[0] NE 2: BEGIN 255 (size(u))[0] NE 2 OR (size(v))[0] NE 2: BEGIN 248 256 zdiv = -1 249 257 GOTO, sortie 250 258 end 251 259 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 252 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 260 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 253 261 case 1 of 254 nxu NE nx:if indicex[0] EQ premierxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *]255 nxv NE nx:if indicex[0] EQ premierxv then v = v[0:nx-1, *] ELSE v = v[1: nx, *]256 nyu NE ny:if indicey[0] EQ premieryu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny]257 nyv NE ny:if indicey[0] EQ premieryv then v = v[*, 0:ny-1] ELSE v = v[*, 1: ny]262 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 263 nxv NE nx:if indicex[0] EQ firstxv then v = v[0:nx-1, *] ELSE v = v[1: nx, *] 264 nyu NE ny:if indicey[0] EQ firstyu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 265 nyv NE ny:if indicey[0] EQ firstyv then v = v[*, 0:ny-1] ELSE v = v[*, 1: ny] 258 266 ELSE : 259 267 endcase 260 268 END 261 269 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $ 262 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 270 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 263 271 u = u[indice2d] 264 272 v = v[indice2d] … … 280 288 ; mise a !values.f_nan de la bordure 281 289 ;------------------------------------------------------------ 282 if NOT keyword_set(key_periodi que) OR nx NE jpi then begin290 if NOT keyword_set(key_periodic) OR nx NE jpi then begin 283 291 zdiv(0, *) = !values.f_nan 284 292 zdiv(nx-1, *) = !values.f_nan … … 298 306 varname = 'div' 299 307 varunits = '1e6*s-1' 300 domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], prof1, prof2, grille = ['t']308 domdef, (glamt[indice2d])[0, 0], (glamu[indice2d])[nx-1, 0],(gphit[indice2d])[0, 0], (gphiv[indice2d])[0, ny-1], vert1, vert2, grille = ['t'] 301 309 if keyword_set(direc) then zdiv = moyenne(zdiv,direc,/nan, boite = boite) 302 310 303 311 END 304 312 endcase 305 313 306 314 ;------------------------------------------------------------ 307 315 sortie: 308 if keyword_set(key_performance) THEN print, 'temps div', systime(1)-tempsun 309 316 if keyword_set(key_performance) THEN print, 'temps div', systime(1)-tempsun 317 310 318 return, zdiv 311 319 end -
/trunk/forcagequimarche.pro
r20 r30 1 PRO forcagequimarche,iyear,ian 2 @init2 3 @initorca2_bab 4 5 6 1 ;+ 2 ; 3 ; @file_comments 4 ; calcul d'une matrice 3D de conductivité sigma=f(T,S) en fonction de T et S 5 ; de ORCA, sur la grille T 6 ; 7 ; @categories 8 ; orca grid 9 ; 10 ; @param orcares {in}{required}{type=string} 11 ; code of ORCA grid to use for output results 12 ; must be 'ORCA2' 13 ; 14 ; @param iyear {in}{required}{type=integer} 15 ; real year 16 ; 17 ; @param ian {in}{required}{type=integer} 18 ; simulation year 19 ; 20 ; @keyword DRAKKAR_EXP {type=string} 21 ; code for Drakkar experiment 22 ; only used when orcares = ORCA025 23 ; must be G42 ++ G70 24 ; 25 ; @restrictions 26 ; - Requires SAXO tools 27 ; 28 ; @todo 29 ; validation of ORCA2 processing (now some nan in output files !) 30 ; add ORCA025 31 ; provide tools to plot output files 32 ; produce a NetCDF GDT or CF compliant 33 ; add divchoice parameter to choose either div or divfred 34 ; 35 ; @pre 36 ; see geomag_profile.sh 37 ; be sure to have ++ in the directory defined in ${GEOMAG_ID}/ 38 ; 39 ; @post 40 ; see geomag_profile.sh 41 ; ++ in the directory defined in ${GEOMAG_OD}/ 42 ; 43 ; @examples 44 ; for ORCA2 45 ; IDL> .run forcagequimarche 46 ; IDL> forcagequimarche, 'ORCA2', '1993', '01' 47 ; 48 ; @history 49 ; fplod 2007-07-30T10:12:38Z aedon.locean-ipsl.upmc.fr (Darwin) 50 ; restore divfred call instead of div ("official" saxo divergence module) 51 ; fplod 2007-07-27T10:29:18Z cerbere.locean-ipsl.upmc.fr (Linux) 52 ; add orcares in the name of output files 53 ; fplod 2007-07-27T10:29:18Z cerbere.locean-ipsl.upmc.fr (Linux) 54 ; add orcares parameter 55 ; add optional keyword drakkar_exp 56 ; add header for idldoc 57 ; add check of io directories 58 ; replace io directories user dependant to $GEOMAG_ID and $GEOMAG_OD 59 ; replace call of divfred by call of div 60 ; 61 ; @version 62 ; $Id$ 63 ; 64 ;- 65 ; 66 PRO forcagequimarche,orcares,iyear,ian,DRAKKAR_EXP = drakkar_exp 67 ; 68 ;---- 69 ; check input parameters 70 ;---- 71 ; 72 ; check orcares definition 73 ; 74 CASE orcares OF 75 'ORCA2': BEGIN 76 msg = 'iii : valid orcares parameter = ' + orcares 77 ras = report(msg) 78 filename_oce = 'meshmask_bab.nc' 79 IF keyword_set(DRAKKAR_EXP) THEN BEGIN 80 msg = 'www : unused DRAKKAR_EXP keyword = ' + drakkar_exp 81 ras = report(msg) 82 END 83 END 84 ELSE : BEGIN 85 msg = 'eee : invalid orcares parameter = ' + orcares 86 ras = report(msg) 87 msg = 'eee : orcares must be ORCA2 or ORCA025++' 88 ras = report(msg) 89 RETURN 90 END 91 ENDCASE 92 93 ; ++ check iyear 94 ; ++ check ian 95 96 ;++@init2 97 ; init grid 98 initocemeshmask, orcares, DRAKKAR_EXP = drakkar_exp 7 99 8 100 @common 9 10 11 12 ;ian='01' 13 ;iyear='1993' 14 101 ; 102 ; check for input files 103 ; 104 ; test if ${GEOMAG_ID} defined 105 geomag_id_env=GETENV('GEOMAG_ID') 106 CASE geomag_id_env OF 107 '' : BEGIN 108 msg = 'eee : ${GEOMAG_ID} is not defined' 109 ras = report(msg) 110 RETURN 111 END 112 ELSE: BEGIN 113 msg = 'iii : ${GEOMAG_ID} is ' + geomag_id_env 114 ras = report(msg) 115 END 116 ENDCASE 117 ; 118 iodirin = isadirectory(geomag_id_env) 119 ; 120 ; existence and protection of ${GEOMAG_ID} 121 IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN 122 msg = 'eee : the directory' + iodirin + ' is not accessible.' 123 ras = report(msg) 124 RETURN 125 ENDIF 126 ; 127 ; test if ${GEOMAG_OD} defined 128 geomag_od_env=GETENV('GEOMAG_OD') 129 CASE geomag_od_env OF 130 '' : BEGIN 131 msg = 'eee : ${GEOMAG_OD} is not defined' 132 ras = report(msg) 133 RETURN 134 END 135 ELSE: BEGIN 136 msg = 'iii : ${GEOMAG_OD} is ' + geomag_od_env 137 ras = report(msg) 138 END 139 ENDCASE 140 ; 141 ; check if output data will be possible 142 iodirout = isadirectory(geomag_od_env) 143 ; 144 ; existence and protection 145 IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 146 msg = 'eee : the directory' + iodirout + ' was not found.' 147 ras = report(msg) 148 RETURN 149 ENDIF 150 ; 15 151 e_exp='ESS' 16 rep_fred='/usr/work/sur/fvi/OPA/geomag/'17 152 key_portrait = 0 18 ; stockage des fichiers brut 19 ioDATA='/usr/work/sur/fvi/OPA/ORCA2/' 20 file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 21 print, file_U 22 file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 23 print, file_V 24 file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 25 print, file_T 26 file_Sed= rep_fred+'cond_sed_ORCA2.nc' 27 file_Br= rep_fred+'Br_ORCA2.nc' 28 29 153 ; stockage des fichiers brut 154 ioDATA=geomag_id_env 155 156 CASE orcares OF 157 'ORCA2': BEGIN 158 file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 159 file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 160 file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 161 file_Sed= geomag_id_env+'cond_sed_ORCA2.nc' 162 file_Br= geomag_id_env+'Br_ORCA2.nc' 163 END 164 ENDCASE 165 ; 30 166 ; title 31 167 t_exp= e_exp 32 ; t_exp0= e_exp033 168 t_bt = 'bar_transp' 34 ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2' 169 ioORLN2 = geomag_id_env 170 ; 35 171 ;facteur d'echelle vertical for partial steps 36 172 e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') … … 39 175 ;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br) 40 176 BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill) 41 42 43 44 177 ; 45 178 ; vertical integration: 46 e3t3d=make_array(jpi,jpj,jpk) 179 e3t3d=make_array(jpi,jpj,jpk) 47 180 for k=0, jpk-1 do begin &$ 48 for j=0,jpj-1 do begin &$ 181 for j=0,jpj-1 do begin &$ 49 182 for i=0,jpi-1 do begin &$ 50 183 e3t3d(i,j,k) = e3t(k) &$ … … 53 186 endfor 54 187 jpt = 73 55 56 ;vud = make_array(jpi,jpj,jpt) 188 ; 189 ;vud = make_array(jpi,jpj,jpt) 57 190 ;vvd = make_array(jpi, jpj, jpt) 58 191 divBustar = make_array(jpi, jpj, jpt) 59 192 diver3=replicate(0.,182,149,1,73) 60 193 sigma3=replicate(0.,182,149,1,73) 61 62 63 FOR jt = 0, jpt-1 DO BEGIN &$ 64 194 ; 195 FOR jt = 0, jpt-1 DO BEGIN &$ 196 ; 65 197 ; ouverture des fichiers et stockage en memoire partial steps 66 vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U) &$ 67 ;stop 68 vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V) &$ 198 vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U) &$ 199 ;stop 200 vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V) &$ 69 201 ;stop 70 202 ; lecture salinite & temperature … … 77 209 conduct(mask_t)=0. 78 210 ; Somme conduct au point T 79 80 211 ; 81 212 ; Calcul SIGMA 82 213 ; 83 214 SIGMAoc=total(conduct*e3t3d*tmask,3) 84 215 SIGMA=SIGMAsed+SIGMAoc 85 86 87 216 ; 88 217 SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2. 89 90 218 SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2. 91 219 ; 92 220 ; Calcul B en points u et v 93 221 ; 94 222 BR_u=(BR+shift(BR,-1,0))/2. 95 96 223 BR_v=(BR+shift(BR,0,1))/2. 97 98 224 ; 99 225 ; Calcul integrale conduct 100 226 ; 101 227 conduct_u=(conduct+shift(conduct,-1,0,0))/2. 102 103 228 conduct_v=(conduct+shift(conduct,0,1,0))/2. 104 229 ; 105 230 u_cond_u=total( vu*conduct_u*e3u3d*umask(),3) 106 107 231 v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3) 108 109 232 ; 110 233 Bu_star= BR_u*u_cond_u/SIGMA_u 111 112 234 Bv_star= BR_v*v_cond_v/SIGMA_v 113 235 ; 114 236 ; Divergence du champ 115 116 237 Diver=divfred(Bu_star,Bv_star) 117 238 … … 120 241 lecontinent=where(Diver GT 1.E08) 121 242 Diver(lecontinent)=0. 122 123 124 243 125 244 ;stop … … 134 253 sigma3(181,*,*,*)=sigma3(1,*,*,*) 135 254 136 137 255 print, jt 138 256 139 140 ENDFOR 257 ENDFOR 141 258 ; on ferme le NetCDF 142 259 ;NCDF_CLOSE,id3 143 260 ;NCDF_CLOSE,id4 144 145 146 147 261 148 262 temps=fltarr(73) … … 154 268 155 269 vargrid = 'T' 156 iodir = '/usr/work/sur/fvi/OPA/ORCA2/'270 iodir = geomag_od_env 157 271 ; Nom 158 idout = NCDF_CREATE(iodir+'DivBustar_5d_'+iyear+'_grid_T .nc',/clobber)272 idout = NCDF_CREATE(iodir+'DivBustar_5d_'+iyear+'_grid_T_'+orcares+'.nc',/clobber) 159 273 print, 'Creation du fichier Netcdf' 160 274 NCDF_CONTROL, idout, /nofill … … 203 317 ; Creation de la latitude 204 318 NCDF_VARPUT, idout, id1, gphit 205 ; Creation de la profondeur 206 NCDF_VARPUT, idout, id2, gdept 319 ; Creation de la profondeur 320 NCDF_VARPUT, idout, id2, gdept 207 321 ; Creation du calendrier 208 322 209 323 NCDF_VARPUT, idout, id3, temps 210 324 211 325 212 326 ; Ecriture des donnees 213 327 214 ; ecriture des glam_8 328 ; ecriture des glam_8 215 329 NCDF_VARPUT, idout, id4 , diver3 216 330 … … 220 334 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 221 335 222 idout = NCDF_CREATE(iodir+'Sigma_5d_'+iyear+'_grid_T .nc',/clobber)336 idout = NCDF_CREATE(iodir+'Sigma_5d_'+iyear+'_grid_T_'+orcares+'.nc',/clobber) 223 337 print, 'Creation du fichier Netcdf' 224 338 NCDF_CONTROL, idout, /nofill … … 267 381 ; Creation de la latitude 268 382 NCDF_VARPUT, idout, id1, gphit 269 ; Creation de la profondeur 270 NCDF_VARPUT, idout, id2, gdept 383 ; Creation de la profondeur 384 NCDF_VARPUT, idout, id2, gdept 271 385 ; Creation du calendrier 272 386 273 387 NCDF_VARPUT, idout, id3, temps 274 388 275 389 276 390 ; Ecriture des donnees 277 391 278 ; ecriture des glam_8 392 ; ecriture des glam_8 279 393 NCDF_VARPUT, idout, id4 , sigma3 280 394 -
/trunk/geomag_profile.sh
r20 r30 6 6 # usage : 7 7 # online usage 8 # $ . geomag_profile.sh -d directory 8 # $ . geomag_profile.sh -d directory -i indir -o outdir -t tempdir 9 9 # 10 10 # in ${HOME}/.profile, add the following line 11 # . geomag_profile.sh -d directory 11 # . geomag_profile.sh -d directory -i indir -o outdir -t tempdir 12 12 # 13 13 # examples : 14 # for fplod, on aedon.locean-ipsl.upmc.fr 14 # for fplod, on aedon.locean-ipsl.upmc.fr 15 15 # $ cd /usr/home/fplod/incas/geomag/geomag_ws 16 # $ . geomag_profile.sh -d /usr/home/fplod/incas/geomag/geomag_ws/ 16 # $ . geomag_profile.sh -d /usr/home/fplod/incas/geomag/geomag_ws/ -i ${HOME}/geomag_d/ -o ${HOME}/geomag_d/ -t /usr/temp/${LOGNAME}/log/ 17 # 17 18 # for reee522 on rhodes.idris.fr 18 19 # $ cd ${HOME}/incas/geomag/geomag_ws/ 19 # $ . geomag_profile.sh -d ${HOME}/incas/geomag/geomag_ws/ 20 # $ . geomag_profile.sh -d ${HOME}/incas/geomag/geomag_ws/ -i ${HOMEGAYA}/geomag_d/ -o ${HOMEGAYA}/geomag_d/ -t /tmp/${LOGNAME}/log/ 20 21 # 21 22 # original location … … 26 27 # ++ machine dependant 27 28 # ++ besoin de posix 28 # ++ pas de MANPATH defini par déut sur zeus 29 # ++ pas de MANPATH defini par déubt sur zeus 30 # reee522 2007-06-14T14:25:00Z rhodes (IRIX64) 31 # add -i, -o and -t parameters to be more flexible 32 # some bug fixes 33 # more checking 29 34 # fplod 2007-03-13T16:12:41Z zeus.locean-ipsl.upmc.fr (Linux) 30 35 # add creation of $GEOMAG_ID and $GEOMAG_OD if they don't exist … … 38 43 command=geomag_profile.sh 39 44 # 40 usage=" Usage : ${command} -d directory "45 usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir" 41 46 # 42 47 while [ ! -z "${1}" ] # ++ pb bash 43 48 do 44 49 case ${1} in 45 -d) # directory choosen by user50 -d) # directory for application choosen by user (see svn checkout command used) 46 51 directory=${2} 47 52 shift 48 53 ;; 54 -i) # directory for inputs choosen by user 55 indir=${2} 56 shift 57 ;; 58 -o) # directory for outputs choosen by user 59 outdir=${2} 60 shift 61 ;; 62 -t) # directory for temporary outputs choosen by user 63 tempdir=${2} 64 shift 65 ;; 66 49 67 *) # other choice 50 68 echo "${usage}" … … 71 89 set -u 72 90 system=$(uname) 73 case ${system}in91 case "${system}" in 74 92 IRIX64) 75 93 echo " www : no specific posix checking" … … 79 97 ;; 80 98 esac 81 #82 99 # 83 100 GEOMAG=${directory} … … 110 127 fi 111 128 # 112 GEOMAG_LOG= /usr/temp/${LOGNAME}/log/129 GEOMAG_LOG=${tempdir} 113 130 export GEOMAG_LOG 131 if [ ! -d ${GEOMAG_LOG} ] 132 then 133 mkdir -p ${GEOMAG_LOG} 134 echo "${command} : iii : creation of \${GEOMAG_LOG}" 135 fi 136 # check for permission on GEOMAG_LOG 137 if [ ! -x ${GEOMAG_LOG} ] 138 then 139 echo " eee : ${GEOMAG_LOG} not reachable" 140 # nb : no exit because this file should be launched by login process 141 fi 142 # 143 # check for permission on GEOMAG_LOG 144 if [ ! -w ${GEOMAG_LOG} ] 145 then 146 echo " eee : ${GEOMAG_LOG} not writable" 147 # nb : no exit because this file shouldreachable be launched by login process 148 fi 114 149 # 115 150 EDITOR=vi … … 117 152 # 118 153 # io directories 119 GEOMAG_ID=${ HOME}/geomag_d/154 GEOMAG_ID=${indir} 120 155 export GEOMAG_ID 121 156 if [ ! -d ${GEOMAG_ID} ] … … 124 159 echo "${command} : iii : creation of \${GEOMAG_ID}" 125 160 fi 126 GEOMAG_OD=${HOME}/geomag_d/ 161 # check for permission on GEOMAG_ID 162 if [ ! -x ${GEOMAG_ID} ] 163 then 164 echo " eee : ${GEOMAG_ID} not reachable" 165 # nb : no exit because this file should be launched by login process 166 fi 167 # 168 GEOMAG_OD=${outdir} 127 169 export GEOMAG_OD 128 if [ ! -d ${GEOMAG_ ID} ]170 if [ ! -d ${GEOMAG_OD} ] 129 171 then 130 172 mkdir -p ${GEOMAG_OD} 131 173 echo "${command} : iii : creation of \${GEOMAG_OD}" 132 174 fi 175 # check for permission on GEOMAG_OD 176 if [ ! -x ${GEOMAG_OD} ] 177 then 178 echo " eee : ${GEOMAG_OD} not reachable" 179 # nb : no exit because this file should be launched by login process 180 fi 181 if [ ! -w ${GEOMAG_OD} ] 182 then 183 echo " eee : ${GEOMAG_OD} not writable" 184 # nb : no exit because this file should be launched by login process 185 fi 133 186 # 134 187 # end
Note: See TracChangeset
for help on using the changeset viewer.