Changeset 25 for trunk/ToBeReviewed/CALCULS/grad.pro
- Timestamp:
- 05/02/06 14:59:12 (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/CALCULS/grad.pro
r23 r25 34 34 @common 35 35 ;------------------------------------------------------------ 36 ; 37 IF finite(glamu[0])*finite(gphiu[0])*finite(glamv[0])*finite(gphiv[0]) EQ 0 THEN $ 38 return, report(['This version of grad is based on Arakawa C-grid.' $ 39 , 'U and V grids must therefore be defined']) 40 ; 36 41 res = litchamp(field) 37 42 taille=size(res) 38 grille, mask, glam, gphi, gdep, nx, ny,nz, premierx,premiery,premierz,dernierx, derniery, dernierz43 grille, mask, glam, gphi, gdep, nx, ny,nz,firstx,firsty,firstz,lastx, lasty, lastz 39 44 if n_elements(valmask) EQ 0 then valmask = 1e20 40 45 case strupcase(vargrid) of … … 42 47 case direc of 43 48 'x':BEGIN 44 divi = e1u[ premierx:dernierx, premiery:derniery]45 newmask = (umask())[ premierx:dernierx, premiery:derniery, premierz:dernierz]49 divi = e1u[firstx:lastx, firsty:lasty] 50 newmask = (umask())[firstx:lastx, firsty:lasty, firstz:lastz] 46 51 vargrid = 'U' 47 domdef, glamt[ premierx, 0], glamu[dernierx, 0] $48 , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U']52 domdef, glamt[firstx, 0], glamu[lastx, 0] $ 53 , gphit[0, firsty], gphiu[0, lasty], gridtype = ['T','U'] 49 54 END 50 55 'y':BEGIN 51 divi = e2v[ premierx:dernierx, premiery:derniery]52 newmask = (vmask())[ premierx:dernierx, premiery:derniery, premierz:dernierz]56 divi = e2v[firstx:lastx, firsty:lasty] 57 newmask = (vmask())[firstx:lastx, firsty:lasty, firstz:lastz] 53 58 vargrid = 'V' 54 domdef, glamt[ premierx, 0], glamv[dernierx, 0] $55 , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V']56 END 57 'z':BEGIN 58 divi = e3w[ premierz:dernierz]59 domdef, glamt[firstx, 0], glamv[lastx, 0] $ 60 , gphit[0, firsty], gphiv[0, lasty], gridtype = ['T','V'] 61 END 62 'z':BEGIN 63 divi = e3w[firstz:lastz] 59 64 newmask = mask 60 65 vargrid = 'W' … … 65 70 'W':BEGIN 66 71 case direc of 67 'x':divi = e1u[ premierx:dernierx, premiery:derniery]68 'y':divi = e2v[ premierx:dernierx, premiery:derniery]69 'z':BEGIN 70 divi = e3t[ premierz:dernierz]72 'x':divi = e1u[firstx:lastx, firsty:lasty] 73 'y':divi = e2v[firstx:lastx, firsty:lasty] 74 'z':BEGIN 75 divi = e3t[firstz:lastz] 71 76 newmask = mask 72 77 vargrid = 'T' … … 78 83 case direc of 79 84 'x':BEGIN 80 divi = (shift(e1t, -1, 0))[ premierx:dernierx, premiery:derniery]81 newmask = tmask[ premierx:dernierx, premiery:derniery, premierz:dernierz]85 divi = (shift(e1t, -1, 0))[firstx:lastx, firsty:lasty] 86 newmask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] 82 87 vargrid = 'T' 83 domdef, glamt[ premierx, 0], glamu[dernierx] $84 , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U']88 domdef, glamt[firstx, 0], glamu[lastx] $ 89 , gphit[0, firsty], gphiu[0, lasty], gridtype = ['T','U'] 85 90 END 86 91 'y':BEGIN 87 divi = e2f[ premierx:dernierx, premiery:derniery]88 newmask = (fmask())[ premierx:dernierx, premiery:derniery, premierz:dernierz]92 divi = e2f[firstx:lastx, firsty:lasty] 93 newmask = (fmask())[firstx:lastx, firsty:lasty, firstz:lastz] 89 94 vargrid = 'F' 90 domdef, glamu[ premierx, 0], glamf[dernierx, 0] $91 , gphiu[0, premiery], gphif[0, derniery], grille = ['U','F']92 END 93 'z':BEGIN 94 divi = e3w[ premierz:dernierz]95 domdef, glamu[firstx, 0], glamf[lastx, 0] $ 96 , gphiu[0, firsty], gphif[0, lasty], gridtype = ['U','F'] 97 END 98 'z':BEGIN 99 divi = e3w[firstz:lastz] 95 100 newmask = mask 96 101 vargrid = 'W' … … 102 107 case direc of 103 108 'x':BEGIN 104 divi = e1f[ premierx:dernierx, premiery:derniery]105 newmask = (fmask())[ premierx:dernierx, premiery:derniery, premierz:dernierz]109 divi = e1f[firstx:lastx, firsty:lasty] 110 newmask = (fmask())[firstx:lastx, firsty:lasty, firstz:lastz] 106 111 vargrid = 'F' 107 domdef, glamv[ premierx, 0], glamf[dernierx, 0] $108 , gphiv[0, premiery], gphif[0, derniery], grille = ['V','F']112 domdef, glamv[firstx, 0], glamf[lastx, 0] $ 113 , gphiv[0, firsty], gphif[0, lasty], gridtype = ['V','F'] 109 114 END 110 115 'y':BEGIN 111 divi = (shift(e2t, 0, -1))[ premierx:dernierx, premiery:derniery]112 newmask = tmask[ premierx:dernierx, premiery:derniery, premierz:dernierz]116 divi = (shift(e2t, 0, -1))[firstx:lastx, firsty:lasty] 117 newmask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] 113 118 vargrid = 'T' 114 domdef, glamt[ premierx, 0], glamv[dernierx, 0] $115 , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V']116 END 117 'z':BEGIN 118 divi = e3w[ premierz:dernierz]119 domdef, glamt[firstx, 0], glamv[lastx, 0] $ 120 , gphit[0, firsty], gphiv[0, lasty], gridtype = ['T','V'] 121 END 122 'z':BEGIN 123 divi = e3w[firstz:lastz] 119 124 newmask = mask 120 125 vargrid = 'W' … … 125 130 ; 'F':BEGIN 126 131 ; case direc of 127 ; 'x':divi = (shift(e1v, -1, 0))[ premierx:dernierx, premiery:derniery]128 ; 'y':divi = (shift(e2u, 0, -1))[ premierx:dernierx, premiery:derniery]129 ; 'z':divi = e3w[ premierz:dernierz]132 ; 'x':divi = (shift(e1v, -1, 0))[firstx:lastx, firsty:lasty] 133 ; 'y':divi = (shift(e2u, 0, -1))[firstx:lastx, firsty:lasty] 134 ; 'z':divi = e3w[firstz:lastz] 130 135 ; ELSE:return, report('Bad definition of direction argument') 131 136 ; endcase … … 139 144 ;---------------------------------------------------------------------------- 140 145 taille[0] EQ 2:BEGIN 141 earth = where(mask[*, *, premierz] EQ 0)146 earth = where(mask[*, *, firstz] EQ 0) 142 147 if earth[0] NE -1 then res[earth] = !values.f_nan 143 148 case direc of 144 149 'x':BEGIN 145 150 res = (shift(res, -1, 0)-res)/divi 146 if key_periodi queEQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan151 if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan 147 152 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0) 148 153 END … … 154 159 ELSE:return, report('Bad definition of direction argument for the type of array') 155 160 ENDCASE 156 earth = where(newmask[*, *, premierz] EQ 0)161 earth = where(newmask[*, *, firstz] EQ 0) 157 162 if earth[0] NE -1 then res[earth] = valmask 158 163 END … … 161 166 ;---------------------------------------------------------------------------- 162 167 taille[0] EQ 3 AND jpt NE 1:BEGIN 163 earth = where(mask[*, *, premierz] EQ 0)168 earth = where(mask[*, *, firstz] EQ 0) 164 169 if earth[0] NE -1 then BEGIN 165 170 earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt)) … … 170 175 'x':BEGIN 171 176 res = (shift(res, -1, 0, 0)-res)/divi 172 if key_periodi queEQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan177 if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 173 178 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0) 174 179 END … … 180 185 ELSE:return, report('Bad definition of direction argument for the type of array') 181 186 ENDCASE 182 earth = where(newmask[*, *, premierz] EQ 0) 183 if earth[0] NE -1 then BEGIN 184 earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt)) 185 res[earth] = valmask 186 ENDIF 187 earth = where(newmask[*, *, firstz] EQ 0) 188 if earth[0] NE -1 THEN res[earth] = valmask 187 189 END 188 190 ;---------------------------------------------------------------------------- … … 196 198 divi = divi[*]#replicate(1, nz) 197 199 res = (shift(res, -1, 0, 0)-res)/divi 198 if key_periodi queEQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan200 if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 199 201 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0) 200 202 END … … 227 229 if earth[0] NE -1 then res[earth] = !values.f_nan 228 230 case direc OF 231 'x':BEGIN 232 divi = divi[*]#replicate(1, nz*jpt) 233 res = (shift(res, -1, 0, 0, 0)-res)/divi 234 if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *, *] = !values.f_nan 235 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0, 0) 236 END 237 'y':BEGIN 238 divi = divi[*]#replicate(1, nz*jpt) 239 res = (shift(res, 0, -1, 0, 0)-res)/divi 240 res[*, ny-1, *, *] = !values.f_nan 241 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(res, 0, 1, 0, 0) 242 END 229 243 'z':BEGIN 230 244 divi = replicate(1, nx*ny)#divi … … 238 252 res[*, *, nz-1, *] = !values.f_nan 239 253 ENDELSE 240 if earth[0] NE -1 then res[earth] = valmask241 END242 ENDCASE254 END 255 ENDCASE 256 if earth[0] NE -1 then res[earth] = valmask 243 257 END 244 258 ;------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.