- Timestamp:
- 03/16/07 10:22:26 (17 years ago)
- Location:
- trunk/SRC
- Files:
-
- 85 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Calendar/julday.pro
r205 r226 4 4 ; Calculate the Julian Day Number for a given month, day, and year. 5 5 ; This is the inverse of the library function CALDAT. 6 ; 3 calendars are available according to the value of key_caltype 6 ; 3 calendars are available according to the value of key_caltype 7 7 ; (variable of the common file cm_4cal): 'greg', '360d', 'noleap' 8 8 ; 9 9 ; @categories Calendar 10 10 ; 11 ; @param MONTH {in}{required} 12 ; Number of the desired month (1 = January, ..., 12 = December). 11 ; @param MONTH {in}{required} 12 ; Number of the desired month (1 = January, ..., 12 = December). 13 13 ; Can be scalar or array 14 14 ; 15 ; @param DAY {in}{required} 15 ; @param DAY {in}{required} 16 16 ; Number of day of the month.Can be scalar or array 17 17 ; 18 ; @param YEARin {in}{required} 18 ; @param YEARin {in}{required} 19 19 ; Number of the desired year.Year parameters must be valid 20 20 ; values from the civil calendar. Years B.C.E. are represented … … 22 22 ; as positive integers. In particular, note that there is no 23 23 ; year 0 in the civil calendar. 1 B.C.E. (-1) is followed by 24 ; 1 C.E. (1). 25 ; Change: However for climatological year, we do accept the year 24 ; 1 C.E. (1). 25 ; Change: However for climatological year, we do accept the year 26 26 ; O but we change it for year 654321L (the same trick is done in 27 27 ; caldat so caldat, julday(1,1,0) gives you back Jan 1st of year 0) 28 28 ; Can be scalar or array 29 29 ; 30 ; @param HOUR {in}{optional}{default=12} 30 ; @param HOUR {in}{optional}{default=12} 31 31 ; Number of the hour of the day. Can be scalar or array 32 32 ; … … 37 37 ; Number of the second of the minute. Can be scalar or array 38 38 ; 39 ; @restrictions 39 ; @restrictions 40 40 ; The Result will have the same dimensions as the smallest array, or 41 41 ; will be a scalar if all arguments are scalars. 42 ; 43 ; @keyword NDAYSPM {default=30} 42 ; 43 ; @keyword NDAYSPM {default=30} 44 44 ; To use a calendar with fixed number of days per months. 45 45 ; see also the use of key_caltype (variable of the common file cm_4cal) 46 46 ; 47 ; @returns 47 ; @returns 48 48 ; the Julian Day Number (which begins at noon) of the specified calendar date. 49 ; If Hour, Minute, and Second are not specified, then the result will be a 50 ; long integer, otherwise the result is a double precision floating point 49 ; If Hour, Minute, and Second are not specified, then the result will be a 50 ; long integer, otherwise the result is a double precision floating point 51 51 ; number. 52 52 ; 53 53 ; @uses cm_4cal 54 54 ; 55 ; @restrictions 55 ; @restrictions 56 56 ; Accuracy using IEEE double precision numbers is approximately 57 57 ; 1/10000th of a second, with higher accuracy for smaller (earlier) 58 58 ; Julian dates. 59 59 ; 60 ; @history 60 ; @history 61 61 ; Translated from "Numerical Recipies in C", by William H. Press, 62 62 ; Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. … … 75 75 ; eg. julday(349,1,1970) 76 76 ; 77 ; Sebastien Masson, May 2006, add dif erent calendat with key_caltype77 ; Sebastien Masson, May 2006, add different calendat with key_caltype 78 78 ; (variable of the common file cm_4cal) 79 79 ; 80 ; @version $Id$ 80 ; @version 81 ; $Id$ 81 82 ;- 82 83 ; … … 224 225 RETURN, jul 225 226 226 END 227 END 227 228 '360d':BEGIN 228 229 ; … … 240 241 IF neg[0] NE -1 THEN L_YEAR[neg] = L_YEAR[neg]+1 241 242 242 JUL = ((L_YEAR-1)*12 + (L_MONTH-1))* ndayspm + L_DAY 243 JUL = ((L_YEAR-1)*12 + (L_MONTH-1))* ndayspm + L_DAY 243 244 if n_elements(Hour) + n_elements(Minute) + n_elements(Second) eq 0 then $ 244 245 return, JUL … … 246 247 if n_elements(Minute) eq 0 then Minute = 0 247 248 if n_elements(Second) eq 0 then Second = 0 248 249 249 250 IF total([hour NE 12, minute NE 0, second NE 0]) EQ 0 THEN return, JUL ELSE $ 250 251 return, JUL + (Hour / 24.0d0 - 0.5d) + (Minute/1440.0d0) + (Second / 86400.0d0) 251 252 252 END 253 END 253 254 'noleap':BEGIN 254 255 … … 279 280 if n_elements(Minute) eq 0 then Minute = 0 280 281 if n_elements(Second) eq 0 then Second = 0 281 282 282 283 IF total([hour NE 12, minute NE 0, second NE 0]) EQ 0 THEN return, JUL ELSE $ 283 284 return, JUL + (Hour / 24.0d0 - 0.5d) + (Minute/1440.0d0) + (Second / 86400.0d0) 284 285 285 END 286 END 286 287 ELSE:return, report('only 3 types of calendar are accepted: greg, 360d and noleap') 287 288 ENDCASE -
trunk/SRC/Colors/newpalette.pro
r163 r226 2 2 ;+ 3 3 ; 4 ; @file_comments 4 ; @file_comments 5 5 ; Allows to save the palette which is on the screen 6 6 ; in a same type file than the one given by default in IDL 7 7 ; 'colors1.tbl'. 8 8 ; 9 ; @categories 9 ; @categories 10 10 ; Color 11 11 ; … … 13 13 ; a string containing the name of the new palette we want to write. 14 14 ; 15 ; @keyword OVER 15 ; @keyword OVER 16 16 ; the number of the palette we want to replace 17 17 ; … … 19 19 ; The file containing the color palettes. It can be in any directory of the !path. 20 20 ; 21 ; @keyword _EXTRA 21 ; @keyword _EXTRA 22 22 ; Used to pass modifyct keywords 23 23 ; … … 45 45 ; is nametbl belongs to the same effective user ID (UID) as the IDL process? 46 46 IF !d.name EQ 'X' THEN BEGIN ; works only for unix tye machine 47 IF file_test(nametbl, /user) NE 1 THEN BEGIN 48 noanswer = report('The file '+nametbl+' is not yours... Do you want to copy '+nameshort+' in your MyIDL di ectory: '+homedir+' ?', /default_no, /question)49 IF noanswer THEN return ELSE BEGIN 47 IF file_test(nametbl, /user) NE 1 THEN BEGIN 48 noanswer = report('The file '+nametbl+' is not yours... Do you want to copy '+nameshort+' in your MyIDL directory: '+homedir+' ?', /default_no, /question) 49 IF noanswer THEN return ELSE BEGIN 50 50 file_copy, nametbl, homedir ; copy the file 51 51 nametbl = homedir + nametbl ; update its name … … 54 54 ENDIF 55 55 ; no file nametbl found 56 ENDIF ELSE BEGIN 56 ENDIF ELSE BEGIN 57 57 nametbl = file_basename(namesave) ; get back the original nametbl 58 noanswer = report('The file '+nametbl+' was not found !path directories... Do you want to create such a file in your MyIDL di ectory: '+homedir+' ?', /default_no, /question)58 noanswer = report('The file '+nametbl+' was not found !path directories... Do you want to create such a file in your MyIDL directory: '+homedir+' ?', /default_no, /question) 59 59 if NOT noanswer then return 60 nameorg = filepath('colors1.tbl', subdir = ['resource', 'colors']) 60 nameorg = filepath('colors1.tbl', subdir = ['resource', 'colors']) 61 61 file_copy, nameorg, homedir 62 ENDELSE 62 ENDELSE 63 63 ; is nametbl writable? 64 64 IF file_test(nametbl, /write) NE 1 THEN file_chmod, nametbl, /u_write 65 65 ; make sure that we will really use nametbl name even if _EXTRA keyword is used 66 if n_elements(ex) NE 0 then $ 66 if n_elements(ex) NE 0 then $ 67 67 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl 68 68 ; -
trunk/SRC/Computation/curl.pro
r168 r226 9 9 ; @categories 10 10 ; Calculation 11 ; 11 ; 12 12 ; @param UU 13 13 ; Matrix representing the zonal coordinates (U point) of a field of vectors 14 14 ; A 2D (xy), 3D (xyz or yt) or a structure readable by litchamp and containing 15 15 ; a 2D (xy), 3D (xyz or yt) array (4d case is not coded yet). 16 ; note that the dimension of the arr y must suit the domain dimension.17 ; 18 ; @param VV 16 ; note that the dimension of the array must suit the domain dimension. 17 ; 18 ; @param VV 19 19 ; Matrix representing the meridional coordinates (V point) of a field of vectors 20 20 ; A 2D (xy), 3D (xyz or yt) or a structure readable by litchamp and containing 21 21 ; a 2D (xy), 3D (xyz or yt) array (4d case is not coded yet). 22 ; note that the dimension of the arr y must suit the domain dimension.22 ; note that the dimension of the array must suit the domain dimension. 23 23 ; 24 24 ; @keyword DIREC {type=scalar string} … … 30 30 ; 31 31 ; @uses 32 ; cm_4cal, cm_4data, cm_4mmesh 32 ; cm_4cal, cm_4data, cm_4mmesh 33 33 ; 34 34 ; @restrictions 35 35 ; 36 ; - Works only for Arakawa C-grid. 36 ; - Works only for Arakawa C-grid. 37 37 ; - UU must be on U grid, VV must be on V grid 38 38 ; - 4d case is not coded yet 39 39 ; - the common variable jpt is used to differ xyz (jpt=1) and xyt (jpt\=1) cases. 40 ; - U and V arrays are cut in the same geographic domain. Because of the shift between 41 ; T, U, V and F grids, it is possible that these two arrays do not have the same 42 ; size and refer to different indexes. In this case, arrays are re-cut on 40 ; - U and V arrays are cut in the same geographic domain. Because of the shift between 41 ; T, U, V and F grids, it is possible that these two arrays do not have the same 42 ; size and refer to different indexes. In this case, arrays are re-cut on 43 43 ; common indexes. To avoid these re-cuts, use the keyword /memeindice in domdef.pro 44 44 ; - When computing the divergence, we update, vargrid, varname, varunits and the 45 45 ; grid position parameters (firstxf, lastxf, nxf, firstyf, lastyf, nyf). 46 ; - points that cannot be computed (domain bo ndaries, coastline) are set to NaN46 ; - points that cannot be computed (domain boundaries, coastline) are set to NaN 47 47 ; 48 48 ; @examples … … 50 50 ; IDL> plt, curl(dist(jpi,jpj), dist(jpi,jpj)) 51 51 ; 52 ; @history 52 ; @history 53 53 ; Guillaume Roullet (grlod\@ipsl.jussieu.fr) 54 54 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 55 55 ; adaptation to work with a reduce domain 56 56 ; 21/5/1999: missing values at !values.f_nan 57 ; 57 ; 58 58 ; @version 59 59 ; $Id$ 60 60 ; 61 ; @todo 61 ; @todo 62 62 ; code the 4d case 63 63 ;- … … 71 71 @cm_4cal ; for jpt 72 72 @cm_4data ; for varname, vargrid, vardate, varunit, valmask 73 @cm_4mesh 73 @cm_4mesh 74 74 ; 75 75 tempsun = systime(1) ; To key_performance … … 84 84 szu = size(u) 85 85 szv = size(v) 86 86 87 87 if szu[0] NE szv[0] then return, report('U and V input data must have the same number of dimensions') 88 88 … … 96 96 indiceyv = (lindgen(jpj))[firstyv:firstyv+nyv-1] 97 97 indicey = inter(indiceyu, indiceyv) 98 nx = n_elements(indicex) 98 nx = n_elements(indicex) 99 99 ny = n_elements(indicey) 100 100 indice2d = lindgen(jpi, jpj) … … 105 105 varunits = 's-1' 106 106 if n_elements(valmask) EQ 0 THEN valmask = 1e20 107 firstxt = indicex[0] & lastxt = indicex[0]+nx-1 & nxt = nx 107 firstxt = indicex[0] & lastxt = indicex[0]+nx-1 & nxt = nx 108 108 firstyt = indicey[0] & lastyt = indicey[0]+ny-1 & nyt = ny 109 109 ;---------------------------------------------------------------------------- … … 113 113 ;xyz 114 114 ;---------------------------------------------------------------------------- 115 szu[0] EQ 3 AND jpt EQ 1:BEGIN 115 szu[0] EQ 3 AND jpt EQ 1:BEGIN 116 116 ;------------------------------------------------------------ 117 117 ; extraction of U and V on the appropriated domain … … 119 119 case 1 of 120 120 szu[1] EQ nxu AND szu[2] EQ nyu AND $ 121 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 121 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 122 122 case 1 of 123 123 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] … … 129 129 END 130 130 szu[1] EQ jpi AND szu[2] EQ jpj AND $ 131 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 131 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 132 132 u = u[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] 133 133 v = v[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] … … 142 142 landu = where(coefu EQ 0) 143 143 if landu[0] NE -1 then coefu[temporary(landu)] = !values.f_nan 144 144 145 145 coefv = ((e2v[indice2d])[*]#replicate(1., nzt)) $ 146 146 *(vmask())[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, firstzt:lastzt] … … 175 175 ;---------------------------------------------------------------------------- 176 176 ;---------------------------------------------------------------------------- 177 szu[0] EQ 3 AND jpt GT 1:BEGIN 177 szu[0] EQ 3 AND jpt GT 1:BEGIN 178 178 ;------------------------------------------------------------ 179 179 ; extraction of U and V on the appropriated domain … … 181 181 case 1 of 182 182 szu[1] EQ nxu AND szu[2] EQ nyu AND $ 183 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 183 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 184 184 if nxu NE nx then $ 185 if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 185 if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 186 186 IF nxv NE nx THEN $ 187 187 if indicex[0] EQ firstxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *] 188 188 IF nyu NE ny THEN $ 189 if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 189 if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 190 190 IF nyv NE ny THEN $ 191 191 if indicey[0] EQ firstyv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *] 192 192 END 193 193 szu[1] EQ jpi AND szu[2] EQ jpj AND $ 194 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 194 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 195 195 u = u[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] 196 196 v = v[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] 197 197 END 198 ELSE:BEGIN 198 ELSE:BEGIN 199 199 print, 'problemes d''adequation entre la taille du domaine et la taille des matrices necessaires a tracer des vecteurs' 200 200 return, -1 … … 240 240 ;---------------------------------------------------------------------------- 241 241 ;---------------------------------------------------------------------------- 242 szu[0] EQ 4:BEGIN 242 szu[0] EQ 4:BEGIN 243 243 return, report('Case not coded contact saxo team or make a do loop!') 244 244 END … … 248 248 ;---------------------------------------------------------------------------- 249 249 ;---------------------------------------------------------------------------- 250 szu[0] EQ 2:BEGIN 250 szu[0] EQ 2:BEGIN 251 251 ;------------------------------------------------------------ 252 252 ;------------------------------------------------------------ 253 253 case 1 of 254 254 szu[1] EQ nxu AND szu[2] EQ nyu AND $ 255 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 255 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 256 256 if nxu NE nx then $ 257 if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 257 if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 258 258 IF nxv NE nx THEN $ 259 259 if indicex[0] EQ firstxv then v = v[0:nx-1, *] ELSE v = v[1: nx, *] 260 260 IF nyu NE ny THEN $ 261 if indicey[0] EQ firstyu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 261 if indicey[0] EQ firstyu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 262 262 IF nyv NE ny THEN $ 263 263 if indicey[0] EQ firstyv then v = v[*, 0:ny-1] ELSE v = v[*, 1: ny] 264 264 END 265 265 szu[1] EQ jpi AND szu[2] EQ jpj AND $ 266 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 266 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 267 267 u = u[indice2d] 268 268 v = v[indice2d] … … 305 305 ENDCASE 306 306 ;------------------------------------------------------------ 307 if keyword_set(key_performance) THEN print, 'temps curl', systime(1)-tempsun 307 if keyword_set(key_performance) THEN print, 'temps curl', systime(1)-tempsun 308 308 309 309 return, psi -
trunk/SRC/Computation/div.pro
r168 r226 10 10 ; Calculation 11 11 ; 12 ; @param UU 12 ; @param UU 13 13 ; Matrix representing the zonal coordinates (U point) of a field of vectors 14 14 ; A 2D (xy), 3D (xyz or yt) or a structure readable by litchamp and containing 15 15 ; a 2D (xy), 3D (xyz or yt) array (4d case is not coded yet). 16 ; note that the dimension of the arr y must suit the domain dimension.17 ; 18 ; @param VV 16 ; note that the dimension of the array must suit the domain dimension. 17 ; 18 ; @param VV 19 19 ; Matrix representing the meridional coordinates (V point) of a field of vectors 20 20 ; A 2D (xy), 3D (xyz or yt) or a structure readable by litchamp and containing 21 21 ; a 2D (xy), 3D (xyz or yt) array (4d case is not coded yet). 22 ; note that the dimension of the arr y must suit the domain dimension.22 ; note that the dimension of the array must suit the domain dimension. 23 23 ; 24 24 ; @keyword DIREC {type=scalar string} … … 30 30 ; 31 31 ; @uses 32 ; cm_4cal, cm_4data, cm_4mmesh 32 ; cm_4cal, cm_4data, cm_4mmesh 33 33 ; 34 34 ; @restrictions 35 35 ; 36 ; - Works only for Arakawa C-grid. 36 ; - Works only for Arakawa C-grid. 37 37 ; - UU must be on U grid, VV must be on V grid 38 38 ; - 4d case is not coded yet 39 39 ; - the common variable jpt is used to differ xyz (jpt=1) and xyt (jpt\=1) cases. 40 ; - U and V arrays are cut in the same geographic domain. Because of the shift between 41 ; T, U, V and F grids, it is possible that these two arrays do not have the same 42 ; size and refer to different indexes. In this case, arrays are re-cut on 40 ; - U and V arrays are cut in the same geographic domain. Because of the shift between 41 ; T, U, V and F grids, it is possible that these two arrays do not have the same 42 ; size and refer to different indexes. In this case, arrays are re-cut on 43 43 ; common indexes. To avoid these re-cuts, use the keyword /memeindice in domdef.pro 44 44 ; - When computing the divergence, we update, vargrid, varname, varunits and the 45 45 ; grid position parameters (firstxt, lastxt, nxt, firstyt, lastyt, nyt). 46 ; - points that cannot be computed (domain bo ndaries, coastline) are set to NaN46 ; - points that cannot be computed (domain boundaries, coastline) are set to NaN 47 47 ; 48 48 ; @examples … … 58 58 ; $Id$ 59 59 ; 60 ; @todo 60 ; @todo 61 61 ; code the 4d case 62 62 ;- … … 70 70 @cm_4cal ; for jpt 71 71 @cm_4data ; for varname, vargrid, vardate, varunit, valmask 72 @cm_4mesh 72 @cm_4mesh 73 73 ; 74 74 tempsun = systime(1) ; For key_performance … … 83 83 szu = size(u) 84 84 szv = size(v) 85 85 86 86 if szu[0] NE szv[0] then return, report('U and V input data must have the same number of dimensions') 87 87 … … 95 95 indiceyv = (lindgen(jpj))[firstyv:firstyv+nyv-1] 96 96 indicey = inter(indiceyu, indiceyv) 97 nx = n_elements(indicex) 97 nx = n_elements(indicex) 98 98 ny = n_elements(indicey) 99 99 indice2d = lindgen(jpi, jpj) … … 104 104 varunits = '1.e6*s-1' 105 105 if n_elements(valmask) EQ 0 THEN valmask = 1.e20 106 firstxt = indicex[0] & lastxt = indicex[0]+nx-1 & nxt = nx 106 firstxt = indicex[0] & lastxt = indicex[0]+nx-1 & nxt = nx 107 107 firstyt = indicey[0] & lastyt = indicey[0]+ny-1 & nyt = ny 108 108 ;---------------------------------------------------------------------------- … … 112 112 ;xyz 113 113 ;---------------------------------------------------------------------------- 114 szu[0] EQ 3 AND jpt EQ 1:BEGIN 114 szu[0] EQ 3 AND jpt EQ 1:BEGIN 115 115 ;------------------------------------------------------------ 116 116 ; extraction of U and V on the appropriated domain … … 118 118 case 1 of 119 119 szu[1] EQ nxu AND szu[2] EQ nyu AND $ 120 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 120 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 121 121 case 1 of 122 122 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] … … 128 128 END 129 129 szu[1] EQ jpi AND szu[2] EQ jpj AND $ 130 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 130 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 131 131 u = u[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] 132 132 v = v[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] … … 168 168 ;---------------------------------------------------------------------------- 169 169 ;---------------------------------------------------------------------------- 170 szu[0] EQ 3 AND jpt GT 1:BEGIN 170 szu[0] EQ 3 AND jpt GT 1:BEGIN 171 171 ;------------------------------------------------------------ 172 172 ; extraction of U and V on the appropriated domain … … 174 174 case 1 of 175 175 szu[1] EQ nxu AND szu[2] EQ nyu AND $ 176 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 176 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 177 177 case 1 of 178 178 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] … … 184 184 END 185 185 szu[1] EQ jpi AND szu[2] EQ jpj AND $ 186 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 186 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 187 187 u = u[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] 188 188 v = v[indicex[0]:indicex[0]+nx-1, indicey[0]:indicey[0]+ny-1, *] … … 218 218 ; 219 219 land = where(tmask[indice2d+jpi*jpj*firstzt] EQ 0, cnt) 220 if land[0] NE -1 then BEGIN 220 if land[0] NE -1 then BEGIN 221 221 land = (temporary(land))#replicate(1L, jpt) + replicate(1L, cnt)#(nx*ny*lindgen(jpt)) 222 222 zdiv[temporary(land)] = valmask … … 229 229 ;---------------------------------------------------------------------------- 230 230 ;---------------------------------------------------------------------------- 231 szu[0] EQ 4:BEGIN 231 szu[0] EQ 4:BEGIN 232 232 return, report('Case not coded contact saxo team or make a do loop!') 233 233 END … … 237 237 ;---------------------------------------------------------------------------- 238 238 ;---------------------------------------------------------------------------- 239 szu[0] EQ 2:BEGIN 239 szu[0] EQ 2:BEGIN 240 240 ;------------------------------------------------------------ 241 241 ; extraction of U and V on the appropriated domain … … 243 243 case 1 of 244 244 szu[1] EQ nxu AND szu[2] EQ nyu AND $ 245 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 245 szv[1] EQ nxv AND szv[2] EQ nyv:BEGIN 246 246 case 1 of 247 247 nxu NE nx:if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] … … 253 253 END 254 254 szu[1] EQ jpi AND szu[2] EQ jpj AND $ 255 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 255 szv[1] EQ jpi AND szv[2] EQ jpj:BEGIN 256 256 u = u[indice2d] 257 257 v = v[indice2d] … … 291 291 ;---------------------------------------------------------------------------- 292 292 ELSE:return, report('U and V input arrays must have 2, 3 or 4 dimensions') 293 ENDCASE 294 ;------------------------------------------------------------ 295 if keyword_set(key_performance) THEN print, 'temps div', systime(1)-tempsun 296 293 ENDCASE 294 ;------------------------------------------------------------ 295 if keyword_set(key_performance) THEN print, 'temps div', systime(1)-tempsun 296 297 297 return, zdiv 298 298 end -
trunk/SRC/Computation/grad.pro
r168 r226 13 13 ; 3D (xyz or yt) or 4D (xyzt) array or a structure readable by litchamp 14 14 ; and containing a 2D (xy), 3D (xyz or yt) or 4D (xyzt) array. 15 ; note that the dimension of the arr y must suit the domain dimension.15 ; note that the dimension of the array must suit the domain dimension. 16 16 ; 17 17 ; @param DIREC {type=scalar string} … … 22 22 ; 23 23 ; @uses 24 ; cm_4cal, cm_4data, cm_4mmesh 24 ; cm_4cal, cm_4data, cm_4mmesh 25 25 ; 26 26 ; @restrictions 27 ; - Works only for Arakawa C-grid. 27 ; - Works only for Arakawa C-grid. 28 28 ; - When computing the gradient, the result is not on the same grid point 29 29 ; than the input data. In consequence, we update, vargrid and the grid position 30 30 ; parameters (firstx[tuvf], lastx[tuvf], nx[tuvf], firsty[tuvf], lasty[tuvf], 31 31 ; ny[tuvf], firstz[tw], lastz[tw], nz[tw]). 32 ; - points that cannot be computed (domain bo ndaries, coastline) are set to NaN32 ; - points that cannot be computed (domain boundaries, coastline) are set to NaN 33 33 ; - the common variable jpt is used to differ xyz (jpt=1) and xyt (jpt\=1) cases. 34 34 ; … … 54 54 @cm_4cal ; for jpt 55 55 @cm_4data ; for varname, vargrid, vardate, varunit, valmask 56 @cm_4mesh 56 @cm_4mesh 57 57 ;------------------------------------------------------------ 58 58 ; … … 64 64 szres = size(res) 65 65 grille, mask, glam, gphi, gdep, nx, ny, nz $ 66 , firstx, firsty, firstz, lastx, lasty, lastz 66 , firstx, firsty, firstz, lastx, lasty, lastz 67 67 ; 68 68 if n_elements(valmask) EQ 0 then valmask = 1.e20 … … 72 72 'T':BEGIN 73 73 case direc of 74 'x':BEGIN 74 'x':BEGIN 75 75 divi = e1u[firstx:lastx, firsty:lasty] 76 76 newmask = (umask())[firstx:lastx, firsty:lasty, firstz:lastz] 77 77 vargrid = 'U' 78 firstxu = firstxt & lastxu = lastxt & nxu = nxt 78 firstxu = firstxt & lastxu = lastxt & nxu = nxt 79 79 firstyu = firstyt & lastyu = lastyt & nyu = nyt 80 80 END … … 83 83 newmask = (vmask())[firstx:lastx, firsty:lasty, firstz:lastz] 84 84 vargrid = 'V' 85 firstxv = firstxt & lastxv = lastxt & nxv = nxt 85 firstxv = firstxt & lastxv = lastxt & nxv = nxt 86 86 firstyv = firstyt & lastyv = lastyt & nyv = nyt 87 87 END … … 90 90 newmask = mask 91 91 vargrid = 'W' 92 firstzw = firstzt & lastzw = lastzt & nzw = nzt 92 firstzw = firstzt & lastzw = lastzt & nzw = nzt 93 93 END 94 94 ELSE:return, report('Bad definition of direction argument') … … 97 97 'W':BEGIN 98 98 case direc of 99 'x':BEGIN 99 'x':BEGIN 100 100 divi = e1u[firstx:lastx, firsty:lasty] 101 101 newmask = (umask())[firstx:lastx, firsty:lasty, firstz:lastz] 102 102 vargrid = 'U' 103 firstxu = firstxt & lastxu = lastxt & nxu = nxt 103 firstxu = firstxt & lastxu = lastxt & nxu = nxt 104 104 firstyu = firstyt & lastyu = lastyt & nyu = nyt 105 105 END … … 108 108 newmask = (vmask())[firstx:lastx, firsty:lasty, firstz:lastz] 109 109 vargrid = 'V' 110 firstxv = firstxt & lastxv = lastxt & nxv = nxt 110 firstxv = firstxt & lastxv = lastxt & nxv = nxt 111 111 firstyv = firstyt & lastyv = lastyt & nyv = nyt 112 112 END … … 115 115 newmask = mask 116 116 vargrid = 'T' 117 firstzt = firstzw & lastzt = lastzw & nzt = nzw 117 firstzt = firstzw & lastzt = lastzw & nzt = nzw 118 118 END 119 119 ELSE:return, report('Bad definition of direction argument') … … 126 126 newmask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] 127 127 vargrid = 'T' 128 firstxt = firstxu & lastxt = lastxu & nxt = nxu 128 firstxt = firstxu & lastxt = lastxu & nxt = nxu 129 129 firstyt = firstyu & lastyt = lastyu & nyt = nyu 130 130 END … … 133 133 newmask = (fmask())[firstx:lastx, firsty:lasty, firstz:lastz] 134 134 vargrid = 'F' 135 firstxf = firstxu & lastxf = lastxu & nxf = nxu 135 firstxf = firstxu & lastxf = lastxu & nxf = nxu 136 136 firstyf = firstyu & lastyf = lastyu & nyf = nyu 137 137 END … … 140 140 newmask = mask 141 141 vargrid = 'W' 142 firstzw = firstzt & lastzw = lastzt & nzw = nzt 142 firstzw = firstzt & lastzw = lastzt & nzw = nzt 143 143 END 144 144 ELSE:return, report('Bad definition of direction argument') … … 165 165 newmask = mask 166 166 vargrid = 'W' 167 firstzw = firstzt & lastzw = lastzt & nzw = nzt 167 firstzw = firstzt & lastzw = lastzt & nzw = nzt 168 168 END 169 169 ELSE:return, report('Bad definition of direction argument') … … 191 191 if land[0] NE -1 then res[temporary(land)] = !values.f_nan 192 192 case direc of 193 'x':BEGIN 193 'x':BEGIN 194 194 res = (shift(res, -1, 0)-res)/temporary(divi) 195 195 if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan 196 196 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0) 197 197 END 198 'y':BEGIN 198 'y':BEGIN 199 199 res = (shift(res, 0, -1)-res)/temporary(divi) 200 200 res[*, ny-1] = !values.f_nan 201 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1) 201 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1) 202 202 END 203 203 ELSE:return, report('Bad definition of direction argument for the type of array') … … 217 217 divi = (temporary(divi))[*]#replicate(1., jpt) 218 218 case direc of 219 'x':BEGIN 219 'x':BEGIN 220 220 res = (shift(res, -1, 0, 0)-res)/temporary(divi) 221 221 if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 222 222 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0, 0) 223 223 END 224 'y':BEGIN 224 'y':BEGIN 225 225 res = (shift(res, 0, -1, 0)-res)/temporary(divi) 226 226 res[*, ny-1, *] = !values.f_nan 227 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0) 227 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0) 228 228 END 229 229 ELSE:return, report('Bad definition of direction argument for the type of array') … … 242 242 if land[0] NE -1 then res[temporary(land)] = !values.f_nan 243 243 case direc OF 244 'x':BEGIN 244 'x':BEGIN 245 245 divi = (temporary(divi))[*]#replicate(1., nz) 246 246 res = (shift(res, -1, 0, 0)-res)/temporary(divi) … … 248 248 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0, 0) 249 249 END 250 'y':BEGIN 250 'y':BEGIN 251 251 divi = (temporary(divi))[*]#replicate(1., nz) 252 252 res = (shift(res, 0, -1, 0)-res)/temporary(divi) 253 253 res[*, ny-1, *] = !values.f_nan 254 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0) 254 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0) 255 255 END 256 256 'z':BEGIN 257 257 divi = replicate(1., nx*ny)#(temporary(divi))[*] 258 258 if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz, /overwrite) 259 if vargrid EQ 'W' THEN BEGIN 259 if vargrid EQ 'W' THEN BEGIN 260 260 res = (shift(res, 0, 0, 1)-res)/temporary(divi) 261 261 res[*, *, 0] = !values.f_nan … … 279 279 ENDIF 280 280 case direc OF 281 'x':BEGIN 281 'x':BEGIN 282 282 divi = (temporary(divi))[*]#replicate(1., nz*jpt) 283 283 res = (shift(res, -1, 0, 0, 0)-res)/temporary(divi) … … 285 285 if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0, 0, 0) 286 286 END 287 'y':BEGIN 287 'y':BEGIN 288 288 divi = (temporary(divi))[*]#replicate(1., nz*jpt) 289 289 res = (shift(res, 0, -1, 0, 0)-res)/temporary(divi) 290 290 res[*, ny-1, *, *] = !values.f_nan 291 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0, 0) 291 if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0, 0) 292 292 END 293 293 'z':BEGIN … … 295 295 divi = (temporary(divi))[*]#replicate(1L, jpt) 296 296 if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz, jpt, /overwrite) 297 if vargrid EQ 'W' THEN BEGIN 297 if vargrid EQ 'W' THEN BEGIN 298 298 res = (shift(res, 0, 0, 1, 0)-res)/temporary(divi) 299 299 res[*, *, 0, *] = !values.f_nan -
trunk/SRC/Grid/checkperio.pro
r197 r226 8 8 ; @param file {in}{required}{type=scalar string} 9 9 ; A string giving the name of the NetCdf file 10 ; 10 ; 11 11 ; @keyword WRITE {default=0}{type=scalar: 0 or 1} 12 12 ; Define to 1 to write the good periodicity in the file. 13 ; By default print only mes age of periodicity errors13 ; By default print only message of periodicity errors 14 14 ; 15 15 ; @restrictions … … 38 38 ; @history 39 39 ; October 2006: Sebastien Masson (smasson\@locean-ipsl.upmc.fr) 40 ; 40 ; 41 41 ; @version 42 42 ; $Id$ … … 44 44 PRO checkperio, file, WRITE = write 45 45 46 IF file_test(file) EQ 0 THEN BEGIN 46 IF file_test(file) EQ 0 THEN BEGIN 47 47 print, 'file '+file+' not found' 48 48 RETURN … … 53 53 ; 54 54 dimsz = lonarr(finq.ndims) 55 FOR did = 0, finq.ndims-1 DO BEGIN 55 FOR did = 0, finq.ndims-1 DO BEGIN 56 56 ncdf_diminq, cdfid, did, name, size 57 57 dimsz[did] = size 58 58 ENDFOR 59 59 ; 60 FOR vid = 0, finq.nvars-1 DO BEGIN 60 FOR vid = 0, finq.nvars-1 DO BEGIN 61 61 vinq = ncdf_varinq(cdfid, vid) 62 62 IF vinq.ndims GE 2 THEN BEGIN … … 68 68 ; 2D VAR 69 69 ;------------------------------ 70 2:BEGIN 70 2:BEGIN 71 71 ; y periodicity (1) 72 72 CASE 1 OF … … 75 75 ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1], offset = [1, jpj-3] 76 76 part2 = reverse(shift(part2, -1)) 77 IF array_equal(part1, part2) NE 1 THEN BEGIN 77 IF array_equal(part1, part2) NE 1 THEN BEGIN 78 78 print, vinq.name+' bad y periodicity (1)' 79 79 IF keyword_set(write) THEN $ … … 85 85 ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1], offset = [1, jpj-2] 86 86 part2 = reverse(part2) 87 IF array_equal(part1, part2) NE 1 THEN BEGIN 87 IF array_equal(part1, part2) NE 1 THEN BEGIN 88 88 print, vinq.name+' bad y periodicity (1)' 89 89 IF keyword_set(write) THEN $ … … 99 99 ncdf_varget, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1], offset = [ 2, jpj-2] 100 100 part2 = reverse(part2) 101 IF array_equal(part1, part2) NE 1 THEN BEGIN 101 IF array_equal(part1, part2) NE 1 THEN BEGIN 102 102 print, vinq.name+' bad y periodicity (2)' 103 103 IF keyword_set(write) THEN $ … … 112 112 ncdf_varget, cdfid, vid, part1, count = [1, jpj], offset = [0, 0] 113 113 ncdf_varget, cdfid, vid, part2, count = [1, jpj], offset = [jpi-2, 0] 114 IF array_equal(part1, part2) NE 1 THEN BEGIN 114 IF array_equal(part1, part2) NE 1 THEN BEGIN 115 115 print, vinq.name+' bad x periodicity (1)' 116 116 IF keyword_set(write) THEN $ … … 120 120 ncdf_varget, cdfid, vid, part1, count = [1, jpj], offset = [jpi-1, 0] 121 121 ncdf_varget, cdfid, vid, part2, count = [1, jpj], offset = [1, 0] 122 IF array_equal(part1, part2) NE 1 THEN BEGIN 122 IF array_equal(part1, part2) NE 1 THEN BEGIN 123 123 print, vinq.name+' bad x periodicity (2)' 124 124 IF keyword_set(write) THEN $ … … 129 129 ; 3D VAR 130 130 ;------------------------------ 131 3:BEGIN 131 3:BEGIN 132 132 jpk = vdimsz[2] 133 133 ; y periodicity (1) … … 138 138 IF jpk EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, /over) 139 139 part2 = reverse(shift(part2, -1, 0, 0), 1) 140 IF array_equal(part1, part2) NE 1 THEN BEGIN 140 IF array_equal(part1, part2) NE 1 THEN BEGIN 141 141 print, vinq.name+' bad y periodicity (1)' 142 142 IF keyword_set(write) THEN $ … … 149 149 IF jpk EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, /over) 150 150 part2 = reverse(part2, 1) 151 IF array_equal(part1, part2) NE 1 THEN BEGIN 151 IF array_equal(part1, part2) NE 1 THEN BEGIN 152 152 print, vinq.name+' bad y periodicity (1)' 153 153 IF keyword_set(write) THEN $ … … 163 163 ncdf_varget, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1, jpk], offset = [ 2, jpj-2, 0] 164 164 part2 = reverse(part2, 1) 165 IF array_equal(part1, part2) NE 1 THEN BEGIN 165 IF array_equal(part1, part2) NE 1 THEN BEGIN 166 166 print, vinq.name+' bad y periodicity (2)' 167 167 IF keyword_set(write) THEN $ … … 176 176 ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk], offset = [0, 0, 0] 177 177 ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk], offset = [jpi-2, 0, 0] 178 IF array_equal(part1, part2) NE 1 THEN BEGIN 178 IF array_equal(part1, part2) NE 1 THEN BEGIN 179 179 print, vinq.name+' bad x periodicity (1)' 180 180 IF keyword_set(write) THEN $ … … 184 184 ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk], offset = [jpi-1, 0, 0] 185 185 ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk], offset = [1, 0, 0] 186 IF array_equal(part1, part2) NE 1 THEN BEGIN 186 IF array_equal(part1, part2) NE 1 THEN BEGIN 187 187 print, vinq.name+' bad x periodicity (2)' 188 188 IF keyword_set(write) THEN $ … … 193 193 ; 4D VAR 194 194 ;------------------------------ 195 4:BEGIN 195 4:BEGIN 196 196 jpk = vdimsz[2] 197 197 jpt = vdimsz[3] … … 203 203 IF jpt EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, jpt, /over) 204 204 part2 = reverse(shift(part2, -1, 0, 0, 0), 1) 205 IF array_equal(part1, part2) NE 1 THEN BEGIN 205 IF array_equal(part1, part2) NE 1 THEN BEGIN 206 206 print, vinq.name+' bad y periodicity (1)' 207 207 IF keyword_set(write) THEN $ … … 214 214 IF jpt EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, jpt, /over) 215 215 part2 = reverse(part2, 1) 216 IF array_equal(part1, part2) NE 1 THEN BEGIN 216 IF array_equal(part1, part2) NE 1 THEN BEGIN 217 217 print, vinq.name+' bad y periodicity (1)' 218 218 IF keyword_set(write) THEN $ … … 228 228 ncdf_varget, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1, jpk, jpt], offset = [ 2, jpj-2, 0, 0] 229 229 part2 = reverse(part2, 1) 230 IF array_equal(part1, part2) NE 1 THEN BEGIN 230 IF array_equal(part1, part2) NE 1 THEN BEGIN 231 231 print, vinq.name+' bad y periodicity (2)' 232 232 IF keyword_set(write) THEN $ … … 241 241 ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk, jpt], offset = [0, 0, 0, 0] 242 242 ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk, jpt], offset = [jpi-2, 0, 0, 0] 243 IF array_equal(part1, part2) NE 1 THEN BEGIN 243 IF array_equal(part1, part2) NE 1 THEN BEGIN 244 244 print, vinq.name+' bad x periodicity (1)' 245 245 IF keyword_set(write) THEN $ … … 249 249 ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk, jpt], offset = [jpi-1, 0, 0, 0] 250 250 ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk, jpt], offset = [1, 0, 0, 0] 251 IF array_equal(part1, part2) NE 1 THEN BEGIN 251 IF array_equal(part1, part2) NE 1 THEN BEGIN 252 252 print, vinq.name+' bad x periodicity (2)' 253 253 IF keyword_set(write) THEN $ … … 257 257 ELSE:print, vinq.name+' nothing to check' 258 258 ENDCASE 259 ENDIF 259 ENDIF 260 260 ENDFOR 261 261 -
trunk/SRC/Grid/computegrid.pro
r217 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; 8 8 ; compute the grid parameters (cm_4mesh) common … … 50 50 ; ccmeshparameters, ccreadparameters 51 51 ; 52 ; @categories 52 ; @categories 53 53 ; Grid 54 54 ; … … 72 72 ; optional if [XY]AXIS keyword is used or stepxin is a vector 73 73 ; 74 ; @param nyin {in}{optional}{type=scalar} 74 ; @param nyin {in}{optional}{type=scalar} 75 75 ; number of points in y direction, 76 76 ; optional if [XY]AXIS keyword is used or stepyin is a vector … … 111 111 ; 112 112 ; @keyword SHIFT {default=computed according to glamboundary}{type=scalar} 113 ; Force the manual definition of the zonal shift that must be apply to the data. 113 ; Force the manual definition of the zonal shift that must be apply to the data. 114 114 ; The resulting value will be stored in the common (cm_4mesh) variable key_shift 115 115 ; Note that if key_periodic=0 then in any case key_shift = 0. … … 169 169 ; Activate when the model is a C grid based on a F point 170 170 ; (with a F point at the bottom-left corner and a T point at the 171 ; upper-right corner). In this case, we ignore 171 ; upper-right corner). In this case, we ignore 172 172 ; - the first line of F and V points 173 173 ; - the last line of T and U points … … 181 181 ; Activate when the model is a C grid based on a U point 182 182 ; (with a U point at the bottom-left corner and a T point at the 183 ; upper-right corner). In this case, we ignore 183 ; upper-right corner). In this case, we ignore 184 184 ; - if the grid is not x-periodic, the first column of F and U points 185 185 ; - if the grid is not x-periodic, the last column of T and V points. … … 191 191 ; Activate when the model is a C grid based on a V point 192 192 ; (with a V point at the bottom-left corner and a T point at the 193 ; upper-right corner). In this case, we ignore 193 ; upper-right corner). In this case, we ignore 194 194 ; - the first line of F and V points 195 195 ; - the last line of T and U points … … 203 203 ; Used when the model is a ROMS C-grid with one more point 204 204 ; in longitude for T and V grid and one more point in latitude 205 ; for T and U grid. In this case, we ignore 205 ; for T and U grid. In this case, we ignore 206 206 ; - the last line of T and U points 207 207 ; - the last column of T and V points. … … 215 215 ; Specify the vertical axis. Must be sorted in the increasing or deceasing order 216 216 ; 217 ; @keyword _EXTRA 217 ; @keyword _EXTRA 218 218 ; (not used in the present case...) 219 219 ; 220 220 ; @uses cm_4mesh cm_4data cm_4cal 221 221 ; 222 ; @restrictions if the grid has x/y periodicity o rverlap and/or if222 ; @restrictions if the grid has x/y periodicity overlap and/or if 223 223 ; the mask has 0 everywhere at the border (like a close sea) and 224 224 ; if (we did not activate /plain and xminmesh, xmaxmesh, yminmesh, … … 230 230 ; @restrictions FUV points definition is not exact if the grid is irregular 231 231 ; 232 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 232 ; @history 233 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 233 234 ; 2000-04-20 234 ; Sept 2004, several bug fix sto suit C grid type...235 ; Sept 2004, several bug fix to suit C grid type... 235 236 ; Aug 2005, rewritte almost everything... 236 237 ; 237 ; @version $Id$ 238 ; @version 239 ; $Id$ 238 240 ; 239 241 ;- … … 996 998 gdepw = gdept 997 999 ENDELSE 998 IF keyword_set(romsh) THEN gdepw = gdept 1000 IF keyword_set(romsh) THEN gdepw = gdept 999 1001 ; 1000 1002 ;==================================================== … … 1020 1022 tmask = tmask[*]#replicate(1, jpkglo) 1021 1023 tmask = reform(tmask, jpiglo, jpjglo, jpkglo, /overwrite) 1022 ENDIF 1024 ENDIF 1023 1025 IF jpiglo EQ 1 OR jpjglo EQ 1 THEN tmask = reform(tmask, jpiglo, jpjglo, jpkglo, /overwrite) 1024 1026 tmask = byte(tmask[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh, izminmesh:izmaxmesh]) -
trunk/SRC/Grid/ncdf_meshread.pro
r216 r226 6 6 ; @file_comments read NetCDF meshmask file created by OPA 7 7 ; 8 ; @categories 8 ; @categories 9 9 ; Grid 10 10 ; … … 46 46 ; 47 47 ; @keyword SHIFT {default=computed according to glamboundary}{type=scalar} 48 ; Force the manual definition of the zonal shift that must be apply to the data. 48 ; Force the manual definition of the zonal shift that must be apply to the data. 49 49 ; The resulting value will be stored in the common (cm_4mesh) variable key_shift 50 50 ; Note that if key_periodic=0 then in any case key_shift = 0. … … 67 67 ; are equal to -1 they will be automatically defined 68 68 ; 69 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 69 ; @history 70 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 70 71 ; 12/1999 71 72 ; July 2004, Sebastien Masson: Several modifications (micromeshmask, … … 75 76 ; Aug. 2005, Sebastien Masson: some cleaning + english 76 77 ; 77 ; @version $Id$ 78 ; @version 79 ; $Id$ 78 80 ; 79 81 ;- … … 218 220 ; 219 221 IF array_equal(sort(xaxis), lindgen(jpi)) NE 1 THEN BEGIN 220 print, 'the x axis (1st line of glamt) is not sorted in the inc easing order after the automatic definition of key_shift'222 print, 'the x axis (1st line of glamt) is not sorted in the increasing order after the automatic definition of key_shift' 221 223 print, 'please use the keyword shift (and periodic) to suppress the automatic definition of key_shift (and key_periodic) and define by hand a more suitable value...' 222 224 widget_control, noticebase, bad_id = nothing, /destroy … … 405 407 tmask = byte(res) 406 408 ENDELSE 407 ; bou dary conditions used to compute umask.409 ; boundary conditions used to compute umask. 408 410 varcontient = ncdf_varinq(cdfid, 'umask') 409 411 name = varcontient.name … … 420 422 umaskred = reform(byte(res), /over) 421 423 ENDELSE 422 ; bou dary conditions used to compute fmask (1).424 ; boundary conditions used to compute fmask (1). 423 425 varcontient = ncdf_varinq(cdfid, 'fmask') 424 426 name = varcontient.name … … 433 435 fmaskredy = temporary(fmaskredy) MOD 2 434 436 ENDELSE 435 ; bou dary conditions used to compute vmask437 ; boundary conditions used to compute vmask 436 438 varcontient = ncdf_varinq(cdfid, 'vmask') 437 439 name = varcontient.name … … 459 461 vmaskred = reform(byte(res), /over) 460 462 ENDELSE 461 ; bou dary conditions used to compute fmask (2).463 ; boundary conditions used to compute fmask (2). 462 464 varcontient = ncdf_varinq(cdfid, 'fmask') 463 465 name = varcontient.name … … 509 511 ncdf_close, cdfid 510 512 ;------------------------------------------------------- 511 ; Apply Glambou dary513 ; Apply Glamboundary 512 514 ;------------------------------------------------------- 513 515 if keyword_set(glamboundary) AND key_onearth then BEGIN -
trunk/SRC/Grid/ncdf_meshroms.pro
r216 r226 6 6 ; @file_comments read NetCDF grid file created by ROMS 7 7 ; 8 ; @categories 8 ; @categories 9 9 ; Grid 10 10 ; … … 44 44 ; @keyword NRHO {default=1}{type=scalar} 45 45 ; Specify the number of rho level that contain the data we want to explore. 46 ; This is mainly useful when using xxx to get access to the de pper levers and vertical sections.46 ; This is mainly useful when using xxx to get access to the deeper levers and vertical sections. 47 47 ; 48 48 ; @keyword SHIFT {default=computed according to glamboundary}{type=scalar} 49 ; Force the manual definition of the zonal shift that must be apply to the data. 49 ; Force the manual definition of the zonal shift that must be apply to the data. 50 50 ; The resulting value will be stored in the common (cm_4mesh) variable key_shift 51 51 ; Note that if key_periodic=0 then in any case key_shift = 0. … … 77 77 ; 78 78 ; Scale factors are compuited using the distance between the points 79 ; (which is not the exact definition for irregulare grid). 80 ; 81 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) September 2006 82 ; 83 ; @version $Id$ 79 ; (which is not the exact definition for irregular grid). 80 ; 81 ; @history 82 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) September 2006 83 ; 84 ; @version 85 ; $Id$ 84 86 ; 85 87 ;- … … 197 199 ; 198 200 IF array_equal(sort(xaxis), lindgen(jpi)) NE 1 THEN BEGIN 199 print, 'the x axis (1st line of glamt) is not sorted in the inc easing order after the automatic definition of key_shift'201 print, 'the x axis (1st line of glamt) is not sorted in the increasing order after the automatic definition of key_shift' 200 202 print, 'please use the keyword shift (and periodic) to suppress the automatic definition of key_shift (and key_periodic) and define by hand a more suitable value...' 201 203 widget_control, noticebase, bad_id = nothing, /destroy -
trunk/SRC/Grid/restoreboxparam.pro
r155 r226 5 5 ; 6 6 ; @file_comments restore all the zoom parameters (defined by calling domdef) 7 ; p erviously defined by saveboxparam7 ; previously defined by saveboxparam 8 8 ; 9 ; @param filename {in}{required} 10 ; a scalar string defining the file name 9 ; @param filename {in}{required} 10 ; a scalar string defining the file name 11 11 ; 12 12 ; @uses cm_4mesh (and cm_demomode_used if we are in demo mode) 13 13 ; 14 ; @restrictions call def_myuniquetmpdir, if myuniquetmpdir is undefined: 14 ; @restrictions call def_myuniquetmpdir, if myuniquetmpdir is undefined: 15 15 ; => define, create and add it to !path 16 16 ; 17 17 ; @examples 18 18 ; IDL> restoreboxparam, filename 19 ; 19 ; 20 20 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 21 21 ; July 2005 … … 88 88 return 89 89 end 90 90 -
trunk/SRC/Grid/romsdepth.pro
r192 r226 16 16 ; common variable (cm_4mesh) romszinfos must be correctly defined 17 17 ; 18 ; @history 18 ; @history 19 19 ; Sept 2006 Sebastien Masson (smasson\@lodyc.jussieu.fr) 20 20 ; … … 41 41 grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 42 42 hroms = hroms[firstx:lastx, firsty:lasty] 43 nt = n_elements(zeta)/nx/ny 43 nt = n_elements(zeta)/nx/ny 44 44 ; 45 45 cff1 = 1./sinh(theta_s) … … 47 47 ; 48 48 IF type EQ 'W' THEN BEGIN 49 sc = (findgen(jpk)-jpk)/jpk 50 ; sc = (dindgen(jpk+1)-jpk)/jpk 49 sc = (findgen(jpk)-jpk)/jpk 50 ; sc = (dindgen(jpk+1)-jpk)/jpk 51 51 ; jpk = jpk+1 52 52 ENDIF ELSE BEGIN 53 sc = (findgen(jpk)-jpk-0.5+1)/jpk 53 sc = (findgen(jpk)-jpk-0.5+1)/jpk 54 54 ENDELSE 55 55 ; … … 60 60 hinv = 1./hroms 61 61 hinv = hinv[*]#replicate(1., jpk) 62 ; put a z dimens tion to zeta62 ; put a z dimension to zeta 63 63 zeta = transpose(temporary(zeta)) 64 64 zeta = reform((temporary(zeta))[*]#replicate(1., jpk), nt, ny, nx, jpk, /overwrite) -
trunk/SRC/Interpolation/compute_fromirr_bilinear_weigaddr.pro
r202 r226 5 5 ; to any grid using the bilinear method 6 6 ; 7 ; @categories 7 ; @categories 8 8 ; Interpolation 9 9 ; … … 53 53 ; June 2006: Sebastien Masson (smasson\@lodyc.jussieu.fr) 54 54 ; 55 ; @version $Id$ 55 ; @version 56 ; $Id$ 56 57 ; 57 58 ;- … … 65 66 ; 66 67 jpio = (size(olonin, /dimensions))[0] 67 jpjo = (size(olonin, /dimensions))[1] 68 jpjo = (size(olonin, /dimensions))[1] 68 69 ; mask check 69 70 IF n_elements(omsk) EQ 1 AND omsk[0] EQ -1 THEN omsk = replicate(1b, jpio, jpjo) … … 73 74 stop 74 75 ENDIF 75 IF n_elements(amsk) NE jpia*jpja THEN BEGIN 76 IF n_elements(amsk) NE jpia*jpja THEN BEGIN 76 77 print, 'output grid mask do not have the good size' 77 78 stop … … 181 182 ind = good[ind] 182 183 ; now, we morph the quadrilateral ocean cell into the reference square (0 -> 1) 183 ; in addition we get the co rrdinates of the atmospheric point in this new morphed square184 ; in addition we get the coordinates of the atmospheric point in this new morphed square 184 185 IF onsphere THEN BEGIN 185 186 ; Warning! quadrilateral2square use anticlockwise quadrilateral definition … … 213 214 xy[1] EQ 0 AND (tmpmsk[0]+tmpmsk[1]) EQ 0 : foraddr[n] = -1 214 215 xy[1] EQ 1 AND (tmpmsk[2]+tmpmsk[3]) EQ 0 : foraddr[n] = -1 215 ELSE: BEGIN 216 ELSE: BEGIN 216 217 ; we keep its address 217 218 foraddr[n] = ind -
trunk/SRC/Interpolation/compute_fromreg_bilinear_weigaddr.pro
r208 r226 4 4 ; "regular grid" to any grid using the bilinear method 5 5 ; 6 ; @categories 6 ; @categories 7 7 ; Interpolation 8 8 ; … … 21 21 ; @keyword NONORTHERNLINE {type=scalar 0 or 1}{default=0} 22 22 ; put 1 if you don't want to take into 23 ; account the northe n line of the input data when performing the interpolation.23 ; account the northern line of the input data when performing the interpolation. 24 24 ; 25 25 ; @keyword NOSOUTHERNLINE {type=scalar 0 or 1}{default=0} … … 48 48 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 49 49 ; 50 ; @version $Id$ 50 ; @version 51 ; $Id$ 51 52 ; 52 53 ;- … … 109 110 IF ma GE minalon+360. THEN stop 110 111 ; 111 ; we want to do bili ear interpolation => for each ocean point, we must112 ; we want to do bilinear interpolation => for each ocean point, we must 112 113 ; find in which atm cell it is located. 113 114 ; if the ocean point is out of the atm grid, we use closest neighbor 114 115 ; interpolation 115 116 ; 116 ; for each T point of oce grid, we find in which a rmospheric cell it is117 ; for each T point of oce grid, we find in which atmospheric cell it is 117 118 ; located. 118 119 ; As the atmospheric grid is regular, we can use inrecgrid instead -
trunk/SRC/Interpolation/compute_fromreg_imoms3_weigaddr.pro
r202 r226 5 5 ; "regular grid" to any grid using the imoms3 method 6 6 ; 7 ; @categories 7 ; @categories 8 8 ; Interpolation 9 9 ; … … 22 22 ; @keyword NONORTHERNLINE {type=scalar 0 or 1}{default=0} 23 23 ; put 1 if you don't want to take into 24 ; account the northe n line of the input data when performing the interpolation.24 ; account the northern line of the input data when performing the interpolation. 25 25 ; 26 26 ; @keyword NOSOUTHERNLINE {type=scalar 0 or 1}{default=0} -
trunk/SRC/Interpolation/extrapolate.pro
r202 r226 1 1 ;+ 2 2 ; @file_comments 3 ; extrapolate data (zinput) where maskinput eq 0 by filling step by 3 ; extrapolate data (zinput) where maskinput eq 0 by filling step by 4 4 ; step the coastline points with the mean value of the 8 neighbourgs 5 5 ; (weighted by their mask value). 6 6 ; 7 ; @categories 7 ; @categories 8 8 ; Interpolation 9 9 ; … … 47 47 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 48 48 ; 49 ; @version $Id$ 49 ; @version 50 ; $Id$ 50 51 ; 51 52 ;- … … 71 72 ztmp = bytarr(nx+2, ny+2) 72 73 IF n_elements(maskinput) EQ 1 AND maskinput[0] EQ -1 THEN maskinput = replicate(1b, nx, ny) 73 IF n_elements(maskinput) NE nx*ny THEN BEGIN 74 IF n_elements(maskinput) NE nx*ny THEN BEGIN 74 75 print, 'input grid mask do not have the good size' 75 76 return, -1 … … 97 98 ; 98 99 cnt = 1 99 ; When we look for the coast 100 ; When we look for the coastline, we don't want to select the 100 101 ; borderlines of the array. -> we force the value of the mask for 101 102 ; those lines. … … 109 110 WHILE cnt LE nb_iteration AND cnt_land NE 0 DO BEGIN 110 111 ;--------------------------------------------------------------- 111 ; find the coast 112 ; find the coastline points... 112 113 ;--------------------------------------------------------------- 113 114 ; Once the land points list has been found, we change back the the … … 148 149 weight = weight[temporary(ok)] 149 150 ;--------------------------------------------------------------- 150 ; fill the coast ine points151 ; fill the coastline points 151 152 ;--------------------------------------------------------------- 152 153 z = temporary(z)*msk -
trunk/SRC/Interpolation/extrapsmooth.pro
r202 r226 46 46 ;- 47 47 FUNCTION extrapsmooth, in, mskin, x_periodic = x_periodic, MINVAL = minval, MAXVAL = maxval, GE0 = ge0 48 ;49 compile_opt strictarr, strictarrsubs50 48 ; 51 sz = size(reform(in)) 52 IF sz[0] NE 2 THEN BEGIN 49 compile_opt strictarr, strictarrsubs 50 ; 51 sz = size(reform(in)) 52 IF sz[0] NE 2 THEN BEGIN 53 53 print, 'Input arrays must have 2 dimensions' 54 54 return, -1 … … 57 57 ny = sz[2] 58 58 IF n_elements(mskin) EQ 1 AND mskin[0] EQ -1 THEN mskin = replicate(1b, nx, ny) 59 IF n_elements(mskin) NE nx*ny THEN BEGIN 59 IF n_elements(mskin) NE nx*ny THEN BEGIN 60 60 print, 'input grid mask do not have the good size' 61 61 return, -1 … … 65 65 whmsk = where(mskin EQ 0, nbr) 66 66 IF nbr NE 0 THEN out[temporary(whmsk)] = !values.f_nan 67 ; add values on each side of the array to avoid bo ndary effects67 ; add values on each side of the array to avoid boundary effects 68 68 nx2 = nx/2 69 69 ny2 = ny/2 … … 74 74 add2 = out[nx-nx2:nx-1, *] 75 75 out = [add2, [temporary(out)], add1] 76 ENDIF ELSE BEGIN 76 ENDIF ELSE BEGIN 77 77 add = replicate(!values.f_nan, nx2, ny+2*ny2) 78 78 out = [add, [temporary(out)], add] -
trunk/SRC/Interpolation/get_gridparams.pro
r163 r226 142 142 1:BEGIN 143 143 IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 144 print, 'Longitudes are not the same for all latitudes, impos ible to extract a 1D array of the longitudes'144 print, 'Longitudes are not the same for all latitudes, impossible to extract a 1D array of the longitudes' 145 145 stop 146 146 ENDIF … … 163 163 1:BEGIN 164 164 IF array_equal(lat, replicate(1, jpi) # lat[0, *]) NE 1 THEN BEGIN 165 print, 'Latitudes are not the same for all longitudes, impos ible to extract a 1D array of the latitudes'165 print, 'Latitudes are not the same for all longitudes, impossible to extract a 1D array of the latitudes' 166 166 stop 167 167 ENDIF … … 184 184 1:BEGIN 185 185 IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 186 print, 'Longitudes are not the same for all latitudes, impos ible to extract a 1D array of the longitudes'186 print, 'Longitudes are not the same for all latitudes, impossible to extract a 1D array of the longitudes' 187 187 stop 188 188 ENDIF 189 189 lon = lon[*, 0] 190 190 IF array_equal(lat, replicate(1, jpi) # reform(lat[0, *])) NE 1 THEN BEGIN 191 print, 'Latitudes are not the same for all longitudes, impos ible to extract a 1D array of the latitudes'191 print, 'Latitudes are not the same for all longitudes, impossible to extract a 1D array of the latitudes' 192 192 stop 193 193 ENDIF -
trunk/SRC/Interpolation/inquad.pro
r163 r226 3 3 ; to find if an (x,y) point is in a quadrilateral (x1,x2,x3,x4) 4 4 ; 5 ; @categories 5 ; @categories 6 6 ; Grid 7 7 ; … … 205 205 ; 206 206 ; computation of test without any do loop for ntofind points (x,y) and 207 ; nquad quad ilateral((x1,x2,x3,x4),(y1,y2,y3,y4))207 ; nquad quadrilateral((x1,x2,x3,x4),(y1,y2,y3,y4)) 208 208 ; test dimensions are (ntofind, nquad) 209 209 ; column i of test corresponds to the intersection of point i with all 210 ; quad irlateral.210 ; quadrilateral. 211 211 ; row j of test corresponds to all the points localized in cell j 212 212 test = $ -
trunk/SRC/Obsolete/lec.pro
r157 r226 6 6 ; lit les fichiers Vairmer en sort: 7 7 ; un tableau 2d ou 3d en fonction de nomchamp qui est le nom 8 ; du champ a ext aire (2d s'il commence par SO et 3d s'il commence par VO)8 ; du champ a extraire (2d s'il commence par SO et 3d s'il commence par VO) 9 9 ; cette fonction modifie aussi les variables globales: 10 10 ; varname: trois lettres: nom de l'experience 11 11 ; vargrid: nom de la grille 12 12 ; vardate: date (yy)yymmdd 13 ; varexp: nom Vairmer du champ a t arcer13 ; varexp: nom Vairmer du champ a tracer 14 14 ; 15 15 ; @obsolete 16 16 ; 17 ; @categories 17 ; @categories 18 18 ; Graphics, Reading 19 19 ; … … 25 25 ; minuscule commencant par vo ou so). Dans cette methode on saute directement 26 26 ; d'en-tete en en-tete jusqu'a trouver le bon fichier. 27 ; 2) chaine de c haracteres commencant par vo ou so suivit du27 ; 2) chaine de caracteres commencant par vo ou so suivit du 28 28 ; numero de champ a aller chercher (par ex 'vo5'). Cette methode est un peu 29 29 ; plus rapide car elle va directement chercher le fichier qui nous interesse. … … 72 72 ; @uses common.pro isnumber.pro fivardate.pro 73 73 ; 74 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 74 ; @history 75 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 75 76 ; 26/5/98 76 77 ; Jerome Vialard : adaptation au format vairmer … … 82 83 ; 2/99 83 84 ; 84 ; @version $Id$ 85 ; @version 86 ; $Id$ 85 87 ; 86 88 ;;- … … 166 168 ; le fortran ajoute au debut et a la fin de chaque write 4 octets de controle 167 169 ; les reels du model sont codes sur 4 octets 168 ; un c haractere fait 1 octet170 ; un caractere fait 1 octet 169 171 ;----------------------------------------------------------------------- 170 ;4 chaines de 8 c haracteres+un tableau de reels+4 trucs de controle (pour les172 ;4 chaines de 8 caracteres+un tableau de reels+4 trucs de controle (pour les 171 173 ; 2 write): 172 174 if dim eq 'VO' then $ … … 229 231 ;--------------------------------------------------------------------- 230 232 if taillebloc*numerochamp gt infofichier.size then $ 231 return, report('Ce numero de champ n''exi te pas. Le fichier '+infofichier.name+' ne contient que ',infofichier.size/taillebloc,' champs.')233 return, report('Ce numero de champ n''existe pas. Le fichier '+infofichier.name+' ne contient que ',infofichier.size/taillebloc,' champs.') 232 234 ;--------------------------------------------------------------------- 233 235 ; lecture de l'en-tete numero numerochamp … … 306 308 ENDIF ELSE BEGIN 307 309 case vargrid OF ; on recupere le mask en entier ds le cas ou /TOUT 308 'U':mask = umask() ; n''est pas active et on le choisit en fon tion310 'U':mask = umask() ; n''est pas active et on le choisit en fonction 309 311 'T':mask = tmask ; de la valeur de vargrid 310 312 'W':mask = tmask -
trunk/SRC/Obsolete/meshlec.pro
r134 r226 58 58 tab = 'aaaaa' 59 59 ;--------------------------------------------------------- 60 ; definition du domaine de la grille sur lequel sont60 ; definition du domaine de la grille sur lequel sont 61 61 ; effectuees les sorties.les indices des tableaux commencant 62 62 ; a 1: cf le fichier wrivr2.F ds WKOPA sur le cray -
trunk/SRC/Obsolete/nlec.pro
r134 r226 221 221 endif 222 222 ;------------------------------------------------------------ 223 ; points a met re a nan223 ; points a mettre a nan 224 224 ;------------------------------------------------------------ 225 225 if n_elements(nan) NE 0 then BEGIN -
trunk/SRC/ReadWrite/idl-NetCDF/ncdf_quickread/ncdf_quickread_helper.pro
r163 r226 1 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 2 ; 3 ; ncdf_quickread_helper.pro - This file contains IDL functions to read netCDF 4 ; data files into IDL variables. 3 ; ncdf_quickread_helper.pro - This file contains IDL functions to read netCDF 4 ; data files into IDL variables. 5 5 ; 6 6 ; Adapted from CDF2IDL.pro … … 8 8 ; This file contains the following functions and procedures: 9 9 ; functions: 10 ; ncdf_quickread_getfile - strips the directory and optionally) any 10 ; ncdf_quickread_getfile - strips the directory and optionally) any 11 11 ; suffixes from the path+file 12 12 ; ncdf_quickread_getdir - returns the directory from the full path+file … … 25 25 ; 10 Jun 97 S. Rupert Modified keyword usage. 26 26 ; 03 Feb 98 S. Rupert Added additional error checking, and warning to 27 ; output script. 27 ; output script. 28 28 ; 17 Feb 98 S. Rupert Corrected validation routine to handle instance 29 29 ; of name strating with a number and containing a … … 58 58 ; @examples 59 59 ; Call: file = ncdf_quickread_getfile(fullpath) 60 ; 60 ; 61 61 ; @history 62 62 ; … … 68 68 on_error,2 69 69 compile_opt hidden 70 ; Retrieve the pos tion at which the first '/' character occurs from70 ; Retrieve the position at which the first '/' character occurs from 71 71 ; the end of the string. 72 72 dirlen = rstrpos(fullpath, '/') … … 111 111 ; @examples 112 112 ; Call: dir = ncdf_quickread_getdir(fullpath) 113 ; 113 ; 114 114 ; @history 115 115 ; … … 122 122 on_error,2 123 123 compile_opt hidden 124 ; Retrieve the pos tion at which the first '/' character occurs from124 ; Retrieve the position at which the first '/' character occurs from 125 125 ; the end of the string. 126 126 len = rstrpos(fullpath, '/') … … 139 139 ; @file_comments 140 140 ; This routine ensures that the given name does not start with a number, 141 ; nor contain a dash. IDL cannot accept a variable starting with a 142 ; number or containing a dash. If the name starts with a number, an 143 ; underscore is prepended to the name, and if it contains a dash, the 144 ; dash is replaced with an underscore. 141 ; nor contain a dash. IDL cannot accept a variable starting with a 142 ; number or containing a dash. If the name starts with a number, an 143 ; underscore is prepended to the name, and if it contains a dash, the 144 ; dash is replaced with an underscore. 145 145 ; 146 146 ; @categories … … 149 149 ; @param VARNAME 150 150 ; The name of the variable to be read 151 ; 151 ; 152 152 ; 153 153 ; @returns … … 158 158 ; 159 159 ; @examples 160 ; 161 ; 160 ; 161 ; 162 162 ; @history 163 163 ; … … 186 186 if (strpos(varname, '9') EQ 0) then name = strcompress("_"+varname) 187 187 188 ; If the name contains a dash replace it with an underscore. 188 ; If the name contains a dash replace it with an underscore. 189 189 if (strpos(name, '-') NE -1) then begin 190 190 pieces = str_sep(name, '-') … … 214 214 ; full path to netCDF file of interest 215 215 ; 216 ; @keyword VERBOSE 216 ; @keyword VERBOSE 217 217 ; Set this keyword to return an error message in case of an error. 218 218 ; … … 224 224 ; 225 225 ; @keyword REFORM 226 ; see changelog above .226 ; see changelog above 227 227 ; 228 228 ; @returns … … 233 233 ; 234 234 ; @examples 235 ; 236 ; 235 ; 236 ; 237 237 ; @history 238 238 ; … … 274 274 275 275 ; Place the desired variables in local arrays. 276 for i=0, ncidinfo.Nvars-1 do begin 276 for i=0, ncidinfo.Nvars-1 do begin 277 277 vardata = NCDF_VARINQ(ncid, i) 278 278 if not subset then begin … … 283 283 endelse 284 284 if wanted then begin 285 varname = ncdf_quickread_validatename(vardata.Name) 285 varname = ncdf_quickread_validatename(vardata.Name) 286 286 if keyword_set(prefix) then varname=prefix+varname 287 287 commands=$ … … 304 304 endfor 305 305 306 if (keyword_set(verbose)) then begin 306 if (keyword_set(verbose)) then begin 307 307 for i=0, ncidinfo.Ngatts-1 do begin 308 308 name = NCDF_ATTNAME(ncid, /GLOBAL, i) -
trunk/SRC/ReadWrite/readoldoparestart.pro
r163 r226 11 11 ; 12 12 ; @param PARAMS 13 ; 14 ; 13 ; 15 14 ; @param NUM 16 ; 17 ; 18 ; @restrictions 15 ; 16 ; @restrictions 19 17 ; bug for etab and etan written on the same record??? 20 18 ; 21 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 19 ; @history 20 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 22 21 ; June 2002 23 ; @version $Id$ 22 ; 23 ; @version 24 ; $Id$ 24 25 ;- 25 26 ;------------------------------------------------------------ … … 44 45 ; 45 46 ; @param PARAMS 46 ; 47 ; 47 ; 48 48 ; @param NUM 49 ; 50 ; 51 ; @historySebastien Masson (smasson\@lodyc.jussieu.fr)49 ; 50 ; @history 51 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 52 52 ; June 2002 53 53 ;- … … 66 66 ; based on the OPA subroutine dtrlec included at the end of the file. 67 67 ; 68 ; @categories 68 ; @categories 69 69 ; For OPA 70 70 ; … … 73 73 ; 74 74 ; @param JPIGLO {in}{required} 75 ; 76 ; 75 ; 77 76 ; @param JPJGLO {in}{required} 78 ; 79 ; 77 ; 80 78 ; @param JPK {in}{required} 81 79 ; dimensions of the opa grid 82 80 ; 83 ; @keyword IBLOC {default=4096L} 81 ; @keyword IBLOC {default=4096L} 84 82 ; Ibloc size 85 ; 83 ; 86 84 ; @keyword JPBYT {default=8L} 87 85 ; Jpbyt size 88 ; 89 ; @keyword NUMREC {default=19L*jpk} 86 ; 87 ; @keyword NUMREC {default=19L*jpk} 90 88 ; Number of records in the file 91 ; 89 ; 92 90 ; @keyword UB 93 ; 94 ; 91 ; 92 ; 95 93 ; @keyword VB 96 ; 97 ; 94 ; 95 ; 98 96 ; @keyword TB 99 ; 100 ; 97 ; 101 98 ; @keyword SB 102 ; 103 ; 99 ; 104 100 ; @keyword ROTB 105 ; 106 ; 101 ; 107 102 ; @keyword HDIVB 108 ; 109 ; 103 ; 110 104 ; @keyword UN 111 ; 112 ; 105 ; 113 106 ; @keyword VN 114 ; 115 ; 107 ; 116 108 ; @keyword TN 117 ; 118 ; 109 ; 119 110 ; @keyword SN 120 ; 121 ; 111 ; 122 112 ; @keyword ROTN 123 ; 124 ; 113 ; 125 114 ; @keyword HDIVN 126 ; 127 ; 115 ; 128 116 ; @keyword GCX 129 ; 130 ; 117 ; 131 118 ; @keyword GCXB 132 ; 133 ; 119 ; 134 120 ; @keyword ETAB 135 ; 136 ; 121 ; 137 122 ; @keyword ETAN 138 ; 139 ; 123 ; 140 124 ; @keyword BSFB 141 ; 142 ; 125 ; 143 126 ; @keyword BSFN 144 ; 145 ; 127 ; 146 128 ; @keyword BSFD 147 ; 148 ; 129 ; 149 130 ; @keyword EN 150 131 ; the variable we want to read. 151 132 ; 152 ; @returns 133 ; @returns 153 134 ; According to the given keywords. 154 ; 155 ; @restrictions 135 ; 136 ; @restrictions 156 137 ; Bug for etab and etan written on the same record??? 157 138 ; 158 ; @history 139 ; @history 159 140 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 160 141 ; June 2002 161 ; 142 ; 162 143 ; @version 163 144 ; $Id$ … … 458 439 ; IF(lwp) THEN 459 440 ; WRITE(numout,*) ' ===>>>> : the previous restart file', 460 ; $ ' did nt used tke scheme'441 ; $ ' did''nt used tke scheme' 461 442 ; WRITE(numout,*) ' ======= =======' 462 443 ; ENDIF -
trunk/SRC/Textoidl/translate_sub_super.pro
r163 r226 2 2 ; @file_comments 3 3 ; Return the proper IDL font positioning command for TeX 4 ; sub/superscripts. 4 ; sub/superscripts. 5 5 ; 6 6 ; @categories … … 25 25 ; function. So even if sub_sup_idl was declared with 26 26 ; FORWARD_FUNCTION in translate_sub_super, it would not properly 27 ; compile. 27 ; compile. 28 28 ; 29 29 ; The file translate_sub_super.pro contains two functions, … … 36 36 ; Used only by translate_sub_super. Should be kept in same 37 37 ; file. 38 ; 38 ; 39 39 ; @examples 40 40 ; … … 86 86 print, offset+offset+" or '!D' or '!I' for subscripts." 87 87 return, -1 88 ENDIF 89 90 IF keyword_set(force_ud) THEN BEGIN 91 IF (token EQ '^') THEN return, '!U' 88 ENDIF 89 90 IF keyword_set(force_ud) THEN BEGIN 91 IF (token EQ '^') THEN return, '!U' 92 92 IF (token EQ '_') THEN return, '!D' 93 93 return, '' 94 94 ENDIF ELSE BEGIN 95 IF (token EQ '^') THEN return, '!E' 95 IF (token EQ '^') THEN return, '!E' 96 96 IF (token EQ '_') THEN return, '!I' 97 97 return, '' 98 98 ENDELSE 99 99 100 100 END 101 101 … … 113 113 ; old -- string to be translated from TeX to IDL. in 114 114 ; KEYWORD PARAMETERS: 115 ; /RECURSED -- set if this function is being called 116 ; recursively. 115 ; /RECURSED -- set if this function is being called 116 ; recursively. 117 117 ; /HELP -- Set to print useful message and exit. 118 118 ; OUTPUTS: … … 130 130 ; out = translate_sub_super( 'N^2_{big}' ) 131 131 ; Then out='N!U2!N!Dbig!N' which looks like it should on the 132 ; display. 132 ; display. 133 133 ; LIBRARY FUNCTIONS CALLED: 134 134 ; str_token -- Text/string (mcraig) … … 195 195 print, offset+offset+"- Sub/superscripts may be nested (e.g. 'N^{N_1^N}')." 196 196 return, -1 197 ENDIF 197 ENDIF 198 198 199 199 ; To allow for nested scripts, use !E/!I instead of !U/!D for scripts … … 233 233 EndOfScript = 0 ;Position of end of this script. 234 234 IF (Script EQ '{') THEN BEGIN ; Scripts of more than 1 char. 235 EndOfScript = matchdelim(strn) 235 EndOfScript = matchdelim(strn) 236 236 Script = translate_sub_super(strmid(strn, 1, EndOfScript-1), $ 237 237 /recursed ) 238 ENDIF 239 ; Grab rest of string _after_ the end of the script. 238 ENDIF 239 ; Grab rest of string _after_ the end of the script. 240 240 strn = strmid(strn, EndOfScript+1, $ 241 241 strlen(strn)-EndOfScript-1) … … 265 265 StorePos = '' 266 266 RecallPos = '' 267 ; calculate the difference in length between this script and the 267 ; calculate the difference in length between this script and the 268 268 ; previous stacked one, removing font change commands (crudely by 269 269 ; guessing that the number of characters this takes is twice the … … 276 276 ENDIF ELSE BEGIN 277 277 IF (Token NE OldToken) AND (pos EQ 0) THEN BEGIN 278 ; The next script immediately fol ows this one. Arrange to278 ; The next script immediately follows this one. Arrange to 279 279 ; save the position of the current script so that both begin 280 280 ; with the same horizontal position. … … 283 283 LenLastScript = strlen(Script) - 2*strcnt(Script,'!') 284 284 ENDIF 285 ENDELSE 285 ENDELSE 286 286 287 287 ; Continue building the IDL string, adding on our just processed script. … … 289 289 + FontRestore 290 290 291 IF ( pos NE -1 ) THEN BEGIN ; more left to process 291 IF ( pos NE -1 ) THEN BEGIN ; more left to process 292 292 NewString = NewString $ 293 + str_token(strn, Token) 293 + str_token(strn, Token) 294 294 ENDIF ELSE BEGIN ; we are done 295 295 NewString = NewString + strn 296 296 strn = '' 297 297 ENDELSE 298 ENDWHILE 299 298 ENDWHILE 299 300 300 return, NewString 301 301 END -
trunk/SRC/ToBeReviewed/CALCULS/depth2floatlevel.pro
r163 r226 4 4 ;+ 5 5 ; @file_comments 6 ; Rather comparable to depth2level but here, the calculated level is in float. 7 ; For example, the level 5.4 correspond to a depth equal 6 ; Rather comparable to depth2level but here, the calculated level is in float. 7 ; For example, the level 5.4 correspond to a depth equal 8 8 ; to gdep[5]+.4*(gdep[6]-gdep[5]) 9 9 ; 10 ; @categories 10 ; @categories 11 11 ; Without loop 12 12 ; … … 32 32 ; ->champ nul a 1e-6 pres 33 33 ; 34 ; @history 34 ; @history 35 35 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 36 36 ; 15/06/2000 37 ; 37 ; 38 38 ; @version 39 39 ; $Id$ … … 57 57 levellow = depth2level(depthin, /lower, /nomask) 58 58 depthlow = level2depth(levellow, /nomask) 59 ; calculate the distance depthlow-depthup and management of the case 60 ; of this distance is null or eq al to !values.f_nan59 ; calculate the distance depthlow-depthup and management of the case 60 ; of this distance is null or equal to !values.f_nan 61 61 divi = depthlow-depthup 62 62 nan = where(finite(divi) EQ 0) … … 74 74 endif 75 75 ;------------------------------------------------------------ 76 if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun 76 if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun 77 77 ; 78 78 return, res -
trunk/SRC/ToBeReviewed/CALCULS/depth2level.pro
r163 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; Allows to pass from a 2d depth array to a corresponding 2d level array. 8 8 ; … … 11 11 ; 12 12 ; @param TAB {type=2d array} 13 ; 2d depth array (or a structure respecting litchamp crit rions)13 ; 2d depth array (or a structure respecting litchamp criterions) 14 14 ; 15 15 ; @keyword UPPER … … 17 17 ; 18 18 ; @keyword LOWER 19 ; We select the level just below the depth 19 ; We select the level just below the depth 20 20 ; 21 ; @keyword CLOSER 22 ; We select the depth's closer level 21 ; @keyword CLOSER 22 ; We select the depth's closer level 23 23 ; 24 ; @keyword NOMASK 24 ; @keyword NOMASK 25 25 ; To do not mask land points 26 26 ; 27 ; @returns 27 ; @returns 28 28 ; It is a 2d array containing level's values. 29 29 ; … … 31 31 ; common.pro 32 32 ; 33 ; @restrictions 33 ; @restrictions 34 34 ; For depths out of gdep's values, the value !values.f_nan is sent back. 35 ; if the depth is superior to this one of the bottom, we send back jpk-1 in 35 ; if the depth is superior to this one of the bottom, we send back jpk-1 in 36 36 ; the upper case, and !values.f_nan in the lower case. 37 37 ; … … 80 80 if notanumber[0] NE -1 then in[notanumber] = 0 81 81 ;------------------------------------------------------------ 82 ; We transform the 2d de th value in a 2d array of levels corresponding to depthes82 ; We transform the 2d depth value in a 2d array of levels corresponding to depths 83 83 ;------------------------------------------------------------ 84 84 ; We go on array who have the size of 3d arrays 85 prof=replicate(1,nx*ny)#gdep[firstz:lastz] 85 prof=replicate(1,nx*ny)#gdep[firstz:lastz] 86 86 in = in[*]#replicate(1, nz) 87 87 ; … … 116 116 ;------------------------------------------------------------ 117 117 ;------------------------------------------------------------ 118 if keyword_set(key_performance) THEN print, 'temps depth2level', systime(1)-tempsun 118 if keyword_set(key_performance) THEN print, 'temps depth2level', systime(1)-tempsun 119 119 return, levels 120 120 end -
trunk/SRC/ToBeReviewed/CALCULS/depth2mask.pro
r163 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 7 ; Allows to pass from a 2d depth sill array to a 3d array of mask 6 ; @file_comments 7 ; Allows to pass from a 2d depth sill array to a 3d array of mask 8 8 ; with one of levels above the sill depth and 0s below. 9 9 ; … … 12 12 ; 13 13 ; @param TAB {type=3d array} 14 ; 2d sill depth array (or a structure respecting litchamp crit rions)14 ; 2d sill depth array (or a structure respecting litchamp criterions) 15 15 ; 16 16 ; @keyword _EXTRA 17 17 ; used to pass your keywords 18 ; 18 ; 19 19 ; @returns 20 20 ; It is a 3d array containing the mas associated to the 2d sill depth array … … 42 42 @common 43 43 ;------------------------------------------------------------ 44 ; We transform the 2d de th value in a 2d array of levels corresponding to depthes44 ; We transform the 2d depth value in a 2d array of levels corresponding to depths 45 45 ;------------------------------------------------------------ 46 46 niveaux = depth2level(tab, _extra = ex) … … 51 51 mask = level2mask(niveaux) 52 52 ;------------------------------------------------------------ 53 if keyword_set(key_performance) NE 0 THEN print, 'temps depth2mask', systime(1)-tempsun 53 if keyword_set(key_performance) NE 0 THEN print, 'temps depth2mask', systime(1)-tempsun 54 54 return, mask 55 55 end -
trunk/SRC/ToBeReviewed/CALCULS/floatlevel2depth.pro
r163 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; Rather comparable to level2depth. It is the invert function of depth2floatlevel 8 8 ; … … 17 17 ; 18 18 ; @returns 19 ; 2d array containing depth es19 ; 2d array containing depths 20 20 ; 21 21 ; @uses … … 52 52 ; We sill (delete land points at valmask for example) 53 53 flevelin = 0 > flevelin < (jpk-1) 54 ; We ca culate the depth54 ; We calculate the depth 55 55 depthup = level2depth(floor(flevelin), /nomask) 56 56 depthlow= level2depth(ceil(flevelin), /nomask) … … 67 67 endif 68 68 ;------------------------------------------------------------ 69 if keyword_set(key_performance) THEN print, 'temps floatlevel2depth', systime(1)-tempsun 69 if keyword_set(key_performance) THEN print, 'temps floatlevel2depth', systime(1)-tempsun 70 70 ; 71 71 return, res -
trunk/SRC/ToBeReviewed/CALCULS/hdyn.pro
r224 r226 19 19 ; array representing the temperature. Has the same size than SN. 20 20 ; 21 ; @keyword GILL 21 ; @keyword GILL 22 22 ; We activate this key if we want to calculate the dynamic height 23 23 ; like in the GILL page 215, which means by rapport to a reference state which … … 32 32 ; Give a value to this keyword to change the reference salinity used in the 33 33 ; calculation when GILL is activated. 34 ; 34 ; 35 35 ; @keyword TREF 36 36 ; Give a value to this keyword to change the reference temperature used in the … … 58 58 ; 59 59 ; @restrictions 60 ; approximation: The pressure in decibars is equal to the depth in meters 60 ; approximation: The pressure in decibars is equal to the depth in meters 61 61 ; (the pressure increase of 1 bar every 10 m) 62 62 ; … … 99 99 if total(tailles[0:tailles[0]] NE taillet[0:taillet[0]]) NE 0 then $ 100 100 return, report('arrays sn and tn must have the same size') 101 if tailles[3] NE jpk then return, report('vertical dimension of sn and tn arra rrays must be equal to jpk')101 if tailles[3] NE jpk then return, report('vertical dimension of sn and tn arrays must be equal to jpk') 102 102 nx = nxt 103 103 ny = nyt -
trunk/SRC/ToBeReviewed/CALCULS/level2depth.pro
r224 r226 47 47 grille,mask, -1, -1,gdep,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz 48 48 ;--------------------------------------------------------------- 49 ; verification of the coherence between array's size and the domain defin ied by domdef49 ; verification of the coherence between array's size and the domain defined by domdef 50 50 ;--------------------------------------------------------------- 51 51 taille = size(niveaux) -
trunk/SRC/ToBeReviewed/CALCULS/norme.pro
r163 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; calculate the norm of a field of vectors, then make a possible average. 8 8 ; Comment 1: The field of vector can be, 2d:xy, 3d: xyz or xyt, 9 9 ; 4d: xyzt 10 10 ; Comment 2: 11 ; The calculation of the norm is made before the possible spatial or 12 ; temporal average because the average of the norm is not equal to the 11 ; The calculation of the norm is made before the possible spatial or 12 ; temporal average because the average of the norm is not equal to the 13 13 ; norm of averages 14 14 … … 24 24 ; 25 25 ; @keyword BOXZOOM 26 ; boxzoom on which do the average (by default the domain selected 26 ; boxzoom on which do the average (by default the domain selected 27 27 ; by the last domdef done) 28 28 ; 29 29 ; @keyword DIREC 30 30 ; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt' 31 ; 'xzt' 'yzt' 'xyzt' Direction on which do averages 31 ; 'xzt' 'yzt' 'xyzt' Direction on which do averages 32 32 ; 33 33 ; @returns … … 37 37 ; common.pro 38 38 ; 39 ; @restrictions 40 ; The norm is calculated on points TTo do this calculation, we average 41 ; field U and Von points T before calculate the norme. At the edge of 42 ; coast and of domain, we can not calculate fields U and V at points T, 43 ; that is why these points are at value !values.f_nan. 44 ; 45 ; When we calculate on a reduce geographic domain, field U and V have not 46 ; necessarily the same number of point. In this case, we recut U and V to 47 ; keep only common points. We profit of this to redo a domdef which redefine 39 ; @restrictions 40 ; The norm is calculated on points TTo do this calculation, we average 41 ; field U and Von points T before calculate the norme. At the edge of 42 ; coast and of domain, we can not calculate fields U and V at points T, 43 ; that is why these points are at value !values.f_nan. 44 ; 45 ; When we calculate on a reduce geographic domain, field U and V have not 46 ; necessarily the same number of point. In this case, we recut U and V to 47 ; keep only common points. We profit of this to redo a domdef which redefine 48 48 ; a geographic domain on which fields U and V are extracted on same points 49 49 ; 50 50 ; @restrictions 51 ; To know what type of array we work with, we test its size and dates 52 ; gave by time[0] and time[jpt-1] to know if thee is a temporal dimension. 53 ; Before to start norme, make sure that time and jpt are defined how 54 ; they have to! 51 ; To know what type of array we work with, we test its size and dates 52 ; gave by time[0] and time[jpt-1] to know if thee is a temporal dimension. 53 ; Before to start norme, make sure that time and jpt are defined how 54 ; they have to! 55 55 ; 56 56 ; @examples 57 ; To calculate the average of the norme of streams on all the domain 57 ; To calculate the average of the norme of streams on all the domain 58 58 ; between 0 et 50: 59 59 ; IDL> res=norme(un,vn,boxzoom=[0,50],dir='xyz') … … 90 90 ; 91 91 ;------------------------------------------------------------ 92 if keyword_set(boxzoom) then BEGIN 92 if keyword_set(boxzoom) then BEGIN 93 93 Case 1 Of 94 94 N_Elements(Boxzoom) Eq 1:bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] … … 100 100 ENDCASE 101 101 domdef, boxzoom 102 ENDIF 102 ENDIF 103 103 ;------------------------------------------------------------ 104 104 if NOT keyword_set(direc) then direc = 0 … … 120 120 if grillev EQ '' then grillev = 'V' 121 121 IF grilleu EQ 'V' AND grillev EQ 'U' THEN inverse = 1 122 IF grilleu EQ 'T' AND grillev EQ 'T' THEN BEGIN 123 interpolle = 0 122 IF grilleu EQ 'T' AND grillev EQ 'T' THEN BEGIN 123 interpolle = 0 124 124 return, report('cas non code mais facile a faire!') 125 125 ENDIF ELSE interpolle = 1 … … 140 140 indiceyv = (lindgen(jpj))[firstyv:firstyv+nyv-1] 141 141 indicey = inter(indiceyu, indiceyv) 142 nx = n_elements(indicex) 142 nx = n_elements(indicex) 143 143 ny = n_elements(indicey) 144 144 ;---------------------------------------------------------------------------- … … 149 149 ;---------------------------------------------------------------------------- 150 150 ;---------------------------------------------------------------------------- 151 (size(u))[0] EQ 3 AND date1 EQ date2 :BEGIN 151 (size(u))[0] EQ 3 AND date1 EQ date2 :BEGIN 152 152 ;---------------------------------------------------------------------------- 153 153 indice2d = lindgen(jpi, jpj) … … 160 160 case 1 of 161 161 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 162 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 162 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 163 163 case (size(u))[3] OF 164 nzt:BEGIN 164 nzt:BEGIN 165 165 if nxu NE nx then $ 166 if indicex[0] EQ firstxu then u = u[0:nx-1,*,*] ELSE u = u[1: nx, *,*] 166 if indicex[0] EQ firstxu then u = u[0:nx-1,*,*] ELSE u = u[1: nx, *,*] 167 167 IF nxv NE nx THEN $ 168 168 if indicex[0] EQ firstxv then v = v[0:nx-1,*,*] ELSE v = v[1: nx, *,*] 169 169 IF nyu NE ny THEN $ 170 if indicey[0] EQ firstyu then u = u[*,0:ny-1,*] ELSE u = u[*, 1: ny,*] 170 if indicey[0] EQ firstyu then u = u[*,0:ny-1,*] ELSE u = u[*, 1: ny,*] 171 171 IF nyv NE ny THEN $ 172 172 if indicey[0] EQ firstyv then v = v[*,0:ny-1,*] ELSE v = v[*, 1: ny,*] 173 173 end 174 jpk:BEGIN 174 jpk:BEGIN 175 175 if nxu NE nx then $ 176 if indicex[0] EQ firstxu then u = u[0:nx-1, *,firstzt:lastzt] ELSE u = u[1: nx, *,firstzt:lastzt] 176 if indicex[0] EQ firstxu then u = u[0:nx-1, *,firstzt:lastzt] ELSE u = u[1: nx, *,firstzt:lastzt] 177 177 IF nxv NE nx THEN $ 178 178 if indicex[0] EQ firstxv then v = v[0:nx-1, *,firstzt:lastzt] ELSE v = v[1: nx, *,firstzt:lastzt] 179 179 IF nyu NE ny THEN $ 180 if indicey[0] EQ firstyu then u = u[*, 0:ny-1,firstzt:lastzt] ELSE u = u[*, 1: ny,firstzt:lastzt] 180 if indicey[0] EQ firstyu then u = u[*, 0:ny-1,firstzt:lastzt] ELSE u = u[*, 1: ny,firstzt:lastzt] 181 181 IF nyv NE ny THEN $ 182 182 if indicey[0] EQ firstyv then v = v[*, 0:ny-1,firstzt:lastzt] ELSE v = v[*, 1: ny,firstzt:lastzt] … … 186 186 END 187 187 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND (size(u))[3] EQ jpk AND $ 188 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj AND (size(u))[3] EQ jpk :BEGIN 188 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj AND (size(u))[3] EQ jpk :BEGIN 189 189 u = u[indice3d] 190 190 v = v[indice3d] … … 209 209 if NOT keyword_set(key_periodic) OR nx NE jpi then v[*,0,*]=a 210 210 ;---------------------------------------------------------------------------- 211 ; attribution of the mask and of lo gitude and latitude arrays211 ; attribution of the mask and of longitude and latitude arrays 212 212 ;---------------------------------------------------------------------------- 213 213 mask = tmask[indice3d] … … 234 234 ;---------------------------------------------------------------------------- 235 235 ;---------------------------------------------------------------------------- 236 date1 NE date2 AND (size(u))[0] EQ 3 :BEGIN 236 date1 NE date2 AND (size(u))[0] EQ 3 :BEGIN 237 237 indice2d = lindgen(jpi, jpj) 238 238 indice2d = indice2d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1] … … 242 242 case 1 of 243 243 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 244 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 244 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 245 245 if nxu NE nx then $ 246 if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 246 if indicex[0] EQ firstxu then u = u[0:nx-1, *, *] ELSE u = u[1: nx, *, *] 247 247 IF nxv NE nx THEN $ 248 248 if indicex[0] EQ firstxv then v = v[0:nx-1, *, *] ELSE v = v[1: nx, *, *] 249 249 IF nyu NE ny THEN $ 250 if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 250 if indicey[0] EQ firstyu then u = u[*, 0:ny-1, *] ELSE u = u[*, 1: ny, *] 251 251 IF nyv NE ny THEN $ 252 252 if indicey[0] EQ firstyv then v = v[*, 0:ny-1, *] ELSE v = v[*, 1: ny, *] 253 253 END 254 254 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $ 255 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 255 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 256 256 u = u[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *] 257 257 v = v[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1, *] … … 270 270 ;---------------------------------------------------------------------------- 271 271 ; attribution of the mask and of longitude and latitude arrays. 272 ; We recover the complete grid to establish a big mask extent in the four 273 ; direction to cover pointsfor which a land point has been 272 ; We recover the complete grid to establish a big mask extent in the four 273 ; direction to cover pointsfor which a land point has been 274 274 ; considerated (make a small drawing) 275 275 ;---------------------------------------------------------------------------- … … 288 288 res[*,0, *]=!values.f_nan 289 289 mask = where(mask eq 0) 290 IF mask[0] NE -1 THEN BEGIN 290 IF mask[0] NE -1 THEN BEGIN 291 291 coeftps = lindgen(jpt)*nx*ny 292 292 coeftps = replicate(1, n_elements(mask))#coeftps … … 304 304 ;---------------------------------------------------------------------------- 305 305 ;---------------------------------------------------------------------------- 306 date1 NE date2 AND (size(u))[0] EQ 4:BEGIN 306 date1 NE date2 AND (size(u))[0] EQ 4:BEGIN 307 307 indice2d = lindgen(jpi, jpj) 308 308 indice2d = indice2d[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1] … … 314 314 case 1 of 315 315 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 316 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 316 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 317 317 case (size(u))[3] OF 318 nzt:BEGIN 318 nzt:BEGIN 319 319 if nxu NE nx then $ 320 if indicex[0] EQ firstxu then u = u[0:nx-1,*,*,*] ELSE u = u[1: nx, *,*,*] 320 if indicex[0] EQ firstxu then u = u[0:nx-1,*,*,*] ELSE u = u[1: nx, *,*,*] 321 321 IF nxv NE nx THEN $ 322 322 if indicex[0] EQ firstxv then v = v[0:nx-1,*,*,*] ELSE v = v[1: nx, *,*,*] 323 323 IF nyu NE ny THEN $ 324 if indicey[0] EQ firstyu then u = u[*,0:ny-1,*,*] ELSE u = u[*, 1: ny,*,*] 324 if indicey[0] EQ firstyu then u = u[*,0:ny-1,*,*] ELSE u = u[*, 1: ny,*,*] 325 325 IF nyv NE ny THEN $ 326 326 if indicey[0] EQ firstyv then v = v[*,0:ny-1,*,*] ELSE v = v[*, 1: ny,*,*] 327 327 end 328 jpk:BEGIN 328 jpk:BEGIN 329 329 if nxu NE nx then $ 330 if indicex[0] EQ firstxu then u = u[0:nx-1, *,firstzt:lastzt,*] ELSE u = u[1: nx, *,firstzt:lastzt,*] 330 if indicex[0] EQ firstxu then u = u[0:nx-1, *,firstzt:lastzt,*] ELSE u = u[1: nx, *,firstzt:lastzt,*] 331 331 IF nxv NE nx THEN $ 332 332 if indicex[0] EQ firstxv then v = v[0:nx-1, *,firstzt:lastzt,*] ELSE v = v[1: nx, *,firstzt:lastzt,*] 333 333 IF nyu NE ny THEN $ 334 if indicey[0] EQ firstyu then u = u[*, 0:ny-1,firstzt:lastzt,*] ELSE u = u[*, 1: ny,firstzt:lastzt,*] 334 if indicey[0] EQ firstyu then u = u[*, 0:ny-1,firstzt:lastzt,*] ELSE u = u[*, 1: ny,firstzt:lastzt,*] 335 335 IF nyv NE ny THEN $ 336 336 if indicey[0] EQ firstyv then v = v[*, 0:ny-1,firstzt:lastzt,*] ELSE v = v[*, 1: ny,firstzt:lastzt,*] … … 340 340 END 341 341 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND (size(u))[3] EQ jpk AND $ 342 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj AND (size(u))[3] EQ jpk :BEGIN 342 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj AND (size(u))[3] EQ jpk :BEGIN 343 343 u = u[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1,firstzt:lastzt, *] 344 344 v = v[indicex[0]:indicex[0]+nx-1,indicey[0]:indicey[0]+ny-1,firstzt:lastzt, *] … … 356 356 if NOT keyword_set(key_periodic) OR nx NE jpi then v[*,0,*,*]=a 357 357 ;---------------------------------------------------------------------------- 358 ; attribution of the mask and of lo gitude and latitude arrays358 ; attribution of the mask and of longitude and latitude arrays 359 359 ;---------------------------------------------------------------------------- 360 360 mask = tmask[indice3d] … … 370 370 res[*,0, *, *]=!values.f_nan 371 371 mask = where(mask eq 0) 372 IF mask[0] NE -1 THEN BEGIN 372 IF mask[0] NE -1 THEN BEGIN 373 373 coeftps = lindgen(jpt)*nx*ny*nzt 374 374 coeftps = replicate(1, n_elements(mask))#coeftps … … 394 394 case 1 of 395 395 (size(u))[1] EQ nxu AND (size(u))[2] EQ nyu AND $ 396 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 396 (size(v))[1] EQ nxv AND (size(v))[2] EQ nyv:BEGIN 397 397 if nxu NE nx then $ 398 if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 398 if indicex[0] EQ firstxu then u = u[0:nx-1, *] ELSE u = u[1: nx, *] 399 399 IF nxv NE nx THEN $ 400 400 if indicex[0] EQ firstxv then v = v[0:nx-1, *] ELSE v = v[1: nx, *] 401 401 IF nyu NE ny THEN $ 402 if indicey[0] EQ firstyu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 402 if indicey[0] EQ firstyu then u = u[*, 0:ny-1] ELSE u = u[*, 1: ny] 403 403 IF nyv NE ny THEN $ 404 404 if indicey[0] EQ firstyv then v = v[*, 0:ny-1] ELSE v = v[*, 1: ny] 405 405 END 406 406 (size(u))[1] EQ jpi AND (size(u))[2] EQ jpj AND $ 407 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 407 (size(v))[1] EQ jpi AND (size(v))[2] EQ jpj:BEGIN 408 408 u = u[indice2d] 409 409 v = v[indice2d] … … 429 429 ;---------------------------------------------------------------------------- 430 430 ; attribution of the mask and of longitude and latitude arrays. 431 ; We recover the complete grid to establish a big mask extent in the four 432 ; direction to cover pointsfor which a land point has been 431 ; We recover the complete grid to establish a big mask extent in the four 432 ; direction to cover pointsfor which a land point has been 433 433 ; considerated (make a small drawing) 434 434 ;---------------------------------------------------------------------------- … … 455 455 endcase 456 456 ;------------------------------------------------------------ 457 if keyword_set(key_performance) THEN print, 'temps norme', systime(1)-tempsun 457 if keyword_set(key_performance) THEN print, 'temps norme', systime(1)-tempsun 458 458 return, res 459 459 end -
trunk/SRC/ToBeReviewed/CALCULS/projectondepth.pro
r224 r226 12 12 ; @param ARRAYIN {type=3d array} 13 13 ; It is a 3d array whose 3rd dimension must be equal to jpk 14 ; 14 ; 15 15 ; @param DEPTHIN {type=2d array} 16 16 ; It is a 2d array indicating for each point n, at which depth to project 17 ; 17 ; 18 18 ; @returns 19 19 ; A 2d array which is the projection of the 3d array following depths indicated by depthin … … 22 22 ; common.pro 23 23 ; 24 ; @restrictions 24 ; @restrictions 25 25 ; points at !values.f_nan impossible calculation. Land points masked at valmask. 26 26 ; … … 29 29 ; IDL> a=gdept[jpk-1]/(1.*jpi*jpj)*findgen(jpi,jpj) 30 30 ; We build an array to project on these depths. For the test, 31 ; we build a 3d array whose each vector following z is the depth. 31 ; we build a 3d array whose each vector following z is the depth. 32 32 ; IDL> arraytest=replicate(1,jpi*jpj)#gdept 33 33 ; IDL> arraytest=reform(arraytest,jpi,jpj,jpk, /over) … … 35 35 ; IDL> plt, 1e6*(a-projectondepth(arraytest,a)),/nocontour 36 36 ; ->null field at 1e-6 pres 37 ; 38 ; verif cation projecting the temperature of 20°C for example...37 ; 38 ; verification projecting the temperature of 20°C for example... 39 39 ; 40 40 ; @history … … 63 63 if tailledepth[0] NE 2 THEN return, report('Depth array must have 2 dimensions') 64 64 if taillearray[0] NE 3 THEN return, report('Array in must have 3 dimensions') 65 ; verification of the coherence between array's size and the domain 65 ; verification of the coherence between array's size and the domain 66 66 grille, mask, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz 67 67 case 1 of … … 103 103 if terre[0] NE -1 then res[terre] = valmask 104 104 ;------------------------------------------------------------ 105 if keyword_set(key_performance) THEN print, 'temps projectondepth', systime(1)-tempsun 105 if keyword_set(key_performance) THEN print, 'temps projectondepth', systime(1)-tempsun 106 106 return, res 107 107 end -
trunk/SRC/ToBeReviewed/CALCULS/remplit.pro
r209 r226 22 22 ; 23 23 ; @keyword FILLXDIR 24 ; 24 ; 25 25 ; 26 26 ; @keyword FILLYDIR … … 51 51 ; $Id$ 52 52 ; 53 ;; 54 ;; Extrapole zinout[jpi,jpj] sur les continents en utilisant les 4 55 ;; plus proches voisins masques oceaniquement et construit un nouveau 56 ; masque 57 ;; contenant l'ancien masque oceanique PLUSles points extrapoles. 58 ;; Reitere le processus niter fois. 59 ;; C'est pas clair, essayez ! 60 ;; 61 ;; 53 ;; 54 ;; Extrapole zinout[jpi,jpj] sur les continents en utilisant les 4 55 ;; plus proches voisins masques oceaniquement et construit un nouveau masque 56 ;; contenant l'ancien masque oceanique PLUS les points extrapoles. 57 ;; Reitere le processus niter fois. 58 ;; C'est pas clair, essayez ! 59 ;; 60 ;; 62 61 ; 63 62 ; /Nan: to fill the point which have the value 64 ; !values.f_nan. W hitout this keyword, these point are not filling63 ; !values.f_nan. Without this keyword, these point are not filling 65 64 ; and stays at !values.f_nan. 66 65 ; … … 139 138 ;--------------------------------------------------------------- 140 139 ;--------------------------------------------------------------- 141 ; iteration 142 ;--------------------------------------------------------------- 143 ;--------------------------------------------------------------- 144 FOR n = 1, niter DO BEGIN 140 ; iteration 141 ;--------------------------------------------------------------- 142 ;--------------------------------------------------------------- 143 FOR n = 1, niter DO BEGIN 145 144 ; on trouve les points coast 146 145 tempdeux = systime(1) ; pour key_performance =2 … … 244 243 END 245 244 endcase 246 ; 245 ; 247 246 z[coast] = temporary(zcoast)/ temporary(weight) 248 247 ; we update the the boundary conditions of z … … 258 257 IF testvar(var = key_performance) EQ 2 THEN $ 259 258 print, 'temps remplit: une iteration ', systime(1)-tempdeux 260 ENDFOR 259 ENDFOR 261 260 fini: 262 261 ; … … 280 279 key_gridtype = oldkey_gridtype 281 280 ;--------------------------------------------------------------- 282 if keyword_set(key_performance) THEN print, 'temps remplit', systime(1)-tempsun 281 if keyword_set(key_performance) THEN print, 'temps remplit', systime(1)-tempsun 283 282 return, z 284 END 283 END 285 284 -
trunk/SRC/ToBeReviewed/GRILLE/decoupeterre.pro
r163 r226 48 48 ; Used to pass your keywords 49 49 ; 50 ; @keyword TRI 50 ; @keyword TRI 51 51 ; This keyword serve to obtain, thanks to grille, the triangulation which 52 52 ; refer to the grid but only on the part of the zoom. This of triangulation … … 56 56 ; 57 57 ; @keyword WDEPTH 58 ; To specify that the field is at W depth instead of T 58 ; To specify that the field is at W depth instead of T 59 59 ; depth (automatically activated if vargrid eq 'W') 60 60 ; … … 184 184 if vargrid EQ 'V' OR vargrid EQ 'F' then $ 185 185 glam = glamv[firstx:lastx, firsty:lasty] 186 ENDIF ELSE BEGIN ; to drawsectionbottom 186 ENDIF ELSE BEGIN ; to drawsectionbottom 187 187 if vargrid EQ 'V' OR vargrid EQ 'F' OR finite(glamu[0]) EQ 0 then $ 188 188 glam = glamf[0 > (firstx-1):lastx, firsty:lasty] $ … … 194 194 if vargrid EQ 'U' OR vargrid EQ 'F' then $ 195 195 gphi = gphiu[firstx:lastx, firsty:lasty] 196 ENDIF ELSE BEGIN ; to drawsectionbottom 196 ENDIF ELSE BEGIN ; to drawsectionbottom 197 197 if vargrid EQ 'U' OR vargrid EQ 'F' OR finite(gphiv[0]) EQ 0 then $ 198 198 gphi = gphif[firstx:lastx, 0 > (firsty-1):lasty] $ … … 211 211 firstz = firstzt 212 212 lastz = lastzt 213 ENDELSE 213 ENDELSE 214 214 nz = lastz-firstz+1 215 215 ;------------------------------------------------------------ … … 221 221 profond = firstz NE 0 222 222 END 223 ; for the ver ical section, we have to choose the right mask according223 ; for the vertical section, we have to choose the right mask according 224 224 ; to the grid point and to the direction of the section 225 225 'xz':BEGIN … … 267 267 END 268 268 keyword_set(key_partialstep) and type EQ 'yz' $ 269 AND nx EQ 1 AND keyword_set(realsection):BEGIN 269 AND nx EQ 1 AND keyword_set(realsection):BEGIN 270 270 bottom = total(mask, 3) 271 271 good = where(bottom NE 0 AND bottom NE nz+1) … … 290 290 tri = triangule(mask, coinmonte = coinmonte, coindescend = coindescend, _extra = ex) 291 291 indicezoom = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty] 292 ENDIF ELSE BEGIN 292 ENDIF ELSE BEGIN 293 293 ; Otherwise, we recuperate the part of triangulation that interest us and we number them well!! 294 if nx EQ jpi AND ny EQ jpj then tri = triangles_list ELSE BEGIN 294 if nx EQ jpi AND ny EQ jpj then tri = triangles_list ELSE BEGIN 295 295 msk = bytarr(jpi, jpj) 296 296 msk[firstx:lastx, firsty:lasty] = 1 … … 306 306 ENDELSE 307 307 ;------------------------------------------------------------------- 308 if keyword_set(key_performance) THEN print, 'temps decoupeterre', systime(1)-tempsun 308 if keyword_set(key_performance) THEN print, 'temps decoupeterre', systime(1)-tempsun 309 309 ;------------------------------------------------------------ 310 310 return -
trunk/SRC/ToBeReviewed/GRILLE/domdef.pro
r163 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 7 ; Allows to extract a sub-domain of study by providing parameters 6 ; @file_comments 7 ; Allows to extract a sub-domain of study by providing parameters 8 8 ; needed for drawings (see outputs) 9 9 ; … … 12 12 ; @param Z1 {in}{optional} 13 13 ; For a 3d domain whose the horizontal part cover all glam 14 ; 14 ; 15 15 ; @param Z2 {in}{optional} 16 16 ; For a 3d domain whose the horizontal part cover all gphi … … 38 38 ; 39 39 ; @keyword FINDALWAYS 40 ; Force to redefine a box even when none point is find in the box. 40 ; Force to redefine a box even when none point is find in the box. 41 41 ; In this case, we select all the grid. 42 42 ; 43 43 ; @keyword GRIDTYPE {type=string or vector} 44 ; It is a string or a vector of strings containing the grids's name 45 ; (Only determined by 'T','U','V','W','F') for which the calculation 46 ; must be done. 44 ; It is a string or a vector of strings containing the grids's name 45 ; (Only determined by 'T','U','V','W','F') for which the calculation 46 ; must be done. 47 47 ; For example: 'T' or ['T','U'] 48 48 ; … … 55 55 ; grids. 56 56 ; 57 ; @keyword INDEX 58 ; We activate it if we want that all elements passed in input of domdef 59 ; refer to indexes of glam, gphi and gdep arrays rather than to values 57 ; @keyword INDEX 58 ; We activate it if we want that all elements passed in input of domdef 59 ; refer to indexes of glam, gphi and gdep arrays rather than to values 60 60 ; of these arrays. 61 61 ; 62 ; @keyword XINDEX 63 ; We activate it if we want that all elements passed in input of domdef 64 ; and concerning the X dimension refer to indexes of glam arrays rather 62 ; @keyword XINDEX 63 ; We activate it if we want that all elements passed in input of domdef 64 ; and concerning the X dimension refer to indexes of glam arrays rather 65 65 ; than to values of these arrays. 66 66 ; 67 ; @keyword YINDEX 68 ; We activate it if we want that all elements passed in input of domdef 69 ; and concerning the X dimension refer to indexes of gphi arrays rather 67 ; @keyword YINDEX 68 ; We activate it if we want that all elements passed in input of domdef 69 ; and concerning the X dimension refer to indexes of gphi arrays rather 70 70 ; than to values of these arrays. 71 ; 72 ; @keyword ZINDEX 73 ; We activate it if we want that all elements passed in input of domdef 74 ; and concerning the X dimension refer to indexes of gdep arrays rather 71 ; 72 ; @keyword ZINDEX 73 ; We activate it if we want that all elements passed in input of domdef 74 ; and concerning the X dimension refer to indexes of gdep arrays rather 75 75 ; than to values of these arrays. 76 76 ; 77 77 ; @uses 78 78 ; common.pro 79 ;80 79 ; 81 80 ; @history … … 123 122 ; 124 123 IF keyword_set(endpoints) THEN BEGIN 125 IF NOT keyword_set(type) THEN BEGIN 124 IF NOT keyword_set(type) THEN BEGIN 126 125 dummy = report(['If domdef is used do find the box associated' $ 127 126 , 'to endpoints, you must also specify type keyword']) 128 127 return 129 ENDIF 128 ENDIF 130 129 CASE N_PARAMS() OF 131 130 0: … … 137 136 section, BOXZOOM = boxzoom, ENDPOINTS = endpoints, TYPE = type, /ONLYBOX 138 137 return 139 ENDIF 138 ENDIF 140 139 141 140 ;------------------------------------------------------------------- … … 153 152 END 154 153 ENDCASE 155 RETURN 154 RETURN 156 155 ENDIF 157 156 ;------------------------------------------------------------------- … … 170 169 vert1t = 99999. & vert2t = -99999. & vert1w = 99999. & vert2w = -99999. 171 170 ; 172 IF jpj EQ 1 THEN BEGIN 171 IF jpj EQ 1 THEN BEGIN 173 172 IF (where(gridtype eq 'T'))[0] NE -1 OR (where(gridtype EQ 'W'))[0] NE -1 THEN BEGIN 174 173 glamt = reform(glamt, jpi, jpj, /over) 175 174 gphit = reform(gphit, jpi, jpj, /over) 176 ENDIF 175 ENDIF 177 176 IF (where(gridtype eq 'U'))[0] NE -1 THEN BEGIN 178 177 glamu = reform(glamu, jpi, jpj, /over) 179 178 gphiu = reform(gphiu, jpi, jpj, /over) 180 ENDIF 179 ENDIF 181 180 IF (where(gridtype eq 'V'))[0] NE -1 THEN BEGIN 182 181 glamv = reform(glamv, jpi, jpj, /over) 183 182 gphiv = reform(gphiv, jpi, jpj, /over) 184 ENDIF 183 ENDIF 185 184 IF (where(gridtype eq 'F'))[0] NE -1 THEN BEGIN 186 185 glamf = reform(glamf, jpi, jpj, /over) 187 186 gphif = reform(gphif, jpi, jpj, /over) 188 ENDIF 187 ENDIF 189 188 ENDIF 190 189 ; … … 229 228 AND NOT keyword_set(xindex) AND NOT keyword_set(yindex) AND NOT keyword_set(index) ) THEN BEGIN 230 229 IF N_PARAMS() EQ 0 THEN BEGIN 231 ; find lon1 and lon2 the longitudinal bou daries of the full domain230 ; find lon1 and lon2 the longitudinal boundaries of the full domain 232 231 IF (where(gridtype eq 'T'))[0] NE -1 THEN lon1t = min(glamt, max = lon2t) 233 232 IF (where(gridtype eq 'W'))[0] NE -1 AND (where(gridtype eq 'T'))[0] EQ -1 THEN lon1t = min(glamt, max = lon2t) … … 237 236 lon1 = min([lon1t, lon1u, lon1v, lon1f]) 238 237 lon2 = max([lon2t, lon2u, lon2v, lon2f]) 239 ; find lat1 and lat2 the latitudinal bou daries of the full domain238 ; find lat1 and lat2 the latitudinal boundaries of the full domain 240 239 IF (where(gridtype eq 'T'))[0] NE -1 THEN lat1t = min(gphit, max = lat2t) 241 240 IF (where(gridtype eq 'W'))[0] NE -1 AND (where(gridtype eq 'T'))[0] EQ -1 THEN lat1t = min(gphit, max = lat2t) … … 245 244 lat1 = min([lat1t, lat1u, lat1v, lat1f]) 246 245 lat2 = max([lat2t, lat2u, lat2v, lat2f]) 247 ENDIF ELSE BEGIN 246 ENDIF ELSE BEGIN 248 247 lon1 = min([x1, x2], max = lon2) 249 248 lat1 = min([y1, y2], max = lat2) … … 288 287 IF (dom[0] EQ -1) THEN BEGIN 289 288 IF keyword_set(findalways) THEN BEGIN 290 ; if t grid parameters alreday defined, we use them... 289 ; if t grid parameters alreday defined, we use them... 291 290 CASE 1 OF 292 291 (where(gridtype eq 'T'))[0] NE -1 OR (where(gridtype EQ 'W'))[0] NE -1:BEGIN … … 337 336 firstxv = firstxt & lastxv = lastxt & nxv = nxt 338 337 firstyv = firstyt & lastyv = lastyt & nyv = nyt 339 END 338 END 340 339 (where(gridtype eq 'U'))[0] NE -1:BEGIN 341 340 print, 'WARNING, empty V points box... we use the same index as U points...' 342 341 firstxv = firstxu & lastxv = lastxu & nxv = nxu 343 342 firstyv = firstyu & lastyv = lastyu & nyv = nyu 344 END 343 END 345 344 ELSE:BEGIN 346 345 print, 'WARNING, empty V points box... we get the neighnors to define a new box...' … … 385 384 firstxf = firstxt & lastxf = lastxt & nxf = nxt 386 385 firstyf = firstyt & lastyf = lastyt & nyf = nyt 387 END 386 END 388 387 (where(gridtype eq 'U'))[0] NE -1:BEGIN 389 388 print, 'WARNING, empty F points box... we use the same index as U points...' 390 389 firstxf = firstxu & lastxf = lastxu & nxf = nxu 391 390 firstyf = firstyu & lastyf = lastyu & nyf = nyu 392 END 391 END 393 392 (where(gridtype eq 'V'))[0] NE -1:BEGIN 394 393 print, 'WARNING, empty F points box... we use the same index as V points...' 395 394 firstxf = firstxv & lastxf = lastxv & nxf = nxv 396 395 firstyf = firstyv & lastyf = lastyv & nyf = nyv 397 END 396 END 398 397 ELSE:BEGIN 399 398 print, 'WARNING, empty F points box... we get the neighnors to define a new box...' … … 406 405 RETURN 407 406 END 408 ENDCASE 407 ENDCASE 409 408 ENDIF ELSE BEGIN 410 409 ras = report('WARNING, The box does not contain any F points...') … … 469 468 firstyv = fsty & lastyv = lsty 470 469 nxv = nx & nyv = ny 471 ENDIF 470 ENDIF 472 471 ; find lon1f, lon2f, lat1f, lat2f, firstxf, firstxf, nxf and nyf 473 472 ; according to x1, x2, y1, y2 … … 537 536 print, 'WARNING, empty U points box... we use the same index as T points...' 538 537 firstyu = firstyt & lastyu = lastyt & nyu = nyt 539 END 538 END 540 539 ELSE:BEGIN 541 540 print, 'WARNING, empty U points box... we get the neighnors to define a new box...' … … 548 547 RETURN 549 548 END 550 ENDCASE 549 ENDCASE 551 550 ENDIF ELSE BEGIN 552 551 ras = report('WARNING, The box does not contain any U points...') … … 575 574 print, 'WARNING, empty V points box... we use the same index as T points...' 576 575 firstyv = firstyt & lastyv = lastyt & nyv = nyt 577 END 576 END 578 577 (where(gridtype eq 'U'))[0] NE -1:BEGIN 579 578 print, 'WARNING, empty V points box... we use the same index as U points...' 580 579 firstyv = firstyu & lastyv = lastyu & nyv = nyu 581 END 580 END 582 581 ELSE:BEGIN 583 582 print, 'WARNING, empty V points box... we get the neighnors to define a new box...' … … 589 588 ENDCASE 590 589 RETURN 591 END 592 ENDCASE 590 END 591 ENDCASE 593 592 ENDIF ELSE BEGIN 594 593 ras = report('WARNING, The box does not contain any V points...') … … 617 616 print, 'WARNING, empty F points box... we use the same index as T points...' 618 617 firstyf = firstyt & lastyf = lastyt & nyf = nyt 619 END 618 END 620 619 (where(gridtype eq 'U'))[0] NE -1:BEGIN 621 620 print, 'WARNING, empty F points box... we use the same index as U points...' 622 621 firstyf = firstyu & lastyf = lastyu & nyf = nyu 623 END 622 END 624 623 (where(gridtype eq 'V'))[0] NE -1:BEGIN 625 624 print, 'WARNING, empty F points box... we use the same index as V points...' 626 625 firstyf = firstyv & lastyf = lastyv & nyf = nyv 627 END 626 END 628 627 ELSE:BEGIN 629 628 print, 'WARNING, empty F points box... we get the neighnors to define a new box...' … … 636 635 RETURN 637 636 END 638 ENDCASE 637 ENDCASE 639 638 ENDIF ELSE BEGIN 640 639 ras = report('WARNING, The box does not contain any F points...') … … 705 704 print, 'WARNING, empty U points box... we use the same index as T points...' 706 705 firstxu = firstxt & lastxu = lastxt & nxu = nxt 707 END 706 END 708 707 ELSE:BEGIN 709 708 print, 'WARNING, empty U points box... we get the neighnors to define a new box...' … … 716 715 RETURN 717 716 END 718 ENDCASE 717 ENDCASE 719 718 ENDIF ELSE BEGIN 720 719 ras = report('WARNING, The box does not contain any U points...') … … 743 742 print, 'WARNING, empty V points box... we use the same index as T points...' 744 743 firstxv = firstxt & lastxv = lastxt & nxv = nxt 745 END 744 END 746 745 (where(gridtype eq 'U'))[0] NE -1:BEGIN 747 746 print, 'WARNING, empty V points box... we use the same index as U points...' 748 747 firstxv = firstxu & lastxv = lastxu & nxv = nxu 749 END 748 END 750 749 ELSE:BEGIN 751 750 print, 'WARNING, empty V points box... we get the neighnors to define a new box...' … … 757 756 ENDCASE 758 757 RETURN 759 END 760 ENDCASE 758 END 759 ENDCASE 761 760 ENDIF ELSE BEGIN 762 761 ras = report('WARNING, The box does not contain any V points...') … … 785 784 print, 'WARNING, empty F points box... we use the same index as T points...' 786 785 firstxf = firstxt & lastxf = lastxt & nxf = nxt 787 END 786 END 788 787 (where(gridtype eq 'U'))[0] NE -1:BEGIN 789 788 print, 'WARNING, empty F points box... we use the same index as U points...' 790 789 firstxf = firstxu & lastxf = lastxu & nxf = nxu 791 END 790 END 792 791 (where(gridtype eq 'V'))[0] NE -1:BEGIN 793 792 print, 'WARNING, empty F points box... we use the same index as V points...' 794 793 firstxf = firstxv & lastxf = lastxv & nxf = nxv 795 END 794 END 796 795 ELSE:BEGIN 797 796 print, 'WARNING, empty F points box... we get the neighnors to define a new box...' … … 803 802 ENDCASE 804 803 RETURN 805 END 806 ENDCASE 804 END 805 ENDCASE 807 806 ENDIF ELSE BEGIN 808 807 ras = report('WARNING, The box does not contain any F points...') … … 821 820 END 822 821 ENDCASE 823 ENDELSE 824 ;------------------------------------------------------------------- 825 ; The extracted domain is it regular or not? 822 ENDELSE 823 ;------------------------------------------------------------------- 824 ; The extracted domain is it regular or not? 826 825 ;------------------------------------------------------------------- 827 826 CASE 1 OF 828 827 ((where(gridtype eq 'T'))[0] NE -1 OR (where(gridtype eq 'W'))[0] NE -1) AND nxt NE 0 AND nyt NE 0:BEGIN 829 ; to get faster, we first test the most basic cases befor testing the828 ; to get faster, we first test the most basic cases before testing the 830 829 ; full array. 831 830 CASE 0 OF … … 908 907 firstzt = domz[0] 909 908 lastzt = domz[nzt-1] 910 ENDIF ELSE BEGIN 909 ENDIF ELSE BEGIN 911 910 ras = report('WARNING, The box does not contain any T level...') 912 911 firstzt = -1 913 912 lastzt = -1 914 ENDELSE 913 ENDELSE 915 914 ENDIF 916 915 ; define firstzw, firstzw, nzw … … 920 919 lastzw = lastzt 921 920 nzw = nzt 922 ENDIF ELSE BEGIN 921 ENDIF ELSE BEGIN 923 922 domz = where(gdepw ge vert1 and gdepw le vert2, nzw) 924 923 IF nzw NE 0 THEN BEGIN 925 924 firstzw = domz[0] 926 925 lastzw = domz[nzw-1] 927 ENDIF ELSE BEGIN 926 ENDIF ELSE BEGIN 928 927 ras = report('WARNING, The box does not contain any W level...') 929 928 firstzw = -1 930 929 lastzw = -1 931 ENDELSE 932 ENDELSE 930 ENDELSE 931 ENDELSE 933 932 ENDIF 934 933 ;------------------------------------------------------------------- 935 934 ; vertical domain defined with the Z index 936 935 ;------------------------------------------------------------------- 937 ENDIF ELSE BEGIN 936 ENDIF ELSE BEGIN 938 937 CASE N_PARAMS() OF 939 938 2:fstz = min([x1, x2], max = lstz) … … 951 950 vert1t = min(gdept[fstz:lstz], max = vert2t) 952 951 firstzt = fstz & lastzt = lstz & nzt = nz 953 ENDIF 952 ENDIF 954 953 ; find vert1w, vert2w, firstzw, firstzw, nzw 955 954 ; according to (x1, x2) or (z1, z2) … … 957 956 vert1w = min(gdepw[fstz:lstz], max = vert2w) 958 957 firstzw = fstz & lastzw = lstz & nzw = nz 959 ENDIF 958 ENDIF 960 959 vert1 = min([vert1t, vert1w]) 961 960 vert2 = max([vert2t, vert2w]) … … 965 964 IF NOT keyword_set(key_forgetold) THEN BEGIN 966 965 @updateold 967 ENDIF 968 ;------------------------------------------------------------------- 969 if keyword_set(key_performance) THEN print, 'temps domdef', systime(1)-tempsun 966 ENDIF 967 ;------------------------------------------------------------------- 968 if keyword_set(key_performance) THEN print, 'temps domdef', systime(1)-tempsun 970 969 ;------------------------------------------------------------------- 971 970 -
trunk/SRC/ToBeReviewed/GRILLE/fmask.pro
r157 r226 15 15 ; @examples 16 16 ; Used like if fmask was a known array by substituing fmask by (fmask()) 17 ; For example: Inst aed of write fmask[domainef] we have to write (fmask())[domainef]17 ; For example: Instead of write fmask[domainef] we have to write (fmask())[domainef] 18 18 ; 19 19 ; @history … … 39 39 ;--------------------------------------------------------- 40 40 tempsun = systime(1) ; For key_performance 41 ; 41 ; 42 42 CASE size(tmask, /n_dimensions) OF 43 43 2:res = tmask*shift(tmask, -1, 0)*shift(tmask, 0, -1)*shift(tmask, -1, -1) … … 48 48 res[*, jpj-1, *] = fmaskredx 49 49 ; 50 if keyword_set(key_performance) THEN print, 'temps fmask', systime(1)-tempsun 51 50 if keyword_set(key_performance) THEN print, 'temps fmask', systime(1)-tempsun 51 52 52 return, res 53 53 end -
trunk/SRC/ToBeReviewed/HOPE/computehopegrid.pro
r157 r226 8 8 ; @categories 9 9 ; Grid 10 ; 10 ; 11 11 ; @param XAXIS 12 12 ; … … 68 68 if NOT keyword_set(lasts) then lasts = [jpi-1, jpj-1, jpk-1] 69 69 ; 70 ; de permination of the grid type and of the point type70 ; determination of the grid type and of the point type 71 71 ; 72 72 if keyword_set(pttype) then vargrid = pttype … … 129 129 gphiv = gphit+(gphit[0, 1]-gphit[0, 0])/2. 130 130 gphif = gphit+(gphit[0, 1]-gphit[0, 0])/2. 131 ENDIF ELSE BEGIN 131 ENDIF ELSE BEGIN 132 132 gphiv = gphit 133 133 gphif = gphit … … 181 181 e2f = e2t 182 182 ; 183 ; mask 183 ; mask 184 184 ; 185 185 tmask = replicate(1b, jpi, jpj, jpk) … … 239 239 IF NOT keyword_set(key_forgetold) THEN BEGIN 240 240 @updateold 241 ENDIF 241 ENDIF 242 242 ;------------------------------------------------------------ 243 243 return -
trunk/SRC/ToBeReviewed/HOPE/domainpart.pro
r163 r226 62 62 endif 63 63 ; 64 ; we get the size of the dimens tion id of this section64 ; we get the size of the dimension id of this section 65 65 ; 66 66 dimvar = *top_uvalue[1, findline(top_uvalue, 'dimvar')] -
trunk/SRC/ToBeReviewed/HOPE/findlineandpointtype.pro
r163 r226 68 68 jpj = n_elements(yaxis) 69 69 ; 70 ; de permination of the grid type and of the point type70 ; determination of the grid type and of the point type 71 71 ; 72 72 ; low resolution grid: jpi=128, jpj=121 ( x 2), jpk=20 73 ; 73 ; 74 74 ; 0. 1.4 2.8 4.2 5.6 75 75 ; odd T u T u 93.3 … … 80 80 ; 81 81 ; high resolution grid: jpi=256, jpj=195 ( x 2), jpk=29 82 ; 83 ; 0. 0.7 1.4 2.1 2.8 82 ; 83 ; 0. 0.7 1.4 2.1 2.8 84 84 ; odd T u T u 91.6 85 85 ; even T u T u 91.0 -
trunk/SRC/ToBeReviewed/HOPE/read_hope.pro
r163 r226 7 7 ; 8 8 ; @param EVENT 9 ; 9 ; 10 10 ; 11 11 ; @returns … … 16 16 ; 17 17 ; @examples 18 ; 19 ; 18 ; 20 19 ; @history 21 20 ; … … 244 243 ; A two elements vector [date1, date2]] 245 244 ; the boundary of the calendar with date1 and date2 246 ; fol owing the syntax yyyymmdd245 ; following the syntax yyyymmdd 247 246 ; 248 247 ; @keyword ODDPT 249 248 ; Activate to read only the sections located on ODD 250 ; points 249 ; points 251 250 ; 252 251 ; @keyword EVENPT 253 252 ; Activate to read only the sections located on even 254 ; points 253 ; points 255 254 ; 256 255 ; @keyword ODDEVENPT … … 332 331 compile_opt idl2, strictarrsubs 333 332 ; 334 @common ; usefull only for the definition of iodir 333 @common ; usefull only for the definition of iodir 335 334 if n_elements(filename) EQ 0 then filename = isafile(iodirectory = iodir, _extra = ex) 336 335 IF size(filename, /type) NE 7 THEN return, -1 337 336 filename = isafile(filename = filename, iodirectory = iodir, _extra = ex) 338 337 ; 339 cdfid = ncdf_open(filename) ; id of the netcdf file 338 cdfid = ncdf_open(filename) ; id of the netcdf file 340 339 wathinside = ncdf_inquire(cdfid) ; structure with global informations 341 ;------------------------------- 340 ;------------------------------- 342 341 ; dimensions 343 ;------------------------------- 342 ;------------------------------- 344 343 namedim = strarr(wathinside.ndims) ; name of the dimensions 345 344 typedim = strarr(wathinside.ndims) ; type of the dimensions (x,y,z,t) … … 349 348 ncdf_diminq, cdfid, dimiq, name, value 350 349 namedim[dimiq] = name 351 case 1 of 350 case 1 of 352 351 STRCMP(name, 'lon', 3, /FOLD_CASE):typedim[dimiq] = 'x' 353 352 STRCMP(name, 'lat', 3, /FOLD_CASE):typedim[dimiq] = 'y' … … 363 362 ; dimlist: structure which contains the name and the value of each 364 363 ; dimension 365 ; we suppose that there is always a variable which has the 364 ; we suppose that there is always a variable which has the 366 365 ; same name that the dimension and which gives the values of 367 366 ; this dimension … … 372 371 dimlist = create_struct(dimlist, namedim[dimiq], value) 373 372 endfor 374 ;------------------------------- 373 ;------------------------------- 375 374 ; variables 376 ;------------------------------- 375 ;------------------------------- 377 376 namevar = strarr(wathinside.nvars) ; names of the variables 378 377 ndimsvar = lonarr(wathinside.nvars) ; number of dim for each variable … … 388 387 ; we cut dimvar to select only the interessant part 389 388 dimvar = dimvar[0:max(ndimsvar)-1, *] 390 ; selection of the data variables which are diff rent from the389 ; selection of the data variables which are different from the 391 390 ; dimension variables 392 391 ; we suppose that that data variables are 4D array (with sometime … … 412 411 endfor 413 412 ; 414 ;--------------------------------------------------- 415 ;--------------------------------------------------- 416 ;--------------------------------------------------- 413 ;--------------------------------------------------- 414 ;--------------------------------------------------- 415 ;--------------------------------------------------- 417 416 ; definition of the widget 418 ;--------------------------------------------------- 419 ;--------------------------------------------------- 420 ;--------------------------------------------------- 417 ;--------------------------------------------------- 418 ;--------------------------------------------------- 419 ;--------------------------------------------------- 421 420 base = widget_base(/column) 422 ;--------------------------------------------------- 423 ; first base: 421 ;--------------------------------------------------- 422 ; first base: 424 423 ; droplist to select the type of section 425 424 ; droplist to select the variable 426 425 ; button to select type of line : odd, even or odd-even 427 ;--------------------------------------------------- 426 ;--------------------------------------------------- 428 427 base1 = widget_base(base, /row, /frame) 429 428 typechoice = sectype[uniq(sectype, sort(sectype))] … … 435 434 = 0L > (where(typechoice EQ selectedtype))[0] 436 435 ENDIF ELSE selectedtype = typechoice[0] 437 ; 436 ; 438 437 varchoice = namevar[uniq(namevar, sort(namevar))] 439 438 base12 = widget_droplist(base1, title = 'Available data', value = varchoice, uvalue = {name:'var choice'}, uname = 'var choice') … … 445 444 ; 446 445 base13 = widget_base(base1, /row, uname = 'linechoicebase') 447 ;--------------------------------------------------- 446 ;--------------------------------------------------- 448 447 ; base 2: base to select the domain of the odd points 449 448 ;--------------------------------------------------- 450 449 base2 = widget_base(base, /column, uname = 'basedomainodd', /frame) 451 ;--------------------------------------------------- 450 ;--------------------------------------------------- 452 451 ; base 3: base to select the domain of the even points 453 452 ;--------------------------------------------------- 454 453 base3 = widget_base(base, /column, uname = 'basedomaineven', /frame) 455 ;--------------------------------------------------- 454 ;--------------------------------------------------- 456 455 ; base 4: base to select the domain of the odd-even points 457 456 ;--------------------------------------------------- 458 457 base4 = widget_base(base, /column, uname = 'basedomainodd-even', /frame) 459 ;--------------------------------------------------- 458 ;--------------------------------------------------- 460 459 ; base 5: calendar 461 460 ;--------------------------------------------------- … … 468 467 base51 = cw_calendar(base5, time, uname = 'date1', uvalue = {name:'date1'}) 469 468 base52 = cw_calendar(base5, time, uname = 'date2', uvalue = {name:'date2'}) 470 ;--------------------------------------------------- 469 ;--------------------------------------------------- 471 470 ; base 6: base to select the min, max, ... and others keywords 472 471 ;--------------------------------------------------- 473 472 base6 = cw_specifie(base, /column, uname = 'specifie', uvalue = {name:'specifie'}) 474 ;--------------------------------------------------- 473 ;--------------------------------------------------- 475 474 ; base 7: last base with the action buttons 476 475 ;--------------------------------------------------- … … 478 477 base71 = widget_button(base7, value = 'Plot', uvalue = {name:'plot'}) 479 478 base72 = widget_button(base7, value = 'Cancel', uvalue = {name:'cancel'}) 480 ;--------------------------------------------------- 479 ;--------------------------------------------------- 481 480 ; determination of the selected variable ...... 482 ;--------------------------------------------------- 481 ;--------------------------------------------------- 483 482 goodname = 0 > where(strlowcase(namevar) EQ strlowcase(selectedname)) 484 483 goodtype = 0 > where(sectype EQ selectedtype) … … 568 567 endif 569 568 ENDIF 570 ;--------------------------------------------------- 569 ;--------------------------------------------------- 571 570 ; definition of the uvalue of the base which allows to share the 572 ; variables between programs. 573 ;--------------------------------------------------- 571 ; variables between programs. 572 ;--------------------------------------------------- 574 573 top_uvalue = ptrarr(2, 18, /allocate_heap) 575 574 *top_uvalue[0, 0] = 'type choice' & *top_uvalue[1, 0] = temporary(typechoice) -
trunk/SRC/ToBeReviewed/HOPE/rh_alldomains.pro
r163 r226 43 43 selectedline=(*top_uvalue[1, findline(top_uvalue, 'linetype')])[selected] 44 44 ; 45 ; we get the size of the dimens tion id of this section45 ; we get the size of the dimension id of this section 46 46 ; 47 47 dimvar = *top_uvalue[1, findline(top_uvalue, 'dimvar')] … … 85 85 oddsecchoice = oddsecchoice[sortedzdim] 86 86 nothing=widget_droplist(basedomainodd,title = 'number of levels', value = strtrim(sizedims, 2), uvalue = {name:'oddsecchoice'}, uname='oddsecchoice') 87 ENDIF 87 ENDIF 88 88 domainpart, top_uvalue, basedomainodd, oddsecchoice[0] 89 89 widget_control, basedomainodd, set_uvalue = oddsecchoice 90 ENDIF ELSE BEGIN 90 ENDIF ELSE BEGIN 91 91 nothing=widget_label(basedomainodd, value = ' ', uname = 'title') 92 92 domainpart, top_uvalue, basedomainodd, /destroy … … 115 115 evensecchoice = evensecchoice[sortedzdim] 116 116 nothing=widget_droplist(basedomaineven,title = 'number of levels', value = strtrim(sizedims, 2), uvalue = {name:'evensecchoice'}, uname='evensecchoice') 117 ENDIF 117 ENDIF 118 118 domainpart, top_uvalue, basedomaineven, evensecchoice[0] 119 119 widget_control, basedomaineven, set_uvalue = evensecchoice … … 145 145 oddevensecchoice = oddevensecchoice[sortedzdim] 146 146 nothing=widget_droplist(basedomainoddeven,title = 'number of levels', value = strtrim(sizedims, 2), uvalue = {name:'odd-evensecchoice'}, uname='odd-evensecchoice') 147 ENDIF 147 ENDIF 148 148 domainpart, top_uvalue, basedomainoddeven, oddevensecchoice[0] 149 149 widget_control, basedomainoddeven, set_uvalue = oddevensecchoice -
trunk/SRC/ToBeReviewed/INIT/initncdf.pro
r221 r226 64 64 ; 65 65 ; @restrictions 66 ; the file must contain an x and an y axis. (1 ou 2 dimen tional array)66 ; the file must contain an x and an y axis. (1 ou 2 dimensional array) 67 67 ; 68 68 ; @examples -
trunk/SRC/ToBeReviewed/LECTURE/GRIB/read_gribtable.pro
r163 r226 83 83 free_lun,lun 84 84 85 ; fill up missing vari ble names85 ; fill up missing variable names 86 86 index=WHERE(parmtabl[0,*] EQ '',count) 87 87 IF count GT 0 THEN parmtabl[0,index]='var'+strcompress(index,/rem) -
trunk/SRC/ToBeReviewed/LECTURE/read_ftp.pro
r157 r226 1 1 ;+ 2 ; @file_comments 3 ; 4 ; 2 ; @file_comments 3 ; 5 4 ; @categories 6 ; 7 ; 8 ; @param U 5 ; 6 ; @param U 9 7 ; 10 8 ; … … 12 10 ; 13 11 ; 14 ; @param RES 15 ; 12 ; @param RES 16 13 ; 17 14 ; @keyword OUT … … 19 16 ; 20 17 ; @keyword COUNT 21 ; Upon return, the number of elements in the result set. 18 ; Upon return, the number of elements in the result set. 22 19 ; This is only important when the result set is the empty 23 20 ; set, in which case COUNT is set to zero. 24 ; 21 ; 25 22 ; @restrictions 26 ; 27 ; 23 ; 28 24 ; @examples 29 25 ; 30 26 ; 31 27 ; @history 32 ; 28 ; 33 29 ; 34 30 ; @version … … 60 56 end 61 57 ;+ 62 ; @file_comments 63 ; 64 ; 58 ; @file_comments 59 ; 65 60 ; @categories 66 ; 67 ; 61 ; 68 62 ; @param TEXT 69 63 ; ASCII text string containing the message. … … 73 67 ; 74 68 ; @param PORT 75 ; 69 ; 76 70 ; @restrictions 77 ; 78 ; 71 ; 72 ; 79 73 ; @examples 80 74 ; 81 ;82 75 ; @history 83 ;84 76 ; 85 77 ; @version … … 173 165 ; 10 File(s) 3,618,694 bytes 174 166 ; 175 ; These compressed files can co sequently be opened with OPENR and the167 ; These compressed files can consequently be opened with OPENR and the 176 168 ; /COMPRESSED keyword. 177 169 ; … … 181 173 ; $Id$ 182 174 ; 183 ; @todo 175 ; @todo 184 176 ; seb: que fait-on de "syntax" au debut du header? 185 177 ; give examples with date in year 0 (should not exists but may happen) 186 ; 178 ; 187 179 ;- 188 180 pro read_ftp, site, files, dir, port, data=data, file=file, user=user, $ -
trunk/SRC/ToBeReviewed/LECTURE/read_ncdf.pro
r216 r226 2 2 ; @file_comments 3 3 ; Reading function for the file net_cdf. 4 ; This program is less universal than ncdf_lec (it appeal to declared 4 ; This program is less universal than ncdf_lec (it appeal to declared 5 5 ; variables in common.pro) but it is very easier to be used. It considerate 6 6 ; the declaration of the different zooms which have been defined 7 7 ; (ixminmesh...premierx...), the declaration of the variable key_shift... 8 8 ; To put it in a nutshell, the result of read_ncdf can be directly used in plt... 9 ; This is also this program which is used by default in our reading widgets. 9 ; This is also this program which is used by default in our reading widgets. 10 10 ; 11 11 ; @categories 12 12 ; Reading 13 ; 13 ; 14 14 ; @param NAME {in}{required}{type=string} 15 15 ; It define the field to be read. … … 18 18 ; Relative with the time axis. 19 19 ; These can be 20 ; - 2 date of the type yyyymmdd and in this case, we select dates 20 ; - 2 date of the type yyyymmdd and in this case, we select dates 21 21 ; which are included between these two dates. 22 ; - 2 indexes which define between which and which time step we have 22 ; - 2 indexes which define between which and which time step we have 23 23 ; to extract the temporal dimension. 24 24 ; … … 26 26 ; Relative with the time axis. 27 27 ; See BEGINNING. 28 ; 28 ; 29 29 ; @param COMPATIBILITY {in}{optional} 30 30 ; Useless, defined for compatibility 31 ; 32 ; @keyword BOXZOOM 33 ; Contain the boxzoom on which we have to do the reading 34 ; 31 ; 32 ; @keyword BOXZOOM 33 ; Contain the boxzoom on which we have to do the reading 34 ; 35 35 ; @keyword CALLITSELF {default=0}{type=scalar: 0 or 1} 36 36 ; For ROMS outputs. Use by read_ncdf itself to access auxilliary data (h and zeta). 37 ; 37 ; 38 38 ; @keyword FILENAME {required}{type=string} 39 39 ; It contains he file's name. 40 ; 40 ; 41 41 ; @keyword INIT {default=0}{type=scalar: 0 or 1} 42 42 ; To call automatically initncdf, filename and thus 43 43 ; redefine all the grid parameters 44 ; 44 ; 45 45 ; @keyword GRID 46 46 ; ='[UTVWF]' to specify the type of grid. Default is (1) … … 48 48 ; GRID[._][TUVFW].NC (not case sensible) or (2) T if case (1) 49 49 ; is not found. 50 ; 50 ; 51 51 ; @keyword TIMESTEP {default=0}{type=scalar: 0 or 1} 52 52 ; Specify that BEGINNING and ENDING refer to indexes of the time axis and not to dates 53 53 ; 54 54 ; @keyword TOUT {default=0}{type=scalar: 0 or 1} 55 ; We activate it if we want to read the file on the whole domain without 56 ; considerate the sub-domain defined by the boxzoom or 55 ; We activate it if we want to read the file on the whole domain without 56 ; considerate the sub-domain defined by the boxzoom or 57 57 ; lon1,lon2,lat1,lat2,vert1,vert2. 58 ; 58 ; 59 59 ; @keyword NOSTRUCT {default=0}{type=scalar: 0 or 1} 60 ; We activate it if we do not want that read_ncdf send back a structure 60 ; We activate it if we do not want that read_ncdf send back a structure 61 61 ; but only the array referring to the field. 62 ; 62 ; 63 63 ; @keyword TIMEVAR {type=string} 64 64 ; It define the name of the variable that … … 74 74 ; 75 75 ; @keyword _EXTRA 76 ; Used to pass your keywords 76 ; Used to pass your keywords 77 77 ; 78 78 ; @returns 79 79 ; Structure readable by litchamp.pro or an array if NOSTRUCT is activated. 80 ; 80 ; 81 81 ; @uses 82 82 ; common.pro 83 ; 83 ; 84 84 ; @restrictions 85 85 ; The field must have a temporal dimension. 86 ; 86 ; 87 87 ; @history 88 88 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 89 ; 15/10/1999 90 ; 89 ; 15/10/1999 90 ; 91 91 ; @version 92 ; $Id$ 92 ; $Id$ 93 93 ;- 94 94 ;--------------------------------------------------------- … … 116 116 ; we find the filename. 117 117 ;------------------------------------------------------------ 118 ; print,filename 118 ; print,filename 119 119 ; is parent a valid widget ? 120 120 if keyword_set(parentin) then BEGIN … … 145 145 ncdf_diminq, cdfid, varcontient.dim[i], tmp, dimsize 146 146 dimnames[i] = tmp 147 ENDFOR 147 ENDFOR 148 148 ;------------------------------------------------------------ 149 149 ; shall we redefine the grid parameters … … 174 174 lasttps = where(time EQ date2) & lasttps = lasttps[0] 175 175 ENDIF ELSE BEGIN 176 IF keyword_set(timevar) THEN BEGIN 176 IF keyword_set(timevar) THEN BEGIN 177 177 timeid = ncdf_varid(cdfid, timevar) 178 178 IF timeid EQ -1 THEN BEGIN … … 183 183 timecontient = ncdf_varinq(cdfid, timeid) 184 184 contient.recdim = timecontient.dim[0] 185 ENDIF ELSE BEGIN 185 ENDIF ELSE BEGIN 186 186 ; we find the infinite dimension 187 187 timedim = contient.recdim … … 190 190 return, report('the file '+filename+' as no infinite dimension. !C Use TIMESTEP or TIMEVAR keyword') 191 191 endif 192 ; we find the FIRST time axis 192 ; we find the FIRST time axis 193 193 timeid = 0 194 194 repeat BEGIN ; As long as we have not find a variable having only one dimension: the infinite one … … 204 204 endif 205 205 timeid = timeid-1 206 ENDELSE 206 ENDELSE 207 207 ; we must found the time origin of the julian calendar used in the 208 ; time axis. 208 ; time axis. 209 209 ; does the attribut units an dcalendar exist for the variable time axis? 210 210 if timecontient.natts EQ 0 then BEGIN … … 231 231 'greg':IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg' 232 232 ELSE:BEGIN 233 ; notused = report('Unknown calendar: '+value+', we use greg calendar.') 233 ; notused = report('Unknown calendar: '+value+', we use greg calendar.') 234 234 key_caltype = 'greg' 235 235 END 236 236 ENDCASE 237 237 ENDIF ELSE BEGIN 238 ; notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 238 ; notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 239 239 IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg' 240 240 ENDELSE … … 272 272 'hour':time = julday(depart[1], depart[2], depart[0])+time/24.d 273 273 'day':time = julday(depart[1], depart[2], depart[0])+time 274 'month':BEGIN 274 'month':BEGIN 275 275 if total(fix(time) NE time) NE 0 then $ ; we switch to days with 30d/m 276 276 time = julday(depart[1], depart[2], depart[0])+round(time*30) $ … … 327 327 dimnames[0] EQ 'xi_u' AND dimnames[1] EQ 'eta_rho':vargrid = 'U' 328 328 dimnames[0] EQ 'xi_u' AND dimnames[1] EQ 'eta_v' :vargrid = 'F' 329 ELSE:BEGIN 329 ELSE:BEGIN 330 330 ; could we define the grid type from the file name?? 331 331 pattern = ['GRID.', 'GRID_', 'GRID', 'UPID_', '30ID_'] … … 369 369 endcase 370 370 ENDIF ELSE BEGIN 371 if keyword_set(boxzoom) then BEGIN 371 if keyword_set(boxzoom) then BEGIN 372 372 Case 1 Of 373 373 N_Elements(Boxzoom) Eq 1:bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] … … 386 386 ENDIF 387 387 grille, mask, glam, gphi, gdep, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 388 undefine, glam & undefine, gphi & ; We liberate some memo ty!388 undefine, glam & undefine, gphi & ; We liberate some memory! 389 389 ENDELSE 390 390 ;--------------------------------------------------------------------- … … 442 442 if found NE -1 then ncdf_attget, cdfid, name, attnames[found], missing_value 443 443 ; 444 ENDIF ELSE BEGIN 444 ENDIF ELSE BEGIN 445 445 IF NOT keyword_set(callitself) THEN varunit = '' 446 446 add_offset = 0. … … 484 484 ; we look for missing_value 485 485 IF size(missing_value, /type) NE 7 then BEGIN 486 IF size(missing_value, /type) EQ 1 THEN BEGIN 486 IF size(missing_value, /type) EQ 1 THEN BEGIN 487 487 missing_value = strlowcase(string(missing_value)) 488 IF strmid(missing_value, 0, 1, /reverse_offset) EQ 'f' THEN $ 488 IF strmid(missing_value, 0, 1, /reverse_offset) EQ 'f' THEN $ 489 489 missing_value = strmid(missing_value, 0, strlen(missing_value)-1) 490 IF isnumber(string(missing_value), tmp) EQ 1 THEN missing_value = tmp ELSE BEGIN 490 IF isnumber(string(missing_value), tmp) EQ 1 THEN missing_value = tmp ELSE BEGIN 491 491 print, 'Warning: missing value is not a number: ', missing_value 492 492 missing_value = - 1 493 493 ENDELSE 494 ENDIF 494 ENDIF 495 495 ; if missing_value NE valmask then begin 496 496 if abs(missing_value) LT 1e6 then missing = where(res EQ missing_value) $ … … 498 498 ; ENDIF ELSE missing = -1 499 499 ENDIF ELSE missing = -1 500 ; we apply add_offset, scale_factor and missing_value 500 ; we apply add_offset, scale_factor and missing_value 501 501 if scale_factor NE 1 then res = temporary(res)*scale_factor 502 502 if add_offset NE 0 then res = temporary(res)+add_offset … … 538 538 IF keyword_set(nostruct) THEN return, res 539 539 IF keyword_set(key_forgetold) THEN BEGIN 540 return, {arr:temporary(res), grid:vargrid, unit:varunit, experiment:varexp, name:varname} 541 ENDIF ELSE BEGIN 540 return, {arr:temporary(res), grid:vargrid, unit:varunit, experiment:varexp, name:varname} 541 ENDIF ELSE BEGIN 542 542 return, {tab:temporary(res), grille:vargrid, unite:varunit, experience:varexp, nom:varname} 543 543 ENDELSE -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/pltbase.pro
r171 r226 5 5 ; 6 6 ; @file_comments 7 ; Overlayer contour to trace a field which can be mask. 7 ; Overlayer contour to trace a field which can be mask. 8 8 ; Elementary brick of plt, pltz et pltt. 9 9 ; 10 ; @categories 10 ; @categories 11 11 ; Graphics 12 12 ; … … 21 21 ; 22 22 ; @param MASK {in}{required}{type=array} 23 ; It is the array who mask z2d (with 0s on points we want to mask and 1s on others). 23 ; It is the array who mask z2d (with 0s on points we want to mask and 1s on others). 24 24 ; If z2d is not masked, put this argument equal to 1. 25 25 ; 26 26 ; @param XM {in}{required} 27 ; Axis of the mask. Vector or array of the same size that mask. 27 ; Axis of the mask. Vector or array of the same size that mask. 28 28 ; This is the coordinate of mask on x. 29 29 ; 30 30 ; @param YM {in}{required} 31 ; Axis of the mask. Vector or array of the same size that mask. 31 ; Axis of the mask. Vector or array of the same size that mask. 32 32 ; This is the coordinate of mask on y. 33 33 ; 34 34 ; @param LEVELS {in}{optional}{type=vector} 35 ; Vectors which contain levels needed at the contour. 35 ; Vectors which contain levels needed at the contour. 36 36 ; If it is not given, we take 20 levels between the min and the max. 37 ; 37 ; 38 38 ; @param COLORS {in}{optional}{type=vector} 39 ; Vectors which contain colors needed at the contour. 39 ; Vectors which contain colors needed at the contour. 40 40 ; If it is not given, we take 20 levels between the min and the max. 41 41 ; 42 ; @keyword COLORTRICHAMP 42 ; @keyword COLORTRICHAMP 43 43 ; The color we want to use to draw the triangulation which is used to make contours of the field. 44 44 ; 45 ; @keyword COLORTRIMASK 45 ; @keyword COLORTRIMASK 46 46 ; The color we want to use to draw the triangulation which is used to make contours of the mask. 47 47 ; 48 ; @keyword COLOR_C 48 ; @keyword COLOR_C 49 49 ; To draw the contour in color instead of in black 50 ; with filling in color 51 ; 52 ; @keyword CONT_NOFILL 53 ; Activate it not to fill the point mask to let them transparent! 50 ; with filling in color 51 ; 52 ; @keyword CONT_NOFILL 53 ; Activate it not to fill the point mask to let them transparent! 54 54 ; Comment: Nevertheless, we trace mask's contour. 55 55 ; … … 57 57 ; The color of the continent. 58 58 ; 59 ; @keyword DESSTRICHAMP 60 ; To draw the triangulation which is used to make field's contours. 61 ; 62 ; @keyword DESSTRIMASK 59 ; @keyword DESSTRICHAMP 60 ; To draw the triangulation which is used to make field's contours. 61 ; 62 ; @keyword DESSTRIMASK 63 63 ; To draw the triangulation which is used to make mask's contours. 64 ; 65 ; @keyword FORPLT 64 ; 65 ; @keyword FORPLT 66 66 ; To activate if we want that the drawing of coast be realized by tracecote rather than tracemask. 67 67 ; 68 68 ; @keyword I_COLORS {type=vector} 69 ; It is a vector specifying the colors to use to trace contours. 69 ; It is a vector specifying the colors to use to trace contours. 70 70 ; It is the same thing that c_colors which act on contours. 71 71 ; … … 74 74 ; % Out of range subscript encountered: <LONG Array[38911]>. 75 75 ; % Execution halted at: PLTBASE 151 76 ; If the bug still exist, increase the value of more! 76 ; If the bug still exist, increase the value of more! 77 77 ; (The explanation and the justification of this method do not have scientific bases yet...). 78 78 ; … … 89 89 ; I specify we only label one contour on two. 90 90 ; 91 ; @keyword CONTOUR 91 ; @keyword CONTOUR 92 92 ; To be used since plt, pltz or pltt. (Have a look on these routines). 93 93 ; 94 ; @keyword _EXTRA 94 ; @keyword _EXTRA 95 95 ; Used to pass your keywords 96 96 ; … … 106 106 ; 8/2/2000 check if the tri array is not equal to 107 107 ; -1. allow contour with out using a triangulation. 108 ; 108 ; 109 109 ; @version 110 110 ; $Id$ … … 146 146 ;--------------------------------------------------------- 147 147 ; 148 ; Explanation concerning contour. This keyword is activated when we trace a 148 ; Explanation concerning contour. This keyword is activated when we trace a 149 149 ; colored contour different from the one with black trait. 150 150 ; If it is activated (case n_elements(contour) NE 0), we pass 2 time in pltbase: 151 151 ; 1) We trace colors then we leave, it is the case: 152 152 ; n_elements(contour) NE 0 AND n_elements(contour) NE 4) 153 ; 2) We trace contours in traits then continents, it is the case: 153 ; 2) We trace contours in traits then continents, it is the case: 154 154 ; n_elements(contour) NE 0 AND n_elements(contour) EQ 4) 155 155 ; … … 162 162 ; If levels and colors aren't given 163 163 ;---------------------------------------------------------------------- 164 if n_params() EQ 4 then $ 164 if n_params() EQ 4 then $ 165 165 label, 0, min(z2d*mask), max(z2d*mask), ncontour, levels, colors 166 166 ; attention bidouille inexplicable pour que tout se passe bien avec les … … 171 171 ; Is cell_fill is a part of _extra, we desactive it if it is nt equal to 2 172 172 ;---------------------------------------------------------------------- 173 IF chkstru(ex, 'CELL_FILL') THEN BEGIN 173 IF chkstru(ex, 'CELL_FILL') THEN BEGIN 174 174 cell_fill = ex.CELL_FILL 175 175 if ex.CELL_FILL NE 2 then ex.CELL_FILL = 0 176 176 ENDIF ELSE cell_fill = 0 ; 177 177 ;---------------------------------------------------------------------- 178 ; I) Filling of contours in palette colors 178 ; I) Filling of contours in palette colors 179 179 ;---------------------------------------------------------------------- 180 180 if NOT keyword_set(more) then more = 10 181 181 if NOT keyword_set(nofill) AND NOT keyword_set(color_c) then begin 182 if n_elements(contour) NE 4 THEN BEGIN 182 if n_elements(contour) NE 4 THEN BEGIN 183 183 if usetri EQ 2 then BEGIN 184 184 IF size(x, /n_dimensions) EQ 1 THEN x = x#replicate(1, (size(z2d))[2]) … … 191 191 IF size(y, /n_dimensions) EQ 2 THEN y = reform(y[0, *]) 192 192 contour, z2d, x, y, levels = levels, c_color = colors, /noerase $ 193 , /fill, _extra = ex 193 , /fill, _extra = ex 194 194 ENDELSE 195 195 ENDIF 196 196 ENDIF 197 if n_elements(contour) NE 0 AND n_elements(contour) NE 4 THEN GOTO, fini 197 if n_elements(contour) NE 0 AND n_elements(contour) NE 4 THEN GOTO, fini 198 198 IF chkstru(ex, 'C_ORIENTATION') THEN ex = extractstru(ex, 'C_ORIENTATION') 199 199 IF chkstru(ex, 'C_SPACING') THEN ex = extractstru(ex, 'C_SPACING') … … 207 207 ; 208 208 IF (n_elements(mask) GT 1 OR n_elements(masknan) GT 1) $ 209 AND NOT keyword_set(cont_nofill) THEN BEGIN 210 IF keyword_set(maskorg) THEN tonan = maskorg*masknan ELSE tonan = mask*masknan 209 AND NOT keyword_set(cont_nofill) THEN BEGIN 210 IF keyword_set(maskorg) THEN tonan = maskorg*masknan ELSE tonan = mask*masknan 211 211 tonan = where(remplit(tonan, nite = 1, mask = tonan $ 212 212 , /basique, fillval = 0 $ 213 213 , fillxdir = keyword_set(realsection)) EQ 0, count) 214 214 IF count NE 0 THEN z2d[temporary(tonan)] = !values.f_nan 215 ENDIF 215 ENDIF 216 216 ; 217 217 ; We do not pass if we have to make differents contours... … … 232 232 ENDCASE 233 233 ; 234 IF usetri EQ 2 THEN BEGIN 234 IF usetri EQ 2 THEN BEGIN 235 235 IF size(x, /n_dimensions) EQ 1 THEN x = x#replicate(1, (size(z2d))[2]) 236 236 IF size(y, /n_dimensions) EQ 1 THEN y = replicate(1, (size(z2d))[1])#y … … 253 253 IF chkstru(ex, 'LEVELS') THEN ex = extractstru(ex, 'LEVELS') 254 254 IF chkstru(ex, 'NODATA') THEN ex = extractstru(ex, 'NODATA') 255 IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 256 ; 257 ; If there is points at NaN 258 ; We trace points in white at NaN b afore drawing coasts with a trait.255 IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 256 ; 257 ; If there is points at NaN 258 ; We trace points in white at NaN before drawing coasts with a trait. 259 259 ; 260 260 if keyword_set(trinan) THEN BEGIN … … 298 298 , COINDESCEND = coindescendmask, CONT_COLOR = cont_color, _extra = ex 299 299 END 300 ELSE:BEGIN 300 ELSE:BEGIN 301 301 IF size(xm, /n_dimensions) EQ 2 THEN xm = xm[*, 0] 302 302 IF size(ym, /n_dimensions) EQ 2 THEN ym = reform(ym[0, *]) … … 310 310 ;------------------------------------------------------------ 311 311 case 1 of 312 keyword_set(realsection) AND NOT keyword_set(cont_nofill): 312 keyword_set(realsection) AND NOT keyword_set(cont_nofill): 313 313 keyword_set(realsection) AND keyword_set(cont_nofill): $ 314 314 drawsectionbottom, mask, xm, ym $ … … 334 334 ; 335 335 fini: 336 IF keyword_set(key_performance) THEN print, 'temps pltbase', systime(1)-tempsun 336 IF keyword_set(key_performance) THEN print, 'temps pltbase', systime(1)-tempsun 337 337 338 338 return -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/pltz.pro
r172 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; Trace vertical graphs. 8 8 ; 9 ; @categories 9 ; @categories 10 10 ; Graphics 11 11 ; 12 ; @param TAB 12 ; @param TAB 13 13 ; The field whose we want to make a vertical cut can be 2 kind of thing: 14 ; 1) An 2d or 3d array. 15 ; If the field is 2d, indicate, with the keyword BOXZOOM, geographic delineations of the boxzoom. 14 ; 1) An 2d or 3d array. 15 ; If the field is 2d, indicate, with the keyword BOXZOOM, geographic delineations of the boxzoom. 16 16 ; If the field is 3d, we extract the section on we average possibly before to do the plot. 17 ; 2) a structure respecting all criterions specified by litchamp.pro. 17 ; 2) a structure respecting all criterions specified by litchamp.pro. 18 18 ; See IDL> xhelp,'litchamp'. The array contained in the structure must be 2 or 3d (See case 1) 19 19 ; 20 20 ; ces arguments ne sont pas obligatoires: 21 ; 21 ; 22 22 ; MAX: valeur maximum que l'on veut prendre en compte dans le trace 23 23 ; des contours. Par defaut on prend le max de tab1 (sur les pts mer) … … 26 26 ; des contours. Par defaut on prend le min de tab1 (sur les pts mer) 27 27 ; 28 ; @keyword BOXZOOM 29 ; Vector indicating the geographic zone on which we want to cut the map. 28 ; @keyword BOXZOOM 29 ; Vector indicating the geographic zone on which we want to cut the map. 30 30 ; If BOXZOOM has : 31 31 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] … … 37 37 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 38 38 ; 39 ; @keyword CONTINTERVALLE 40 ; When CONTOUR is activated, it is the value between 2 isolines 41 ; traced by a trait. So it can be different from the one specified by INTERVALLE which, 42 ; in this case, does not control colored isolines in color anymore. If there is noone 43 ; specified min, we choose a contour min which goes well with the specified interval! 44 ; If this keyword is not specified, we trace 20 isolines from the min to the max. 39 ; @keyword CONTINTERVALLE 40 ; When CONTOUR is activated, it is the value between 2 isolines 41 ; traced by a trait. So it can be different from the one specified by INTERVALLE which, 42 ; in this case, does not control colored isolines in color anymore. If there is noone 43 ; specified min, we choose a contour min which goes well with the specified interval! 44 ; If this keyword is not specified, we trace 20 isolines from the min to the max. 45 45 ; 46 46 ; @keyword CONTLABEL {type=integer} 47 47 ; When CONTOUR is activated, if n 48 ; is different of 0, choose the label type corresponding to n cases for 49 ; the traced by a traitisolines. To specify the type of label of the 48 ; is different of 0, choose the label type corresponding to n cases for 49 ; the traced by a traitisolines. To specify the type of label of the 50 50 ; colored contour, use LABEL 51 51 ; 52 52 ; @keyword CONTMAX {default=max of the keyword CONTOUR (on ocean points)} 53 ; When CONTOUR is activated, max value we want to consider in the isoline 53 ; When CONTOUR is activated, max value we want to consider in the isoline 54 54 ; traced by a trait's line. 55 55 ; 56 56 ; @keyword CONTMIN {default=min of the keyword CONTOUR (on ocean points)} 57 ; When CONTOUR is activated, min value we want to consider in the isoline 58 ; traced by a trait's line. 57 ; When CONTOUR is activated, min value we want to consider in the isoline 58 ; traced by a trait's line. 59 59 ; 60 60 ; @keyword CONTNLEVEL {default=20} … … 63 63 ; CONTLABEL=0). 64 64 ; 65 ; @keyword CONTOUR 66 ; If we want to trace contours of a different field than the one 67 ; whose we have the colored drawing (by example E-P in color and QSR in contours). 65 ; @keyword CONTOUR 66 ; If we want to trace contours of a different field than the one 67 ; whose we have the colored drawing (by example E-P in color and QSR in contours). 68 68 ; It must be a field respecting same characteristics than the argument number one of plt. 69 69 ; 70 ; @keyword ENDPOINTS 71 ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities 72 ; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are 73 ; coordinates. 74 ; 75 ; @keyword INTERVALLE 76 ; Value of an internal between to isoline. If there is none specified min, 77 ; we choose a min contour which goes well with the specified interval!. If this keyword is not 78 ; specified, we trace 20 isoline from the min to the max. Comment: When CONTOUR is activated, 79 ; INTERVALLE only specify the interval between 2 colored isoline. To specify the interval 70 ; @keyword ENDPOINTS 71 ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities 72 ; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are 73 ; coordinates. 74 ; 75 ; @keyword INTERVALLE 76 ; Value of an internal between to isoline. If there is none specified min, 77 ; we choose a min contour which goes well with the specified interval!. If this keyword is not 78 ; specified, we trace 20 isoline from the min to the max. Comment: When CONTOUR is activated, 79 ; INTERVALLE only specify the interval between 2 colored isoline. To specify the interval 80 80 ; between 2 isolines traced by a trait, use CONTINTERVALLE. 81 81 ; 82 ; @keyword INV 83 ; Invert the color vector used to color the graph 82 ; @keyword INV 83 ; Invert the color vector used to color the graph 84 84 ; (without use the black, the white and the used palette) 85 85 ; 86 86 ; @keyword ZRATIO {default=2./3} 87 ; When the drawing has a zoomed part, it is the size rapport between the zoomed part, 87 ; When the drawing has a zoomed part, it is the size rapport between the zoomed part, 88 88 ; hz (zoom height), and the whole drawing, ht (total height). 89 89 ; 90 90 ; @keyword LABEL {default=0}{type=integer} 91 91 ; It choose the label's type corresponding to cases in label.pro. 92 ; Comment: When CONTOUR is activated, it only specify the label's type for colored isolines. 93 ; For these one traced by a trait, use CONTLABEL. 94 ; 95 ; @keyword MAXIN 92 ; Comment: When CONTOUR is activated, it only specify the label's type for colored isolines. 93 ; For these one traced by a trait, use CONTLABEL. 94 ; 95 ; @keyword MAXIN 96 96 ; to specify the max value we want to plot with a keyword instead of with the 97 97 ; input parameter max. If max is defined by both, parameter and keyword, the 98 98 ; keyword is retained. 99 99 ; 100 ; @keyword MININ 100 ; @keyword MININ 101 101 ; to specify the min value we want to plot with a keyword instead of with the 102 102 ; input parameter min. If min is defined by both, parameter and keyword, the … … 106 106 ; Number of contour to draw by default =20. active if 107 107 ; LABEL=0 or is not specified. 108 ; 109 ; @keyword NOTRI 110 ; To force not to use the triangulation. Beware, in this case, the 111 ; drawing only works if the grid is undeformed (It means that each point of a longitude 112 ; give one latitude and each point of a latitude give one longitude) except if we use 113 ; the keyword CELL_FILL=2. 108 ; 109 ; @keyword NOTRI 110 ; To force not to use the triangulation. Beware, in this case, the 111 ; drawing only works if the grid is undeformed (It means that each point of a longitude 112 ; give one latitude and each point of a latitude give one longitude) except if we use 113 ; the keyword CELL_FILL=2. 114 114 ; Comment: if the field contain points !values.f_nan, then we even do a triangulation. 115 115 ; 116 ; @keyword OVERPLOT 117 ; To make a plot over an other one. 118 ; Comment: Contrarily to the use of CONTOUR or VECTEUR, the use of this keyword 116 ; @keyword OVERPLOT 117 ; To make a plot over an other one. 118 ; Comment: Contrarily to the use of CONTOUR or VECTEUR, the use of this keyword 119 119 ; does not the caption and/or the color bar. 120 120 ; 121 ; @keyword SIN 122 ; Activate this keyword if we want the x axis to be traced in sinus of the 121 ; @keyword SIN 122 ; Activate this keyword if we want the x axis to be traced in sinus of the 123 123 ; latitude when we make a drawing f(y) 124 124 ; 125 ; @keyword STRICTFILL 126 ; Activate this keyword to that the filling of contours be 127 ; precisely done between the min and the max specified letting values inferior at the 125 ; @keyword STRICTFILL 126 ; Activate this keyword to that the filling of contours be 127 ; precisely done between the min and the max specified letting values inferior at the 128 128 ; specified min and values superior at the specified max in white. 129 129 ; … … 131 131 ; Contour's style to adopt to draw isolines 132 132 ; 133 ; @keyword WDEPTH 134 ; To specify that the field is at W depth instead of T 133 ; @keyword WDEPTH 134 ; To specify that the field is at W depth instead of T 135 135 ; depth (automatically activated if vargrid eq 'W') 136 136 ; … … 209 209 IF usetri EQ 1 AND keyword_set(realsection) THEN usetri = 0 210 210 ; did we specify the type ? 211 if keyword_set(typein) then BEGIN 211 if keyword_set(typein) then BEGIN 212 212 if size(type, /type) NE 7 AND size(type, /type) NE 0 then begin 213 213 if n_elements(min) NE 0 then max = min … … 216 216 type = typein 217 217 ENDIF 218 ; 218 ; 219 219 checktypeminmax, 'pltz', TYPE = type, MIN = min, MAX = max $ 220 220 , XZ = xz, YZ = yz, ENDPOINTS = endpoints, _extra = ex 221 221 ; 222 222 if keyword_set(endpoints) then begin 223 section, tab, z2d, glam, gphi, ENDPOINTS = endpoints, TYPE = type $ 223 section, tab, z2d, glam, gphi, ENDPOINTS = endpoints, TYPE = type $ 224 224 , BOXZOOM = boxzoom, DIREC = direc, WDEPTH = wdepth, _extra = ex 225 if z2d[0] EQ -1 AND n_elements(contour) ne 4 then BEGIN 225 if z2d[0] EQ -1 AND n_elements(contour) ne 4 then BEGIN 226 226 restoreboxparam, 'boxparam4pltz.dat' 227 227 return 228 228 ENDIF 229 nx = n_elements(glam) 229 nx = n_elements(glam) 230 230 ny = nx 231 231 if strupcase(vargrid) EQ 'W' then begin … … 240 240 z2d = checkfield(tab, 'pltz', TYPE = type, BOXZOOM = boxzoom $ 241 241 , DIREC = direc, WDEPTH = wdepth, _extra = ex) 242 if z2d[0] EQ -1 AND n_elements(contour) ne 4 then BEGIN 242 if z2d[0] EQ -1 AND n_elements(contour) ne 4 then BEGIN 243 243 restoreboxparam, 'boxparam4pltz.dat' 244 244 return … … 260 260 z2d = reverse(z2d, 2) 261 261 ;----------------------------------------------------------------------------- 262 ; Determination of the mi:min and of the ma:max of z2d in the same way 262 ; Determination of the mi:min and of the ma:max of z2d in the same way 263 263 ; as max: max and min: min for the drawing. 264 264 ;----------------------------------------------------------------------------- … … 316 316 z2d = remplit(z2d, nite = 1-(n_elements(maskfill) NE 0) $ 317 317 , mask = z2d LT valmask/10, /basique, _extra = ex) 318 ENDIF ELSE BEGIN 318 ENDIF ELSE BEGIN 319 319 ; filling the mask values with 8 neighbourg 320 320 z2d = remplit(z2d, nite = (1+(vargrid NE 'T')+keyword_set(nan)) $ 321 321 *(1-(n_elements(maskfill) NE 0)), mask = mask*masknan $ 322 322 , /basique, _extra = ex) 323 ENDELSE 323 ENDELSE 324 324 if keyword_set(strictfill) EQ 0 AND n_elements(maskfill) EQ 0 $ 325 325 then z2d = min > z2d < max … … 329 329 ENDIF 330 330 ;---------------------------------------------------------- 331 ; check the mask and the triangulation according to the grid type and 331 ; check the mask and the triangulation according to the grid type and 332 332 ; nan values. find the coordinates of the mask 333 ;---------------------------------------------------------- 333 ;---------------------------------------------------------- 334 334 ; if (where(mask EQ 0))[0] EQ -1 AND NOT keyword_set(nan) then notri = 1 335 335 ; if keyword_set(notri) then trifield = -1 $ … … 347 347 xmask = xxaxis 348 348 zmask = zzaxis 349 ENDELSE 350 ; 351 if (usetri GE 1 AND (vargrid NE 'T' AND vargrid NE 'W')) THEN BEGIN 349 ENDELSE 350 ; 351 if (usetri GE 1 AND (vargrid NE 'T' AND vargrid NE 'W')) THEN BEGIN 352 352 IF keyword_set(realsection) THEN trimsk = triangule(mask, /basic) $ 353 353 ELSE trimsk = triangule(mask, /basic, coinmonte = coinmontemask $ 354 354 , coindescend = coindescendmask) 355 ENDIF 355 ENDIF 356 356 ;------------------------------------------------------------ 357 357 ; dessin en lui meme … … 387 387 return 388 388 endif 389 if keyword_set(contour) THEN BEGIN 389 if keyword_set(contour) THEN BEGIN 390 390 pourlegende = [1, 1, 1, 1] 391 391 oldattributs = saveatt() … … 403 403 ; 3rd part: drawing of the frame, caption, colorbar... 404 404 ;------------------------------------------------------------ 405 if keyword_set(overplot) then BEGIN 405 if keyword_set(overplot) then BEGIN 406 406 !y.range = [zoom, profmin] ; We get back on physic coordinates 407 407 plot, [0], [0], /nodata, /noerase, title = '', subtitle = '', xstyle = 5, ystyle = 5 … … 409 409 endif 410 410 ;------------------------------------------------------------ 411 ; Caption + d ysplay of them411 ; Caption + display of them 412 412 ;------------------------------------------------------------ 413 413 legende, mi, ma, type, CONTOUR = pourlegende, INTERVALLE = intervalle, DIREC = direc, endpoints = endpoints, _EXTRA = ex … … 423 423 ; Y axis in 1 or 2 part 424 424 ;------------------------------------------------------------ 425 if n_elements(ex) NE 0 then BEGIN 425 if n_elements(ex) NE 0 then BEGIN 426 426 ; To do not put title anymore 427 427 if (where(tag_names(ex) EQ 'TITLE'))[0] NE -1 then ex.TITLE = ' ' … … 429 429 if (where(tag_names(ex) EQ 'SUBTITLE'))[0] NE -1 then ex.SUBTITLE = ' ' 430 430 ; To have just one ytitle 431 if (where(tag_names(ex) EQ 'YTITLE'))[0] NE -1 then BEGIN 431 if (where(tag_names(ex) EQ 'YTITLE'))[0] NE -1 then BEGIN 432 432 ytitle = ex.YTITLE 433 433 ex.YTITLE = ' ' … … 480 480 restoreboxparam, 'boxparam4pltz.dat' 481 481 ; 482 if keyword_set(key_performance) NE 0 THEN print, 'temps pltz', systime(1)-tempsun 482 if keyword_set(key_performance) NE 0 THEN print, 'temps pltz', systime(1)-tempsun 483 483 return 484 484 end -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/scontour.pro
r223 r226 43 43 ; 1) I reinitializate the graphic environment (variables !x, !y et !p): 44 44 if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex 45 ; 2) i put the drawing on the screen like on the post cript45 ; 2) i put the drawing on the screen like on the postscript 46 46 ; if ex contains norease and c_orientation keywords we force ex.noerase = 0 47 47 IF chkstru(ex, 'overplot') EQ 0 THEN placedessin, 'autre', _extra = ex 48 ; fiddle when noerase is used with c_or entation...48 ; fiddle when noerase is used with c_orientation... 49 49 ; call contour with /nodata to get the graphic environment, then force 50 50 ; noerase = 0 and overplot = 1 51 51 IF size(ex, /type) EQ 8 THEN BEGIN 52 ; check if noerase is used with c_or entation52 ; check if noerase is used with c_orientation 53 53 alltags = strlowcase(tag_names(ex)) 54 54 dummy = where(alltags EQ 'noerase', count1) … … 71 71 3:contour, x, y, z, xstyle = 1, ystyle = 1, _EXTRA = ex 72 72 ENDCASE 73 ; fiddle when noerase is used with c_or entation... draw the contour axis73 ; fiddle when noerase is used with c_orientation... draw the contour axis 74 74 IF keyword_set(noerase_orientation) THEN BEGIN 75 75 ex.noerase = 1 -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/splot.pro
r223 r226 47 47 ; 1) I reinitializate the graphic environment (les variables !x, !y et !p): 48 48 if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex 49 ; 2) i put the drawing on the screen like on the post cript49 ; 2) i put the drawing on the screen like on the postscript 50 50 placedessin, 'autre', _extra = ex 51 51 ; 3) Drawing -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/tvplus.pro
r163 r226 7 7 ; Enhanced version of tvscl 8 8 ; 9 ; @categories quick exploration of 2D arrays 10 ; 11 ; INPUTS: 9 ; @categories quick exploration of 2D arrays 12 10 ; 13 11 ; @param Z2D {in}{required} … … 21 19 ; of cellsize that forces tvplus to create a window larger than 22 20 ; the screen, a "scrolling window" will be displayed instead of a 23 ; regular window. Unfortunately the nice function nalities of tvplus21 ; regular window. Unfortunately the nice functionalities of tvplus 24 22 ; are not coded for "scrolling window" case... 25 23 ; … … 33 31 ; The color number that should be used for the mask values. 34 32 ; 35 ; @keyword OFFSET 33 ; @keyword OFFSET 36 34 ; 2 elements vector used by tvplus itself when showing zoom. 37 35 ; It is used to shift the ranges of xaxis and yaxis. 38 ; For example: tvplus,sst[x1:x2,y1:y2],off est=[x1,y1]39 ; 40 ; @keyword MASK 36 ; For example: tvplus,sst[x1:x2,y1:y2],offset=[x1,y1] 37 ; 38 ; @keyword MASK 41 39 ; The mask value. Note that if abs(mask) < 1.e6, then the 42 40 ; exact value of the mask is used to find the maskwd point. … … 67 65 ; @keyword _EXTRA 68 66 ; used to pass keywords to TV, PLOT, COLORBAR 69 ; 70 ; @restrictions 67 ; 68 ; @restrictions 71 69 ; use your mouse to scan the array values... 72 70 ; left button : mouse position and associated array value … … 74 72 ; right button : quit 75 73 ; 76 ; the nice function nalities of tvplus are not coded74 ; the nice functionalities of tvplus are not coded 77 75 ; for "scrolling window" case... 78 76 ; … … 102 100 arr = reform(float(z2d)) 103 101 ;------------------------------------------------------------ 104 ; check the size of the input array 102 ; check the size of the input array 105 103 ;------------------------------------------------------------ 106 104 if (size(arr))[0] NE 2 then begin … … 130 128 ;------------------------------------------------------------ 131 129 ; Compute the size (in pixel) of the square representing 1 132 ; point of the input array 130 ; point of the input array 133 131 ;------------------------------------------------------------ 134 132 dimensions = GET_SCREEN_SIZE() 135 if n_elements(cellsize) EQ 0 then BEGIN 133 if n_elements(cellsize) EQ 0 then BEGIN 136 134 cellsize = min(floor(dimensions/(size(z2d))[1: 2]*.75)) 137 ENDIF ELSE $ 135 ENDIF ELSE $ 138 136 ; we need to use a scrolling bar window 139 137 if cellsize GE min(floor(dimensions/(size(z2d))[1: 2]*.75)) then scrolling = 1 … … 145 143 ; Change the value of the masked value for the min of the non-masked values 146 144 ;------------------------------------------------------------ 147 if n_elements(mask) then BEGIN 148 if abs(mask) LT 1e6 then BEGIN 145 if n_elements(mask) then BEGIN 146 if abs(mask) LT 1e6 then BEGIN 149 147 masked = where(arr EQ mask) 150 148 if masked[0] NE -1 then arr[masked] = min(arr[where(arr NE mask)]) 151 ENDIF ELSE BEGIN 149 ENDIF ELSE BEGIN 152 150 masked = where(abs(arr) GE abs(mask)/10.) 153 151 if masked[0] NE -1 then arr[masked] = min(arr[where(abs(arr) LT abs(mask)/10.)]) … … 157 155 ; apply min/max keywords 158 156 ;------------------------------------------------------------ 159 if n_elements(min) NE 0 then BEGIN 157 if n_elements(min) NE 0 then BEGIN 160 158 arr = min > arr 161 159 truemin = min 162 160 ENDIF ELSE truemin = min(arr) 163 if n_elements(max) NE 0 then BEGIN 161 if n_elements(max) NE 0 then BEGIN 164 162 arr = arr < max 165 163 truemax = max … … 171 169 ENDIF 172 170 ;------------------------------------------------------------ 173 ; apply other keywords (nointerp, c_nan, c_mask) 171 ; apply other keywords (nointerp, c_nan, c_mask) 174 172 ;------------------------------------------------------------ 175 173 if NOT keyword_set(nointerp) then BEGIN … … 177 175 m = 1.*(ncolors-1)/(truemax-truemin) 178 176 p = bottom-1.*truemin*m 179 arr = round(m*temporary(arr)+p) 180 endif 181 ; set c_nan for NaN values 177 arr = round(m*temporary(arr)+p) 178 endif 179 ; set c_nan for NaN values 182 180 if keyword_set(nan) then begin 183 181 if n_elements(c_nan) NE 0 THEN arr[nanindex] = c_nan < (ncolmax -1) $ … … 190 188 arr = byte(temporary(arr)) 191 189 ; increase the size of the array in order to be displayed 192 ; with the suitable size 190 ; with the suitable size 193 191 szarr = size(arr, /dimensions) 194 192 arr = congrid(temporary(arr), szarr[0]*cellsize, szarr[1]*cellsize) … … 205 203 if NOT keyword_set(window) then window = 0 206 204 window, window, xsize = nx+marginpix[0]+marginpix[1] $ 207 , ysize = ny+marginpix[2]+marginpix[3] 205 , ysize = ny+marginpix[2]+marginpix[3] 208 206 ; for 24 bits colors, make sure thate the background color is the good one... 209 207 if !d.n_colors gt 256 then BEGIN … … 215 213 tv, arr, marginpix[0], marginpix[2], _EXTRA = ex 216 214 ; 217 ; axis and plot frame 215 ; axis and plot frame 218 216 ; 219 217 ; get the normalized position of the tv (we just done above) … … 233 231 xenvsauve = !x & yenvsauve = !y & penvsauve = !p 234 232 ; 235 ; draw the colorbar 233 ; draw the colorbar 236 234 ; 237 235 IF truemin ne truemax THEN BEGIN … … 244 242 ENDIF 245 243 ; !p.position = poscadre 246 ENDIF ELSE BEGIN 244 ENDIF ELSE BEGIN 247 245 ;------------------------------------------------------------ 248 246 ; scrolling bar window case... … … 261 259 , yvisible = round(.7*dimensions[1]) < (size(arr))[2], /register, congrid = 0, show_full = 0 262 260 return 263 ENDELSE 261 ENDELSE 264 262 ;------------------------------------------------------------ 265 263 ; Use the mouse to get nice functionalities -
trunk/SRC/ToBeReviewed/PLOTS/DIVERS/barrecouleur.pro
r163 r226 5 5 ; 6 6 ; @file_comments 7 ; Overlaye ur of colorbar7 ; Overlayer of colorbar 8 8 ; 9 9 ; @categories … … 23 23 ; 24 24 ; @keyword NOCOLORBAR 25 ; 25 ; 26 26 ; 27 27 ; @keyword CB_TITLE 28 ; 28 ; 29 29 ; 30 30 ; @keyword NOFILL 31 ; 31 ; 32 32 ; 33 33 ; @keyword COLOR_c 34 ; 34 ; 35 35 ; 36 36 ; @keyword MIN … … 41 41 ; 42 42 ; @keyword DIVISIONS 43 ; 43 ; 44 44 ; 45 45 ; @keyword CB_SUBTITLE 46 ; 46 ; 47 47 ; 48 48 ; @keyword POST 49 ; 49 ; 50 50 ; 51 51 ; @keyword _EXTRA … … 84 84 if keyword_set(divisions) THEN clbdiv = divisions 85 85 nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) $ 86 + keyword_set(color_c) 86 + keyword_set(color_c) 87 87 ;------------------------------------------------------------ 88 88 def_myuniquetmpdir … … 99 99 ENDELSE 100 100 ;------------------------------------------------------------ 101 if keyword_set(nocolorbar) then return 101 if keyword_set(nocolorbar) then return 102 102 ;------------------------------------------------------------ 103 103 ancienx = !x -
trunk/SRC/ToBeReviewed/PLOTS/DIVERS/determineminmax.pro
r163 r226 7 7 ; Determine the min and the max of a mask array 8 8 ; 9 ; @categories 9 ; @categories 10 10 ; Plotting 11 11 ; … … 14 14 ; 15 15 ; @param MASK {in}{required} 16 ; The mask array 16 ; The mask array 17 17 ; 18 18 ; @keyword MININ {type=scalar} … … 22 22 ; If it is not defined, it takes the value of VRAIMAX 23 23 ; 24 ; @keyword ZEROMIDDLE 24 ; @keyword ZEROMIDDLE 25 25 ; Force the middle of the colorbar to be equal 26 26 ; to 0 (force max=max(abs([min,max])) and min=-max) 27 ; 27 ; 28 28 ; @keyword _EXTRA 29 29 ; used to pass your keywords … … 31 31 ; @keyword USETRI 32 32 ; To force using triangulation. 33 ; 33 ; 34 34 ; @param VRAIMIN {out} 35 35 ; The min of the array … … 64 64 ;----------------------------------------------------------------------------- 65 65 ;----------------------------------------------------------------------------- 66 ; Type o fthe vertical grid:66 ; Type of the vertical grid: 67 67 if vargrid EQ 'W' then nz = nzw ELSE nz = nzt 68 68 ; liste des points mer 69 69 if (size(mask))[0] EQ 3 then mer = mask[*, *, 0] $ 70 70 ELSE mer = mask 71 ; If key_irregular eq 1, we mask also points which are not in the geographic 71 ; If key_irregular eq 1, we mask also points which are not in the geographic 72 72 ; domain defined by lon1,lon2,lat1,lat2 73 73 if keyword_set(key_irregular) AND n_elements(glam) NE 0 AND n_elements(gphi) NE 0 then begin … … 89 89 ; ma and mi : max and min on ocean points 90 90 vraimax = max(tab[mer], min = vraimin, _extra = ex) 91 sameminmax = testvar(var = minin) EQ testvar(var = maxin) 91 sameminmax = testvar(var = minin) EQ testvar(var = maxin) 92 92 if n_elements(maxin) EQ 0 OR sameminmax then maxin = vraimax 93 if n_elements(minin) EQ 0 OR sameminmax then BEGIN 93 if n_elements(minin) EQ 0 OR sameminmax then BEGIN 94 94 if keyword_set(intervalle) then minin = floor(vraimin/intervalle)*intervalle $ 95 95 ELSE minin = vraimin -
trunk/SRC/ToBeReviewed/PLOTS/DIVERS/placedessin.pro
r163 r226 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; Putting into place of the drawing/ opening of the window or of the PS 8 8 ; 9 ; @categories 9 ; @categories 10 10 ; Utilities 11 11 ; … … 13 13 ; It specify what procedure is called by PLACEDESSIN: 'plt', 'pltz' or 'pltt' 14 14 ; 15 ; @keyword LANDSCAPE 15 ; @keyword LANDSCAPE 16 16 ; Force the page or the window on the screen to be in lengthened position. 17 17 ; 18 18 ; @keyword LCT {type=integer} 19 ; It designate the number of the palette of color we want to use for the plot. 19 ; It designate the number of the palette of color we want to use for the plot. 20 20 ; 21 ; @keyword MAP 21 ; @keyword MAP 22 22 ; We use it when we want to do a projection. 23 23 ; This keyword can be of two types: 24 24 ; MAP=[P0lat,P0lon,Rot]. For the description of these 3 values (see the online help of MAP_SET). 25 ; /MAP: In this case, map is automatically calculated have the value: 25 ; /MAP: In this case, map is automatically calculated have the value: 26 26 ; map = [0, (lon1+lon2)/2., 0] 27 27 ; Comment: A good way to choose the type of the projection we want to do is to have a look at IDL demo: 28 28 ; IDL> demo 29 29 ; Then choose earth sciences and mapping. 30 ; Comment2: By default it is a cylindrical projection which is effectuated (with or without the keyword map). 30 ; Comment2: By default it is a cylindrical projection which is effectuated (with or without the keyword map). 31 31 ; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection. 32 32 ; For example, for a polar projection centered on the south pole: … … 34 34 ; IDL> plt, tab, /stereo,map=[-90,0,0] 35 35 ; 36 ; @keyword NOCOLORBAR 36 ; @keyword NOCOLORBAR 37 37 ; We active it if we do not want the colorbar. 38 38 39 ;; @keyword NOFILL 39 ;; @keyword NOFILL 40 40 ; We active it if we only want contours in black and white with a white background. 41 41 ; 42 ; @keyword NOERASE 42 ; @keyword NOERASE 43 43 ; We active it to make a drawing without creating a new frame. 44 44 ; 45 ; @keyword SMALL 46 ; Vector composed of 3 or 4 elements, applied to make a drawing on a 45 ; @keyword SMALL 46 ; Vector composed of 3 or 4 elements, applied to make a drawing on a 47 47 ; small portion of a page or screen. It delimit the zone where the drawing will be done. 48 48 ; If there is 4 elements: 49 ; then is constituted of coordinates (expressed in cm located from the up and 50 ; left corner of the page or the window (in portrait like in landscape)) of the bottom 49 ; then is constituted of coordinates (expressed in cm located from the up and 50 ; left corner of the page or the window (in portrait like in landscape)) of the bottom 51 51 ; and left corner and of the up and right corner of the drawing zone. 52 52 ; If there is 3 elements: 53 ; in this case, we divide the page or the screen in small[0] columns and in small[1] lines 54 ; the drawing made in the box numbered small[2]. The numerotation starting up and left by 53 ; in this case, we divide the page or the screen in small[0] columns and in small[1] lines 54 ; the drawing made in the box numbered small[2]. The numerotation starting up and left by 55 55 ; the number 1 and then, following the writing direction. 56 ; By default, we make the largest drawing we can do, conserving the aspect rapport 56 ; By default, we make the largest drawing we can do, conserving the aspect rapport 57 57 ; (except when REMPLI is activated). 58 ; 59 ; @keyword PORTRAIT 58 ; 59 ; @keyword PORTRAIT 60 60 ; Force the page or the window to be in standing position. 61 61 ; 62 ; @keyword POST 62 ; @keyword POST 63 63 ; Make a postscript. Only works if we made one drawing on the page. 64 64 ; If we make several drawing, use \@ps. 65 65 ; 66 ; @keyword REMPLI 66 ; @keyword REMPLI 67 67 ; Force the drawing to occupy the whole space defined by small. 68 68 ; 69 ; @keyword WINDOW 70 ; Number of the window on which we want to do the graph (Allow to open several windows). 69 ; @keyword WINDOW 70 ; Number of the window on which we want to do the graph (Allow to open several windows). 71 71 ; By default, we open 'IDL0' 72 72 ; 73 ; @keyword CB_TITLE 73 ; @keyword CB_TITLE 74 74 ; The colorbar's title 75 75 ; 76 ; @keyword CONTOUR 77 ; If we want to trace contours of a different field than the one 78 ; whose we have the colored drawing (by example E-P in color and QSR in contours). 76 ; @keyword CONTOUR 77 ; If we want to trace contours of a different field than the one 78 ; whose we have the colored drawing (by example E-P in color and QSR in contours). 79 79 ; It must be a field respecting same characteristics than the argument number one of plt. 80 80 ; 81 ; @keyword ENDPOINTS 82 ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities 83 ; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are 84 ; coordinates. 81 ; @keyword ENDPOINTS 82 ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities 83 ; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are 84 ; coordinates. 85 85 ; 86 86 ; @keyword VECTEUR {type=vector} … … 94 94 ; @keyword DIREC 95 95 ; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt' 96 ; 'xzt' 'yzt' 'xyzt' Direction on which do averages 96 ; 'xzt' 'yzt' 'xyzt' Direction on which do averages 97 97 ; 98 98 ; @keyword _EXTRA 99 99 ; Used to pass your keywords. 100 100 ; 101 ; @keyword COLOR_C 101 ; @keyword COLOR_C 102 102 ; To draw the contour in color instead of in black 103 ; with filling in color 103 ; with filling in color 104 104 ; 105 105 ; @param POSFENETRE {out}{type=vector} 106 ; It is a vector composed by 4 elements containing the position of the frame 107 ; containing captions and the graph in normalized coordinates. 108 ; Comment: To position the drawing; we have to do !p.position=posfenetre 106 ; It is a vector composed by 4 elements containing the position of the frame 107 ; containing captions and the graph in normalized coordinates. 108 ; Comment: To position the drawing; we have to do !p.position=posfenetre 109 109 ; after the call of the caliber 110 110 ; 111 111 ; @param POSBAR {out}{type=vector} 112 ; Like POSFENETRE but for the color bar. 112 ; Like POSFENETRE but for the color bar. 113 113 ; Same comment to position the color bar, !p.position=posbar 114 114 ; … … 148 148 ; 1) Determination of the size of margins (unity=number of lines or columns) 149 149 ; to the left, to the right, up and down. 150 ; BEWARE in margebar, the last element is the right up corner 150 ; BEWARE in margebar, the last element is the right up corner 151 151 ; instead of the up margin 152 152 ;------------------------------------------------------------- … … 157 157 margebar = 1.*[marge[0]+1, marge[1]+1, marge[2]-8, marge[2]-6] 158 158 if keyword_set(barmarges) then margebar = margebar+barmarges 159 ENDIF ELSE BEGIN 160 nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c) 159 ENDIF ELSE BEGIN 160 nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c) 161 161 case typedessin of 162 162 'plt':marge = 1.*[6, 2, 4, 3] … … 186 186 ; Portrait or landscape 187 187 ;-------------------------------------------------------------- 188 IF NOT keyword_set(noerase) THEN BEGIN 188 IF NOT keyword_set(noerase) THEN BEGIN 189 189 CASE 1 OF 190 190 n_elements(portrait) NE 0:key_portrait = portrait … … 192 192 ELSE: 193 193 ENDCASE 194 ENDIF 194 ENDIF 195 195 ;-------------------------------------------------------------- 196 196 ; What type of aspect rapport (it will be crushed if YXASPECT exist) … … 218 218 ;------------------------------------------------------------ 219 219 case 1 of 220 ; case of the first drawing on a post cript220 ; case of the first drawing on a postscript 221 221 keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex 222 222 ; case of the first drawing on a screen … … 236 236 windsize = givewindowsize() 237 237 window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex 238 ; When we used colors which are coded on 24bit, we can not stipulate the background color 238 ; When we used colors which are coded on 24bit, we can not stipulate the background color 239 239 ; of a window thanks to !p.background, so we have to to this: 240 240 ; if !d.n_colors gt 256 then begin -
trunk/SRC/ToBeReviewed/PLOTS/DIVERS/restoreatt.pro
r163 r226 5 5 ; 6 6 ; @file_comments 7 ; Allows to reattribu ate global variables associated with a field7 ; Allows to reattribute global variables associated with a field 8 8 ; when we give a structure created by saveatt.pro by example. 9 9 ; 10 ; @categories 10 ; @categories 11 11 ; Utilities 12 12 ; 13 13 ; @param STRUCT {in}{required} 14 ; a structure like the one who read litchamp. 14 ; a structure like the one who read litchamp. 15 15 ; See IDL> xhelp,'litchamp' 16 16 ; … … 19 19 ; 20 20 ; @restrictions 21 ; Change the value if global variables attribute of a field: vargrid, 21 ; Change the value if global variables attribute of a field: vargrid, 22 22 ; varname, varunit, vardate, varexp , valmask and time. 23 23 ; … … 47 47 'e':varexp = struct.(i) 48 48 'm':valmask = struct.(i) 49 'd':BEGIN 50 if size(struct.(i),/type) EQ 7 THEN BEGIN 49 'd':BEGIN 50 if size(struct.(i),/type) EQ 7 THEN BEGIN 51 51 vardate = struct.(i) 52 52 ENDIF ELSE BEGIN … … 55 55 ENDELSE 56 56 end 57 ELSE:BEGIN 57 ELSE:BEGIN 58 58 ras = report('Le nom '+nomelements[i]+' ne correspont a aucun element reconnu de la structure. !C cf. IDL> xhelp, ''litchamp''') 59 59 end -
trunk/SRC/ToBeReviewed/PLOTS/LABEL/label.pro
r163 r226 13 13 ; Number of the type of the label we want to trace 14 14 ; 15 ; @param MIN {in}{required} 15 ; @param MIN {in}{required} 16 16 ; Smallest value for the drawing of the contour. 17 17 ; … … 20 20 ; 21 21 ; @keyword INTERVALLE {default=20} 22 ; Value of an interval between two isolines. By default, it is calculated to 22 ; Value of an interval between two isolines. By default, it is calculated to 23 23 ; draw 20 isolines. In all cases, this keyword must be returned have a nice 24 24 ; caption. If levels do not contain regular intervals, put it at -1. … … 29 29 ; @param NCONTOUR {out} 30 30 ; Number of contour to be drawn. 31 ; 31 ; 32 32 ; @param LEVEL_Z2D {out} 33 33 ; Vector containing values of contours we draw. … … 39 39 ; common.pro 40 40 ; 41 ; @history 41 ; @history 42 42 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 43 43 ; 7/5/98 44 44 ; 45 ; @version 45 ; @version 46 46 ; $Id$ 47 47 ; … … 86 86 ncontour = fix((max-min)/intervalle) 87 87 ncontour = 1 > ncontour 88 level_z2d = min + intervalle*findgen(Ncontour) 88 level_z2d = min + intervalle*findgen(Ncontour) 89 89 colnumb = ncoul*(findgen(Ncontour))/Ncontour+ncoul/(2*ncontour) 90 90 max=level_z2d[Ncontour-1]+intervalle -
trunk/SRC/ToBeReviewed/PLOTS/VECTEUR/vecteur.pro
r163 r226 1 1 ;+ 2 ; @file_comments 3 ; 4 ; 2 ; @file_comments 3 ; 4 ; 5 5 ; @categories 6 ; 7 ; 8 ; @param ANGLE 9 ; 6 ; 7 ; 8 ; @param ANGLE 10 9 ; 11 10 ; @returns 12 ; 13 ; 11 ; 14 12 ; @restrictions 15 ; 16 ; 13 ; 17 14 ; @examples 18 15 ; 19 ;20 16 ; @history 21 ;22 17 ; 23 18 ; @version … … 29 24 ; by rapport at the x axis and which must do 1 cm on the drawing. 30 25 ; Angle can be an array. 31 ; 26 ; 32 27 ; 33 28 ; … … 53 48 ; 54 49 ;+ 55 ; @file_comments 56 ; 57 ; 50 ; @file_comments 51 ; 52 ; 58 53 ; @categories 59 ; 60 ; 54 ; 55 ; 61 56 ; @param U 62 57 ; … … 64 59 ; @param V 65 60 ; 66 ; 67 ; @param W 68 ; 61 ; @param W 69 62 ; 70 63 ; @restrictions 71 ; 72 ; 64 ; 73 65 ; @examples 74 66 ; 75 ;76 67 ; @history 77 ;78 68 ; 79 69 ; @version … … 87 77 compile_opt idl2, strictarrsubs 88 78 ; 89 IF n_elements(w) NE 0 THEN BEGIN 79 IF n_elements(w) NE 0 THEN BEGIN 90 80 norme = sqrt(u^2.+v^2.+w^2.) 91 81 ind = where(norme NE 0) … … 98 88 u[ind] = u[ind]/norme[ind] 99 89 v[ind] = v[ind]/norme[ind] 100 ENDELSE 90 ENDELSE 101 91 END 102 92 ;------------------------------------------------------------ … … 111 101 ; and is position on the sphere). 112 102 ; 113 ; @categories 103 ; @categories 114 104 ; Graphics 115 ; 105 ; 116 106 ; @param COMPOSANTEU {in}{required} 117 ; It is the u component of the vector to be traced. This 2d array has the 107 ; It is the u component of the vector to be traced. This 2d array has the 118 108 ; same dimension that reduitindice2d (see further) 119 ; 109 ; 120 110 ; @param COMPOSANTEV {in}{required} 121 ; It is the v component of the vector to be traced. This 2d array has the 111 ; It is the v component of the vector to be traced. This 2d array has the 122 112 ; same dimension that reduitindice2d (see further) 123 ; 113 ; 124 114 ; @param NORMEVECTEUR 125 115 ; 126 116 ; 127 117 ; @param INDICE2D {in}{required} 128 ; It in an index allowing to to pass from an jpi or jpj array to the zoom 118 ; It in an index allowing to to pass from an jpi or jpj array to the zoom 129 119 ; on which we do the drawing 130 ; 120 ; 131 121 ; @param REDUITINDICE2D {in}{required} 132 ; It is an index allowing to pass from an array defined by indice2d to the 133 ; array for which we really have vectors to be traced (to be clear, it is 122 ; It is an index allowing to pass from an array defined by indice2d to the 123 ; array for which we really have vectors to be traced (to be clear, it is 134 124 ; for example when we trace only one vector on two). 135 125 ; 136 126 ; @keyword CMREF {default=between .5 and 1.5 cm} 137 ; The length in cm that must measure the arrow normed normeref. By default, 127 ; The length in cm that must measure the arrow normed normeref. By default, 138 128 ; it is adjusted to other drawing and included between .5 and 1.5 cm. 139 129 ; 140 130 ; @keyword MISSING 141 ; The value of a missing value. Do not use this keyword. Fixed at 1e5 by 131 ; The value of a missing value. Do not use this keyword. Fixed at 1e5 by 142 132 ; ajoutvect.pro 143 ; 144 ; @keyword NORMEREF 133 ; 134 ; @keyword NORMEREF 145 135 ; The norme of the reference arrow. 146 136 ; 147 137 ; @keyword VECTCOLOR {default=0} 148 138 ; The color of the arrow. Black by default (color 0) 149 ; 139 ; 150 140 ; @keyword VECTTHICK {default=1} 151 ; The thick of the arrow. 141 ; The thick of the arrow. 152 142 ; 153 143 ; @keyword VECTREFPOS 154 ; Vector composed of 2 elements specifying the position on DATA coordinates 155 ; from the beginning of the reference vector. By default at the right bottom 144 ; Vector composed of 2 elements specifying the position on DATA coordinates 145 ; from the beginning of the reference vector. By default at the right bottom 156 146 ; of the drawing. 157 147 ; … … 161 151 ; @keyword NOVECTREF 162 152 ; To delete the display of the reference vector. 163 ; 153 ; 164 154 ; @keyword _EXTRA 165 ; Used to pass your keywords 166 ; 167 ; @uses 155 ; Used to pass your keywords 156 ; 157 ; @uses 168 158 ; common.pro 169 159 ; … … 179 169 ; 180 170 ; @version 181 ; $Id$ 171 ; $Id$ 182 172 ; 183 173 ;- … … 209 199 msk = replicate(1, nx, ny) 210 200 if keyword_set(missing) then terre = where(abs(zu) GE missing/10) ELSE terre = -1 211 if terre[0] NE -1 then BEGIN 201 if terre[0] NE -1 then BEGIN 212 202 msk[terre] = 0 213 203 zu[terre] = 0 … … 216 206 ENDIF 217 207 ; 218 ; Stage 1: 219 ; 220 ; Given that the directions and the sense that the vector has on the sphere, 221 ; we have to try to determinate this direction and the sense that the vector 208 ; Stage 1: 209 ; 210 ; Given that the directions and the sense that the vector has on the sphere, 211 ; we have to try to determinate this direction and the sense that the vector 222 212 ; will have on the screen once it will have been projected. 223 213 ; 224 ; In theory: on the sphere, a vector in a given point has for direction the 225 ; tangent at the circle passing by the center of the Earth and by the vector. 214 ; In theory: on the sphere, a vector in a given point has for direction the 215 ; tangent at the circle passing by the center of the Earth and by the vector. 226 216 ; So, find the direction once the projection is done, it is find the tangent 227 ; to the curve representing the projection of the circle on the 2d plan at the 228 ; point representing the projection of the starting point of the s here on the217 ; to the curve representing the projection of the circle on the 2d plan at the 218 ; point representing the projection of the starting point of the sphere on the 229 219 ; 2d plan. 230 ; 231 ; In practice we do no know the definition of the curve given by the projection 220 ; 221 ; In practice we do no know the definition of the curve given by the projection 232 222 ; of a circle so find its tangente in a point... 233 223 ; 234 224 ; What we do: 235 225 ; In a 3d cartesian reference, 236 ; a) We find coor inates of the point T (starting of the arrow) situed226 ; a) We find coordinates of the point T (starting of the arrow) situed 237 227 ; on the sphere. 238 228 ; b) To each point T, we determine local directions defined by the grid 239 229 ; on this point and on which coordinates (u,v) of the vector refer to. 240 230 ; These local directions are defined by gradients of glam and gphi. Once 241 ; we have obtain these directions, we consid arethem like orthogonal and231 ; we have obtain these directions, we consider them like orthogonal and 242 232 ; by norming them, we build an orthonormal reference (nu,nv) on which 243 233 ; coordinates (u,v) of the vector refer to. In the starting 3d cartesian … … 254 244 ; e) We pass coordinates of these points in normalized coordinates, then 255 245 ; in polar coordinates in order to find the angle and the direction they 256 ; de rtermine on the drawing.246 ; determine on the drawing. 257 247 ; 258 248 ; … … 280 270 ; points u[i,j] and u[i-1,j] (resp v[i,j] and v[i,j-1]) which define, for each 281 271 ; point on the sphere, local directions associated with u and v. These vectors 282 ; define a local orthonormal reference. 283 ; These vectors are built in a cartesian reference (cv_coord). We have choose a 272 ; define a local orthonormal reference. 273 ; These vectors are built in a cartesian reference (cv_coord). We have choose a 284 274 ; unity radius of the Earth (unit). 285 275 ; … … 294 284 uy = reform(r[1, *], nxgd, nygd) 295 285 uz = reform(r[2, *], nxgd, nygd) 296 ; calculation of nu 286 ; calculation of nu 297 287 nux = ux-shift(ux, 1, 0) 298 288 nuy = uy-shift(uy, 1, 0) … … 311 301 IF finite(glamv[0]*gphiv[0]) NE 0 THEN $ 312 302 coord_sphe = transpose([ [(glamv[indice2d])[*]], [(gphiv[indice2d])[*]], [radius[*]] ]) $ 313 ELSE coord_sphe = transpose([ [(glamt[indice2d])[*]], [(gphif[indice2d])[*]], [radius[*]] ]) 303 ELSE coord_sphe = transpose([ [(glamt[indice2d])[*]], [(gphif[indice2d])[*]], [radius[*]] ]) 314 304 r = cv_coord(from_sphere=coord_sphe,/to_rect,/degrees) 315 305 ; coordinates of points of the grid in cartesian. … … 317 307 vy = reform(r[1, *], nxgd, nygd) 318 308 vz = reform(r[2, *], nxgd, nygd) 319 ; calcul of nv 309 ; calcul of nv 320 310 nvx = vx-shift(vx, 0, 1) 321 311 nvy = vy-shift(vy, 0, 1) … … 383 373 ; Stage 1, e) 384 374 ; 385 r = convert_coord(glam,gphi,/data,/to_normal) 375 r = convert_coord(glam,gphi,/data,/to_normal) 386 376 x0 = r[0, *] ; normal coordinates of the beginning of the array. 387 y0 = r[1, *] ; 388 389 r = convert_coord(glam1,gphi1,/data,/to_normal) 377 y0 = r[1, *] ; 378 379 r = convert_coord(glam1,gphi1,/data,/to_normal) 390 380 x1 = r[0, *] ; normal coordinates of the ending of the array (Before scaling). 391 y1 = r[1, *] ; 381 y1 = r[1, *] ; 392 382 ; 393 383 ; tests to avoid that arrows be drawing out of the domain. … … 397 387 if out[0] NE -1 THEN x0[out] = !values.f_nan 398 388 ; 399 ; Following projections, there may are points at NaN when we pass in normal coordinates. 389 ; Following projections, there may are points at NaN when we pass in normal coordinates. 400 390 ; We delete these points. 401 391 ; … … 422 412 ; Now we take care of the norme... 423 413 ; 424 ; Automatic putting at the scale 425 ; 426 if NOT keyword_set(cmref) then BEGIN 414 ; Automatic putting at the scale 415 ; 416 if NOT keyword_set(cmref) then BEGIN 427 417 mipgsz = min(page_size, max = mapgsz) 428 418 sizexfeuille = mipgsz*key_portrait+mapgsz*(1-key_portrait) … … 438 428 cm = 1.*normeref/cmref 439 429 ; 440 ; We modify the array norme to an element having the value cm be represented 441 ; by a trait of lenght 1 cm on the paper. Norme contain the norme of vectors 430 ; We modify the array norme to an element having the value cm be represented 431 ; by a trait of lenght 1 cm on the paper. Norme contain the norme of vectors 442 432 ; we want to draw. 443 433 ; … … 446 436 ; 447 437 ; Stage 3 448 ; Now that we have the angle and the norme, we recuperate coordinates in 438 ; Now that we have the angle and the norme, we recuperate coordinates in 449 439 ; rectangular and we draw arrows. 450 440 ; … … 467 457 ; 468 458 if NOT keyword_set(novectref) then BEGIN 469 dx = cmref*cv_cm2normal(0) ; Leng htof the vector of reference in normalzed coordinates.459 dx = cmref*cv_cm2normal(0) ; Length of the vector of reference in normalzed coordinates. 470 460 if keyword_set(vectrefformat) then $ 471 461 normelegende = strtrim(string(normeref, format = vectrefformat), 1)+' ' $ … … 490 480 ; 491 481 492 if keyword_set(key_performance) NE 0 THEN print, 'temps vecteur', systime(1)-tempsun 482 if keyword_set(key_performance) NE 0 THEN print, 'temps vecteur', systime(1)-tempsun 493 483 ;------------------------------------------------------------ 494 484 ;------------------------------------------------------------ 495 485 return 496 END 497 498 499 500 486 END 487 488 489 490 -
trunk/SRC/ToBeReviewed/PLOTS/axe.pro
r209 r226 8 8 ; pltz and pltt 9 9 ; 10 ; @categories 10 ; @categories 11 11 ; Graphics 12 12 ; 13 13 ; @param COUPE {type=string} 14 ; It designate the type of cut to which the axes we create 14 ; It designate the type of cut to which the axes we create 15 15 ; must report. For example: 'xy','xt'... 16 16 ; 17 17 ; @param TEMPSMIN {in}{required} 18 ; In the case where we do cut containing the time dimension, we have 18 ; In the case where we do cut containing the time dimension, we have 19 19 ; to specify the beginning of the time's axis in julian days. 20 20 ; 21 21 ; @param TEMPSMAX {in}{required} 22 ; In the case where we do cut containing the time dimension, we have 22 ; In the case where we do cut containing the time dimension, we have 23 23 ; to specify the end of the time's axis in julian days. 24 24 ; 25 ; @keyword SIN 25 ; @keyword SIN 26 26 ; activated when we trace in sinus of the latitude 27 27 ; 28 28 ; @keyword SEPDATE {type=string} 29 ; It separate the different constituents of the date. By default, 30 ; it is a return to the line when we do a 'yt', 'zt' or a 't'. 31 ; In the other cases, it is a blank. 29 ; It separate the different constituents of the date. By default, 30 ; it is a return to the line when we do a 'yt', 'zt' or a 't'. 31 ; In the other cases, it is a blank. 32 32 ; 33 33 ; @keyword DIGITSYEAR … … 36 36 ; information on %Z and %Y. 37 37 ; 38 ; @keyword _EXTRA 38 ; @keyword _EXTRA 39 39 ; used to pass your keywords 40 ; 40 ; 41 41 ; @uses 42 42 ; common.pro … … 65 65 tempsun = systime(1) ; pour key_performance 66 66 ;-------------------------------------------------------------- 67 ; Management of ticks of the time axis in the case of TEMPSMIN 68 ; and TEMPSMAX are defin ied67 ; Management of ticks of the time axis in the case of TEMPSMIN 68 ; and TEMPSMAX are defined 69 69 ;-------------------------------------------------------------- 70 70 divday = 0 … … 94 94 ymax-ymin+1 GT 10: BEGIN & freq = 2. & tminor = 4 & datfmt = '%M'+sep+fmtyr & end 95 95 ELSE: BEGIN & freq = 1. & tminor = 4 & datfmt = '%M'+sep+fmtyr & end 96 ENDCASE 96 ENDCASE 97 97 nticks = ceil((ymax-ymin)/freq) + 2 98 98 yminf = (floor(ymin/freq))*freq … … 174 174 for mn = 0, nticks-1 do ticknom[mn] = julday(mmin, dmin, ymin, hmin, mnminf + freq*mn, 0, _EXTRA = ex) 175 175 ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)] 176 datfmt = '%H:%I' 176 datfmt = '%H:%I' 177 177 END 178 178 ; second base … … 201 201 dummy = label_date(0, 0, 0, DATE_FORMAT = datfmt, _EXTRA = ex) 202 202 if chkstru(ex, 'DATE_FORMAT') then ex.DATE_FORMAT = '' 203 ENDIF 203 ENDIF 204 204 ;-------------------------------------------------------------- 205 205 ; Definition of axes parameters case by case 206 206 ;-------------------------------------------------------------- 207 207 case coupe of 208 'pltv':BEGIN 208 'pltv':BEGIN 209 209 dtasize = tempsmin 210 210 !x.range = [-0.5, dtasize[0] - 0.5] 211 !y.range = [-0.5, dtasize[1] - 0.5] 211 !y.range = [-0.5, dtasize[1] - 0.5] 212 212 if keyword_set(reverse_x) then !x.range=reverse(!x.range) 213 213 if keyword_set(reverse_y) then !y.range=reverse(!y.range) … … 215 215 !y.title = 'ny' 216 216 END 217 'xy':BEGIN 217 'xy':BEGIN 218 218 if keyword_set(reverse_x) then !x.range=[lon2,lon1] ELSE !x.range=[lon1,lon2] 219 219 if keyword_set(reverse_y) then !y.range=[lat2,lat1] ELSE !y.range=[lat1,lat2] … … 221 221 IF key_onearth THEN !y.tickformat='lataxe' 222 222 END 223 'yz':BEGIN 223 'yz':BEGIN 224 224 if keyword_set(reverse_x) then !x.range=[lat2,lat1] ELSE !x.range=[lat1,lat2] 225 225 if keyword_set(reverse_y) then !y.range=[0, -1] ELSE !y.range = [-1, 0] … … 227 227 ; number of ticks by default 228 228 plot, [0], [0], /noerase, /nodata, xtick_get = xaxe 229 ; We increase this number to it be around 10 229 ; We increase this number to it be around 10 230 230 ticks = n_elements(xaxe)-1 231 231 ticks = ticks*[1, 2, 4, 8] … … 241 241 endif 242 242 end 243 'xz':BEGIN 243 'xz':BEGIN 244 244 if keyword_set(reverse_x) then !x.range=[lon2,lon1] ELSE !x.range=[lon1,lon2] 245 245 if keyword_set(reverse_y) then !y.range=[0, -1] ELSE !y.range = [-1, 0] … … 252 252 ; result = LABEL_DATE(DATE_FORMAT = '%M'+sep+fmtyr) 253 253 ; !y.tickformat='LABEL_DATE' 254 !y.tickname = LABEL_DATE(1, 0,ticknom,_EXTRA = ex) 254 !y.tickname = LABEL_DATE(1, 0,ticknom,_EXTRA = ex) 255 255 !y.ticklen=1. 256 256 !y.gridstyle=2 … … 266 266 if keyword_set(reverse_y) then !y.range=[lat2, lat1] ELSE !y.range=[lat1,lat2] 267 267 IF key_onearth THEN !y.tickformat='lataxe' 268 !x.tickname = LABEL_DATE(0, 0,ticknom,_EXTRA = ex) 268 !x.tickname = LABEL_DATE(0, 0,ticknom,_EXTRA = ex) 269 269 !x.ticklen=1. 270 270 !x.gridstyle=2 … … 278 278 if keyword_set(reverse_x) then !x.range = [tempsmax,tempsmin]-tempsmin $ 279 279 ELSE !x.range=[tempsmin,tempsmax]-tempsmin 280 if vargrid EQ 'W' then gdep=gdepw[0:nzw-1] ELSE gdep=gdept[0:nzt-1] 281 !x.tickname = LABEL_DATE(0, 0,ticknom,_EXTRA = ex) 280 if vargrid EQ 'W' then gdep=gdepw[0:nzw-1] ELSE gdep=gdept[0:nzt-1] 281 !x.tickname = LABEL_DATE(0, 0,ticknom,_EXTRA = ex) 282 282 !x.ticklen=1. 283 283 !x.gridstyle=2 … … 291 291 if keyword_set(reverse_x) then !x.range = [tempsmax,tempsmin]-tempsmin $ 292 292 ELSE !x.range=[tempsmin,tempsmax]-tempsmin 293 !x.tickname = LABEL_DATE(0, 0,ticknom,_EXTRA = ex) 293 !x.tickname = LABEL_DATE(0, 0,ticknom,_EXTRA = ex) 294 294 !x.ticklen=1. 295 295 !x.gridstyle=2 … … 308 308 ; Number of ticks by default 309 309 plot, [0], [0], /nodata, /noerase, xstyle = 5, ystyle = 5, xtick_get = xaxe 310 ; We increase this number to it be around 10 310 ; We increase this number to it be around 10 311 311 ticks = n_elements(xaxe)-1 312 312 ticks = ticks*[1, 2, 4, 8] … … 324 324 END 325 325 'z' : begin 326 ; if vargrid EQ 'W' then gdep=gdepw[0:nzw-1] ELSE gdep=gdept[0:nzt-1] 326 ; if vargrid EQ 'W' then gdep=gdepw[0:nzw-1] ELSE gdep=gdept[0:nzt-1] 327 327 ; if keyword_set(reverse_y) then !y.range=[gdep[0], gdep[n_elements(gdep)-1]] $ 328 328 ; ELSE !y.range=[gdep[n_elements(gdep)-1], gdep[0]] 329 END 329 END 330 330 endcase 331 if keyword_set(key_performance) THEN print, 'temps axe', systime(1)-tempsun 331 if keyword_set(key_performance) THEN print, 'temps axe', systime(1)-tempsun 332 332 return 333 333 end -
trunk/SRC/ToBeReviewed/POSTSCRIPT/calibre.pro
r222 r226 4 4 ;+ 5 5 ; @file_comments 6 ; From a rapport of aspect and values (in line of character) of different margins, 7 ; it calculate POSFENETRE and POSBAR which serve to place the drawing and the color 8 ; bar thanks to !p.position on a leaf or a screen output whose the window has the same 6 ; From a rapport of aspect and values (in line of character) of different margins, 7 ; it calculate POSFENETRE and POSBAR which serve to place the drawing and the color 8 ; bar thanks to !p.position on a leaf or a screen output whose the window has the same 9 9 ; proportion. 10 10 ; 11 ; @categories 11 ; @categories 12 12 ; Graphics 13 13 ; 14 ;15 14 ; @param RAPPORTYX {in}{required} 16 ; Scale rapport between the length of the y axis and the x one. For example, 15 ; Scale rapport between the length of the y axis and the x one. For example, 17 16 ; for an xy map: RAPPORTYX=(lat2-lat1)/(lon2-lon1) 18 17 ; 19 18 ; @param MARGE {in}{required}{type=vector} 20 ; Vector made of 4 elements containing the size of the left, right, up and 19 ; Vector made of 4 elements containing the size of the left, right, up and 21 20 ; bottom margin having to surround the graph. All is measured in lines of characters. 22 21 ; 23 22 ; @param MARGEBAR {in}{required}{type=vector} 24 ; Vector made of 4 elements containing the size of the left, right and bottom 25 ; margin and -BEWARE- the last element is this time the position of the right up 23 ; Vector made of 4 elements containing the size of the left, right and bottom 24 ; margin and -BEWARE- the last element is this time the position of the right up 26 25 ; corner, having to surround the color bar. All is measured in lines of characters. 27 26 ; 28 27 ; @param SMALLDRAW {in}{required}{type=vector} 29 28 ; 2 possibilities: 30 ; It is vector made of 4 elements giving (in portrait or landscape) the position 31 ; of the frame in which the drawing must go in. This position is given by coordinates 32 ; of the 2 corners of the frame: in the left bottom and the right up. It is always 33 ; (for a postscript or a screen output) express in cm, the origin being the 29 ; It is vector made of 4 elements giving (in portrait or landscape) the position 30 ; of the frame in which the drawing must go in. This position is given by coordinates 31 ; of the 2 corners of the frame: in the left bottom and the right up. It is always 32 ; (for a postscript or a screen output) express in cm, the origin being the 34 33 ; left bottom corner. 35 ; It is a vector made of 3 elements giving the number of column to be done in the 36 ; drawing, the number of line and the number of the case the number have to occupy 37 ; (see matlab). For example, to do 6 drawing in 3 columns and 2 lines and occupy 34 ; It is a vector made of 3 elements giving the number of column to be done in the 35 ; drawing, the number of line and the number of the case the number have to occupy 36 ; (see matlab). For example, to do 6 drawing in 3 columns and 2 lines and occupy 38 37 ; the 4th case, small=[2,3,4] 39 38 ; 40 39 ; @keyword REMPLI 41 ; Force the drawing to occupy the biggest possible place defined by 40 ; Force the drawing to occupy the biggest possible place defined by 42 41 ; SMALLDRAW without respect the rapport y on x. 43 42 ; 44 43 ; @keyword YXASPECT 45 ; Force the rapport y on x to take the value RAPPORTYX*YXASPECT. 44 ; Force the rapport y on x to take the value RAPPORTYX*YXASPECT. 46 45 ; This keyword can be used in 2 cases: 47 ; 1) YXASPECT=1 : force RAPPORTYX to be respected otherwise, Calibre take the 48 ; initiative to change it a little in the case of the aspect rapport of SMALL 49 ; is too different of the one of SMALLDRAW. 50 ; 2) YXASPECT=n : multiply by n the aspect rapport given by default. 46 ; 1) YXASPECT=1 : force RAPPORTYX to be respected otherwise, Calibre take the 47 ; initiative to change it a little in the case of the aspect rapport of SMALL 48 ; is too different of the one of SMALLDRAW. 49 ; 2) YXASPECT=n : multiply by n the aspect rapport given by default. 51 50 ; For example in plt, RAPPORTYX is calculated to the reference be orthonormal, 52 51 ; to have a reference where the y axis is 2 time bigger than the x one, YXASPECT=2. 53 52 ; 54 ; @keyword PORTRAIT 53 ; @keyword PORTRAIT 55 54 ; Force the page or the window to be in standing position. 56 ; 57 ; @keyword LANDSCAPE 55 ; 56 ; @keyword LANDSCAPE 58 57 ; Force the page or the window on the screen to be in lengthened position. 59 ; 58 ; 60 59 ; @keyword _EXTRA 61 60 ; Used to pass your keywords 62 61 ; 63 62 ; @param POSFENETRE {type=vector} 64 ; It is a vector made of 4 elements containing the position of the frame 65 ; containing captions + the graph in normalized coordinates. 66 ; Comment: to position the drawing, we have to do !p.position=POSFENETRE 63 ; It is a vector made of 4 elements containing the position of the frame 64 ; containing captions + the graph in normalized coordinates. 65 ; Comment: to position the drawing, we have to do !p.position=POSFENETRE 67 66 ; after the call of calibre. 68 67 ; 69 68 ; @param POSBAR {type=vector} 70 ; See POSFENT RE but for the color bar. Same comment to position the color bar, !p.position=POSBAR69 ; See POSFENTERE but for the color bar. Same comment to position the color bar, !p.position=POSBAR 71 70 ; 72 71 ; @uses … … 103 102 if keyword_set(landscape) then key_portrait=0 104 103 if keyword_set(yxaspect) then begin 105 rapportyx=rapportyx*yxaspect 104 rapportyx=rapportyx*yxaspect 106 105 test2=0 107 106 endif else begin … … 109 108 test2=1 110 109 ENDELSE 111 ; 110 ; 112 111 mipgsz = min(page_size, max = mapgsz) 113 112 ;------------------------------------------------------------ … … 133 132 numlig = numero/nbrecol 134 133 numcol = numero-numlig*nbrecol 135 bas = mipgsz*key_portrait+mapgsz*(1-key_portrait) 136 cote = mapgsz*key_portrait+mipgsz*(1-key_portrait) 134 bas = mipgsz*key_portrait+mapgsz*(1-key_portrait) 135 cote = mapgsz*key_portrait+mipgsz*(1-key_portrait) 137 136 poscol = page_margins[0]+findgen(nbrecol+1)*(1.*(bas-(page_margins[0]+page_margins[1]))/nbrecol) 138 137 poslig = cote-page_margins[3]-findgen(nbrelig+1)*(1.*(cote-(page_margins[2]+page_margins[3]))/nbrelig) … … 166 165 else rapportmax=1.*(small-marge[2]-marge[0])/(big-marge[3]-marge[1]) 167 166 ;------------------------------------------------------------ 168 ; If YXASPECT is not specified, we modify the value of RAPPORTYX 167 ; If YXASPECT is not specified, we modify the value of RAPPORTYX 169 168 ; to it match better with the leaf's proportions. 170 169 ;------------------------------------------------------------ … … 189 188 ; in the case where we do a Landscape: 190 189 ;------------------------------------------------------------ 191 if key_portrait eq 0 then begin 190 if key_portrait eq 0 then begin 192 191 if keyword_set(rempli) then begin 193 192 xs=big … … 220 219 ; In the case where we do a portrait: 221 220 ;------------------------------------------------------------ 222 else begin 221 else begin 223 222 if keyword_set(rempli) then begin 224 223 xs=small … … 258 257 ,-margebar[1]/bas,(-ys+margebar[3])/cote ] 259 258 ;------------------------------------------------------------ 260 if keyword_set(key_performance) THEN print, 'temps calibre', systime(1)-tempsun 259 if keyword_set(key_performance) THEN print, 'temps calibre', systime(1)-tempsun 261 260 262 261 IF NOT keyword_set(key_forgetold) THEN BEGIN 263 262 @updateold 264 ENDIF 265 263 ENDIF 264 266 265 return 267 266 end -
trunk/SRC/ToBeReviewed/STATISTICS/c_timecorrelate.pro
r163 r226 1 1 ;+ 2 2 ; @file_comments 3 ; 3 ; 4 4 ; 5 5 ; @categories … … 65 65 ; This function computes the "time cross correlation" Pxy(L) or 66 66 ; the "time cross covariance" between 2 arrays (this is some 67 ; kind of c_correlate but for multidimens tionalsarrays) as a67 ; kind of c_correlate but for multidimensional arrays) as a 68 68 ; function of the lag (L). 69 69 ; … … 85 85 ; 86 86 ; @keyword COVARIANCE 87 ; If set to a non-zero value, the sample cross 87 ; If set to a non-zero value, the sample cross 88 88 ; covariance is computed. 89 89 ; … … 93 93 ; 94 94 ; @examples 95 ; 95 ; 96 96 ; Define two n-element sample populations. 97 97 ; x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57] … … 108 108 ; - 01/03/2000 Sebastien Masson (smasson\@lodyc.jussieu.fr) 109 109 ; Based on the C_CORRELATE procedure of IDL 110 ; - August 2003 Sebastien Masson 110 ; - August 2003 Sebastien Masson 111 111 ; update according to the update made in C_CORRELATE by 112 112 ; W. Biagiotti and available in IDL 5.5 … … 122 122 FUNCTION c_timecorrelate, X, Y, Lag, Covariance = Covariance, Double = Double 123 123 124 ;Compute the sample cross correlation or cross covariance of 124 ;Compute the sample cross correlation or cross covariance of 125 125 ;(Xt, Xt+l) and (Yt, Yt+l) as a function of the lag (l). 126 126 … … 138 138 if nt lt 2 then $ 139 139 MESSAGE, "Time dimension of X and Y arrays must contain 2 or more elements." 140 140 141 141 ;If the DOUBLE keyword is not set then the internal precision and 142 142 ;result are identical to the type of input. … … 168 168 if KEYWORD_SET(Covariance) eq 0 then begin ;Compute Cross Crossation. 169 169 for k = 0, nLag-1 do begin 170 if Lag[k] ge 0 then BEGIN 170 if Lag[k] ge 0 then BEGIN 171 171 case NDim of 172 172 1: Cross[k] = TimeCross_Cov(Xd, Yd, Lag[k], nT, Ndim, Double = Double) 173 173 2: Cross[*, k] = TimeCross_Cov(Xd, Yd, Lag[k], nT, Ndim, Double = Double) 174 174 3: Cross[*, *, k] = TimeCross_Cov(Xd, Yd, Lag[k], nT, Ndim, Double = Double) 175 4: Cross[*, *, *, k] = TimeCross_Cov(Xd, Yd, Lag[k], nT, Ndim, Double = Double) 175 4: Cross[*, *, *, k] = TimeCross_Cov(Xd, Yd, Lag[k], nT, Ndim, Double = Double) 176 176 endcase 177 ENDIF else BEGIN 177 ENDIF else BEGIN 178 178 case NDim of 179 179 1: Cross[k] = TimeCross_Cov(Yd, Xd, ABS(Lag[k]), nT, Ndim, Double = Double) … … 182 182 4: Cross[*, *, *, k] = TimeCross_Cov(Yd, Xd, ABS(Lag[k]), nT, Ndim, Double = Double) 183 183 endcase 184 ENDELSE 184 ENDELSE 185 185 ENDFOR 186 186 div = sqrt(TimeCross_Cov(Xd, Xd, 0L, nT, Ndim, Double = Double, /zero2nan) * $ … … 196 196 4: Cross[*, *, *, k] = TimeCross_Cov(Xd, Yd, Lag[k], nT, Ndim, Double = Double) / nT 197 197 ENDCASE 198 ENDIF else BEGIN 198 ENDIF else BEGIN 199 199 case NDim of 200 200 1: Cross[k] = TimeCross_Cov(yd, xd, ABS(Lag[k]), nT, Ndim, Double = Double) / nT … … 203 203 4: Cross[*, *, *, k] = TimeCross_Cov(yd, xd, ABS(Lag[k]), nT, Ndim, Double = Double) / nT 204 204 ENDCASE 205 ENDELSE 205 ENDELSE 206 206 endfor 207 207 endelse … … 210 210 211 211 END 212 212 -
trunk/SRC/ToBeReviewed/STRING/getfile.pro
r223 r226 77 77 file = file[0] 78 78 if file EQ 'NOT FOUND' then begin 79 print, ' Error in getfile: File '+filein+' not fou ond.'79 print, ' Error in getfile: File '+filein+' not found.' 80 80 return, -1 81 81 endif -
trunk/SRC/ToBeReviewed/STRING/str_size.pro
r163 r226 22 22 ; the target width. 23 23 ; 24 ; @keyword INITSIZE {default=1.0} 24 ; @keyword INITSIZE {default=1.0} 25 25 ; This is the initial size of the string. Default is 1.0. 26 26 ; … … 29 29 ; of the interactive process of calculating the string size. 30 30 ; 31 ; @returns 31 ; @returns 32 32 ; thisCharSize. This is the size the specified string should be set 33 33 ; to if you want to produce output of the specified target … … 45 45 ; Written by: David Fanning, 17 DEC 96. 46 46 ; Added a scaling factor to take into account the aspect ratio 47 ; of the window in determin g the character size. 28 Oct 97. DWF47 ; of the window in determining the character size. 28 Oct 97. DWF 48 48 ; 49 49 ; @version -
trunk/SRC/ToBeReviewed/STRING/strtok.pro
r186 r226 4 4 ; @file_comments 5 5 ; Retrieve portion of string up to token. 6 ; 6 ; 7 7 ; @categories 8 8 ; String … … 10 10 ; @param STRING {in}{required} 11 11 ; String to be split. Contains text after in, out token on output. 12 ; 12 ; 13 13 ; @param TOKEN {in}{required} 14 ; Token to use in splitting old. 14 ; Token to use in splitting old. 15 15 ; 16 ; @keyword TRIM 16 ; @keyword TRIM 17 17 ; set to remove leading blanks from old before returning. 18 18 ; 19 19 ; @keyword HELP 20 20 ; print useful message and exit. 21 ; 21 ; 22 22 ; @returns 23 23 ; new -- portion of string up to token. out … … 28 28 ; Token may be one or more characters. 29 29 ; if token is not found, returns old and sets old to ''. 30 ; 30 ; 31 31 ; @examples 32 32 ; If old is 'foo44 bar', then strtok( old, '44' ) would return … … 58 58 ; Copyright (C) 1996 The Regents of the University of California, All 59 59 ; Rights Reserved. Written by Matthew W. Craig. 60 ; See the file COPYRIGHT for restrictions on distr ubting this code.60 ; See the file COPYRIGHT for restrictions on distributing this code. 61 61 ; This code comes with absolutely NO warranty; see DISCLAIMER for details. 62 62 ; … … 74 74 On_error, 2 75 75 76 IF (n_params() NE 2) OR keyword_set(Help) THEN BEGIN 76 IF (n_params() NE 2) OR keyword_set(Help) THEN BEGIN 77 77 offset = ' ' 78 78 print, offset+'Retrieve portion of string up to token.' … … 102 102 print, offset+offset+" new='xyz' and old=''." 103 103 return, -1 104 ENDIF 104 ENDIF 105 105 106 106 pos = strpos(string, token) 107 107 108 108 IF (pos GE 0) THEN BEGIN 109 front = strmid(string, 0, pos) 109 front = strmid(string, 0, pos) 110 110 string = strmid(string, pos + strlen(token), strlen(string)) 111 111 IF keyword_set(trim) THEN string = strtrim(string, 1) 112 112 return, front 113 113 ENDIF 114 114 115 115 front = string 116 116 string = '' 117 117 return, front 118 118 119 119 END 120 120 -
trunk/SRC/ToBeReviewed/STRUCTURE/extractstru.pro
r163 r226 13 13 ; 14 14 ; @param LISTE {in}{required}{type=vector} 15 ; A vector of string including names of STRU to be deleted 15 ; A vector of string including names of STRU to be deleted 16 16 ; (by default) or to be kept (if KEEP is activated). 17 17 ; … … 48 48 ; @version 49 49 ; $Id$ 50 ; 50 ; 51 51 ;- 52 52 ;------------------------------------------------------------ … … 59 59 if size(stru, /type) NE 8 then return, -1 60 60 if size(liste, /type) NE 7 then return, -1 61 ; che king for keep and vire keywords61 ; checking for keep and vire keywords 62 62 keep = keyword_set(keep)*(1-keyword_set(delete)) 63 63 delete = keyword_set(delete)*(1-keyword_set(keep)) +(keyword_set(delete) EQ keep) … … 80 80 if n_elements(index) GT 1 then for i = 1, n_elements(index)-1 do $ 81 81 res = create_struct(res, tname[index[i]], stru.(index[i])) 82 ENDELSE 82 ENDELSE 83 83 84 84 return, res -
trunk/SRC/ToBeReviewed/STRUCTURE/struct2string.pro
r163 r226 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; 5 ; 6 6 ; @file_comments 7 7 ; Convert a structure to an "executable string" … … 9 9 ; @categories 10 10 ; Utilities 11 ; 11 ; 12 12 ; @param STRUCT {in}{required} 13 13 ; A structure … … 15 15 ; @keyword MAX_STRUCT_LENGTH {default=10000l} 16 16 ; The maximum length of the structure 17 ; perm etted to convert the structure to string.17 ; permitted to convert the structure to string. 18 18 ; 19 19 ; @keyword DIRECT2STRING … … 31 31 ; create_struct('NAME','X','X_SIZE',891,'Y_SIZE',630,'X_VSIZE' 32 32 ; ,891,'Y_VSIZE',630,'X_CH_SIZE',6,'Y_CH_SIZE',10,'X_PX_CM' 33 ; ,40.0000,'Y_PX_CM',40.0000,'N_COLORS',16777216,'TABLE_SIZE' 33 ; ,40.0000,'Y_PX_CM',40.0000,'N_COLORS',16777216,'TABLE_SIZE' 34 34 ; ,256,'FILL_DIST',1,'WINDOW',32,'UNIT',0,'FLAGS',328124,'ORIGIN' 35 35 ; ,[0,0],'ZOOM',[1,1]) … … 46 46 ;------------------------------------------------------------ 47 47 ;------------------------------------------------------------ 48 FUNCTION struct2string, struct, CUT_IN_STRING = cut_in_string, MAX_STRUCT_LENGTH = max_struct_length, DIRECT2STRING = direct2string 48 FUNCTION struct2string, struct, CUT_IN_STRING = cut_in_string, MAX_STRUCT_LENGTH = max_struct_length, DIRECT2STRING = direct2string 49 49 ; 50 50 compile_opt idl2, strictarrsubs … … 65 65 endfor 66 66 endif 67 67 68 68 END 69 69 keyword_set(CUT_IN_STRING):BEGIN -
trunk/SRC/ToBeReviewed/TRIANGULATION/ciseauxtri.pro
r192 r226 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; @file_comments 5 ; @file_comments 6 6 ; Delete arrays which do not have to be drawn thanks to 2 tests: 7 7 ; 1) Corners of the array must be in the window 8 ; 2) Lengthes of side of triangles expressed in normalized 9 ; coordinates must not surpass a sill length. 8 ; 2) Lengthes of side of triangles expressed in normalized 9 ; coordinates must not surpass a sill length. 10 10 ; 11 11 ; @categories 12 12 ; 13 13 ; @param TRIANG 14 ; 15 ; @param GLAM 16 ; 17 ; @param GPHI 18 ; 14 ; 15 ; @param GLAM 16 ; 17 ; @param GPHI 18 ; 19 19 ; @keyword _EXTRA 20 20 ; Used to pass your keywords. … … 29 29 ; @version 30 30 ; $Id$ 31 ; 31 ; 32 32 ;- 33 33 ;------------------------------------------------------------ … … 56 56 57 57 tempdeux = systime(1) ; For key_performance =2 58 z = convert_coord(glam[*],gphi[*],/data,/to_normal) 58 z = convert_coord(glam[*],gphi[*],/data,/to_normal) 59 59 x = z[0, *] 60 60 y = z[1, *] … … 63 63 print, 'temps ciseauxtri: convert_coord data to_normal', systime(1)-tempdeux 64 64 ; 65 ; Beware, following the projection, some points x or y can become NaN 66 ; (see points behind the Earth in an orthographic projection). 65 ; Beware, following the projection, some points x or y can become NaN 66 ; (see points behind the Earth in an orthographic projection). 67 67 ; In this case, we have to remove all triangle which contain one of these points. 68 68 ; … … 99 99 testy = abs(temporary(ytri)) GT ((!p.position[3]-!p.position[1])/seuil) 100 100 testy = total(temporary(testy), 1) 101 ; 101 ; 102 102 test = temporary(testx)+temporary(testy) 103 ind=where(temporary(test) EQ 0) 103 ind=where(temporary(test) EQ 0) 104 104 ; 105 105 IF testvar(var = key_performance) EQ 2 THEN $ … … 146 146 if keyword_set(trichanged) then BEGIN 147 147 ; 148 ; We have to check that triangles we keep do not form a triangulation 149 ; in which 2 triangles have a common summit without have a common side. 150 ; 151 ; We constitute the list of rectangles we want to keep (we keep every 148 ; We have to check that triangles we keep do not form a triangulation 149 ; in which 2 triangles have a common summit without have a common side. 150 ; 151 ; We constitute the list of rectangles we want to keep (we keep every 152 152 ; rectangle containing a triangle) 153 153 ; … … 155 155 ; last summit are those of the diagonale of the rectangle defined by 156 156 ; the mesh size. To find from which rectangle a triangle comes, we look 157 ; for the min of the index fol owing x and following y of each triangle.157 ; for the min of the index following x and following y of each triangle. 158 158 ; Then we go by again this indexion following x and y in an indexion 159 159 ; following nx*ny/ … … 166 166 indxtriang2 = triang[2, *]-nx*(triang[2, *]/nx) 167 167 indxmin = indxtriang0 < indxtriang2 168 ; Beware in the case where the grid is periodic and where we have all points 169 ; following x, triangles which assure the periodicity in x have indexes 170 ; following x which are 0 and nx-1. They belong to rectangles of the column 168 ; Beware in the case where the grid is periodic and where we have all points 169 ; following x, triangles which assure the periodicity in x have indexes 170 ; following x which are 0 and nx-1. They belong to rectangles of the column 171 171 ; nx-1 and not to column 0. 172 172 if keyword_set(key_periodic) AND nx EQ jpi then BEGIN 173 173 indxmax = indxtriang0 > indxtriang2 174 174 indxtriang = indxmin + (nx-1)*(indxmin EQ 0 AND indxmax EQ (nx-1)) 175 ENDIF ELSE indxtriang = indxmin 175 ENDIF ELSE indxtriang = indxmin 176 176 listrect = nx*indytriang+indxtriang 177 177 IF testvar(var = key_performance) EQ 2 THEN $ 178 178 print, 'temps ciseauxtri: liste des rectangles', systime(1)-tempdeux 179 179 ; 180 ; Now we have this list, we will make sure that we do not have triangles 180 ; Now we have this list, we will make sure that we do not have triangles 181 181 ; with only a common summit. 182 182 ; … … 195 195 *shift(test, 0, -1)*shift(test, -1, 0)) EQ 1) 196 196 ; We delete the top rectangle (same x index but equal to 1) 197 if vire2[0] NE -1 THEN test[vire2+nx] = 0 197 if vire2[0] NE -1 THEN test[vire2+nx] = 0 198 198 ENDWHILE 199 199 ;stop … … 202 202 avirer = where(temporary(test) EQ 0) 203 203 IF testvar(var = key_performance) EQ 2 THEN $ 204 print, 'temps ciseauxtri: determination des rectangles a virer', systime(1)-tempdeux204 print, 'temps ciseauxtri: determination des rectangles a virer', systime(1)-tempdeux 205 205 ; 206 206 if avirer[0] NE -1 then begin … … 208 208 indnx = n_elements(listrect) 209 209 indny = n_elements(avirer) 210 ind = listrect[*]#replicate(1l, indny) 210 ind = listrect[*]#replicate(1l, indny) 211 211 ind = ind EQ replicate(1, indnx)#avirer[*] 212 212 if indny GT 1 then ind = total(ind, 2) … … 217 217 print, 'temps ciseauxtri: derniere retouche de la triangulation', systime(1)-tempdeux 218 218 endif 219 ; 220 ; 221 if keyword_set(key_performance) THEN print, 'temps ciseauxtri', systime(1)-tempsun 219 ; 220 ; 221 if keyword_set(key_performance) THEN print, 'temps ciseauxtri', systime(1)-tempsun 222 222 ; 223 223 return, triang -
trunk/SRC/ToBeReviewed/TRIANGULATION/drawcoast_e.pro
r163 r226 5 5 ; @categories 6 6 ; 7 ; 7 ; 8 8 ; @param MASK 9 9 ; 10 ; 10 ; 11 11 ; @param XF 12 ; 12 ; 13 13 ; 14 14 ; @param YF 15 ; 15 ; 16 16 ; 17 17 ; @param NX 18 ; 18 ; 19 19 ; 20 20 ; @param NY 21 ; 21 ; 22 22 ; 23 23 ; @keyword COAST_COLOR {default=0} … … 29 29 ; 30 30 ; @keyword XSEUIL {default=5} 31 ; To eliminate segments of coasts which are to big (which link points which can 32 ; be close on the sphere but distant on the drawing). We delete all segments 31 ; To eliminate segments of coasts which are to big (which link points which can 32 ; be close on the sphere but distant on the drawing). We delete all segments 33 33 ; whose the size surpass the size of the window following X/XSEUIL. 34 ; But it can be to big if we do a big zoom or a little one for some 34 ; But it can be to big if we do a big zoom or a little one for some 35 35 ; projections... We specify it the keyword thanks to this keyword! 36 36 ; … … 40 40 ; @keyword _EXTRA 41 41 ; Used to pass our keywords 42 ; 42 ; 43 43 ; @returns 44 ; 45 ; 44 ; 45 ; 46 46 ; @uses 47 ; 48 ; 47 ; 48 ; 49 49 ; @restrictions 50 ; 51 ; 50 ; 51 ; 52 52 ; @examples 53 ; 54 ; 53 ; 54 ; 55 55 ; @history 56 ; 57 ; 58 ; @version 56 ; 57 ; 58 ; @version 59 59 ; 60 60 ; @todo 61 61 ; Seb: remplir le header 62 ; 62 ; 63 63 ;- 64 64 … … 88 88 if NOT keyword_set(xseuil) then xseuil = 5. < (min([nx, ny])-2) 89 89 distanceseuil = (!p.position[2]-!p.position[0])/xseuil 90 ; liste: liste des points i pour lesquels on va tracer un segment90 ; liste: liste des points i pour lesquels on va tracer un segment 91 91 index = lindgen(nx, ny) 92 92 index = index[0:nx-2, 1:ny-1] … … 107 107 if NOT keyword_set(xseuil) then xseuil = 5. < (min([nx, ny])-2) 108 108 distanceseuil = (!p.position[2]-!p.position[0])/xseuil 109 ; liste: liste des points i pour lesquels on va tracer un segment109 ; liste: liste des points i pour lesquels on va tracer un segment 110 110 index = lindgen(nx, ny-1) 111 111 index = index[0:nx-2, *] -
trunk/SRC/ToBeReviewed/TRIANGULATION/tracemask.pro
r163 r226 9 9 ; @categories 10 10 ; Utilities 11 ; 11 ; 12 12 ; @param MASKENTREE {in}{required} 13 13 ; 2d array specifying the mask 14 ; 14 ; 15 15 ; @param XIN {in}{required}, 16 16 ; 2d array specifying longitude coordinates. 17 ; 17 ; 18 18 ; @param YIN {in}{required}, 19 19 ; 2d array specifying latitude coordinates. … … 56 56 @updatekwd 57 57 ENDIF 58 ;--------------------------------------------------------- 58 ;--------------------------------------------------------- 59 59 tempsun = systime(1) ; For key_performance 60 60 ; We avoid edging problems: … … 82 82 ; we sill 83 83 xentree = xrange[0] > xentree < xrange[1] 84 ; we enlarge the array 84 ; we enlarge the array 85 85 xf = fltarr(nx, ny) 86 86 xf[1:nx-1, 1:ny-1] = xentree … … 92 92 yrange = !y.range[sort(!y.range)] 93 93 yentree = .5*(yentree+shift(yentree, 0, -1)) 94 IF not keyword_set(overplot) THEN BEGIN 94 IF not keyword_set(overplot) THEN BEGIN 95 95 if yinverse then yentree[*, ny-2] = yrange[0] ELSE yentree[*, ny-2] = yrange[1] 96 96 ENDIF ELSE yentree[*, ny-2] = yentree[*, ny-3] … … 99 99 yf[1:nx-1, 1:ny-1] = yentree 100 100 yf[0, 1:ny-1] = yentree[0, *] 101 IF not keyword_set(overplot) THEN BEGIN 101 IF not keyword_set(overplot) THEN BEGIN 102 102 if yinverse then yf[*, 0] = yrange[1] ELSE yf[*, 0] = yrange[0] 103 103 ENDIF ELSE yentree[*, 0] = yentree[*, 1] … … 113 113 ; We recuperate lx and ly which are indexes in a 2d array of points given by list 114 114 ly = liste/nx & lx = temporary(liste)-nx*ly 115 indice = where(ly NE 0) ; We do not take points concernin ing116 ; the first line because in this case, the point j-1 is not defined 115 indice = where(ly NE 0) ; We do not take points concerning 116 ; the first line because in this case, the point j-1 is not defined 117 117 if indice[0] NE -1 then begin 118 118 lx = lx[indice] & ly = ly[temporary(indice)] … … 122 122 ; loop on concerned points and drawing of the segment. 123 123 ; comments: we use plots instead of plot because plots is faster. 124 for pt = 0L, n_elements(lx)-1 do BEGIN 124 for pt = 0L, n_elements(lx)-1 do BEGIN 125 125 i = lx[pt] & j = ly[pt] 126 126 plots, [xf[i, j-1], xf[i, j]], [yf[i, j-1], yf[i, j]] $ … … 146 146 print, 'temps tracemask: liste traits horizontaux', systime(1)-tempdeux 147 147 tempdeux = systime(1) ; For key_performance =2 148 for pt = 0L, n_elements(lx)-1 do BEGIN 148 for pt = 0L, n_elements(lx)-1 do BEGIN 149 149 i = lx[pt] & j = ly[pt] 150 150 plots, [xf[i-1, j], xf[i, j]], [yf[i-1, j], yf[i, j]] $ … … 156 156 ; 157 157 ; 158 if keyword_set(key_performance) THEN print, 'temps tracemask', systime(1)-tempsun 159 158 if keyword_set(key_performance) THEN print, 'temps tracemask', systime(1)-tempsun 159 160 160 return 161 161 end -
trunk/SRC/ToBeReviewed/TRIANGULATION/triangule_c.pro
r163 r226 7 7 ; Construct the triangulation array. 8 8 ; 9 ; The idea is: construct a list of triangle which link points between them. 9 ; The idea is: construct a list of triangle which link points between them. 10 10 ; This is automatically done by the function TRIANGULATE 11 11 ; Here: 12 ; we consider the fact that points are disposed on a grid (regular or not, 13 ; but not unstructured, that is to say that points are written following a 14 ; rectangular matrix). A easy way to do triangles between all points is then: 12 ; we consider the fact that points are disposed on a grid (regular or not, 13 ; but not unstructured, that is to say that points are written following a 14 ; rectangular matrix). A easy way to do triangles between all points is then: 15 15 ; 16 16 ; for each point (i,j) of the matrix -except those of the last line and of … … 22 22 ; drawing to make sure!!), so there are two possible choice for each rectangle 23 23 ; we want to cut in 2 triangles... 24 ; 24 ; 25 25 ; It is thanks to this choice that we will be able to trace coast with right 26 26 ; angles. At each angle of coast remarkable by the existence of an unique land 27 27 ; point or of an unique ocean point on one of the four summit of a rectangle (i,j), 28 28 ; we have to cut the rectangle following the diagonal passing by this point. 29 ; 29 ; 30 30 ; @categories 31 31 ; Graphics 32 32 ; 33 33 ; @param MASKENTREE {in}{optional}{type=2d array} 34 ; It is a 2d array which will serve to mask the field we will trace after with CONTOUR, 34 ; It is a 2d array which will serve to mask the field we will trace after with CONTOUR, 35 35 ; ...TRIANGULATION=triangule(mask) 36 36 ; If this argument is not specified, the function use tmask … … 43 43 ; 44 44 ; @keyword COINMONTE {type=array} 45 ; To obtain the array of "ascending land corner" to be treated with 46 ; completecointerre.pro in the variable array instead of make it pass by the global 45 ; To obtain the array of "ascending land corner" to be treated with 46 ; completecointerre.pro in the variable array instead of make it pass by the global 47 47 ; variable twin_corners_up. 48 48 ; … … 52 52 ; @returns 53 53 ; res: tableau 2d (3,nbre de triangles). 54 ; Each line of res represent indexes of points constituting summits of a triangle. 54 ; Each line of res represent indexes of points constituting summits of a triangle. 55 55 ; See how we trace triangles in definetri.pro 56 56 ; … … 61 61 ; 62 62 ; @restrictions 63 ; Datas whose we want to do the contour must be disposed in a matrix. 64 ; On the other hand, in the matrix, the points's arrangement can not be 63 ; Datas whose we want to do the contour must be disposed in a matrix. 64 ; On the other hand, in the matrix, the points's arrangement can not be 65 65 ; irregular. If it is, use TRIANGULE. 66 66 ; … … 73 73 ; 74 74 ; @todo 75 ; seb L.267->268 je ne pense pas que ce soit ce que tu voulais dire mais 75 ; seb L.267->268 je ne pense pas que ce soit ce que tu voulais dire mais 76 76 ; c'est la traduction de ce qu'il y avait écrit. Correction si besoin. 77 77 ;- … … 101 101 ;------------------------------------------------------------ 102 102 if keyword_set(key_periodic)*(nx EQ jpi) $ 103 AND NOT keyword_set(basic) then BEGIN 103 AND NOT keyword_set(basic) then BEGIN 104 104 msk = [msk, msk[0, *]] 105 105 nx = nx+1 106 106 ENDIF 107 107 ;------------------------------------------------------------ 108 ; We will find the list of rectangles (i,j)(located by their left 109 ; bottom corner) we have to cut fol owing a descendant diagonal.108 ; We will find the list of rectangles (i,j)(located by their left 109 ; bottom corner) we have to cut following a descendant diagonal. 110 110 ; We will call this list : pts_downward 111 ; 111 ; 112 112 pts_downward = 0 113 113 … … 164 164 ENDIF 165 165 ; 166 if n_elements(pts_downward) EQ 1 then BEGIN 166 if n_elements(pts_downward) EQ 1 then BEGIN 167 167 tempdeux = systime(1) ; For key_performance =2 168 168 ; … … 173 173 coinmont = -1 174 174 coindesc = -1 175 ENDIF ELSE BEGIN 175 ENDIF ELSE BEGIN 176 176 tempdeux = systime(1) ; For key_performance =2 177 177 pts_downward = pts_downward[1:n_elements(pts_downward)-1] 178 178 pts_downward = pts_downward[uniq(pts_downward, sort(pts_downward))] 179 ; None rectangle can have an element of the last column or of the 179 ; None rectangle can have an element of the last column or of the 180 180 ; last line as left bottom corner. 181 181 ; so we have to remove these points if they has been selected in pts_downward. 182 derniere_colonne = (lindgen(ny)+1)*nx-1 183 derniere_ligne = lindgen(nx)+(ny-1)*nx 182 derniere_colonne = (lindgen(ny)+1)*nx-1 183 derniere_ligne = lindgen(nx)+(ny-1)*nx 184 184 pts_downward =different(pts_downward,derniere_colonne ) 185 185 pts_downward =different(pts_downward,derniere_ligne ) … … 193 193 coindesc =different(coindesc,derniere_ligne ) 194 194 endif 195 ENDIF ELSE BEGIN 195 ENDIF ELSE BEGIN 196 196 coinmont = -1 197 197 coindesc = -1 198 ENDELSE 198 ENDELSE 199 199 IF testvar(var = key_performance) EQ 2 THEN $ 200 200 print, 'temps triangule: menage ds pts_downward coinmont et coindesc', systime(1)-tempdeux … … 205 205 IF testvar(var = key_performance) EQ 2 THEN $ 206 206 print, 'temps triangule: definetri', systime(1)-tempdeux 207 ENDELSE 207 ENDELSE 208 208 ;------------------------------------------------------------ 209 209 ; We delete land points which only contain land points. 210 210 ;------------------------------------------------------------ 211 211 ; 212 ; 212 ; 213 213 if (NOT keyword_set(basic)) AND (NOT keyword_set(keep_cont)) then begin 214 214 tempdeux = systime(1) ; For key_performance =2 … … 224 224 trimask = intarr(nx, ny) 225 225 trimask[0:nx-2, 0:ny-2] = 1 226 IF recdsterre[0] NE -1 then BEGIN 226 IF recdsterre[0] NE -1 then BEGIN 227 227 tempdeux = systime(1) ; For key_performance =2 228 228 indice[recdsterre] = 1 … … 231 231 vire2 = 0 232 232 while (vire1[0] NE -1 OR vire2[0] NE -1) ne 0 do begin 233 ; Delete rectangles we have to remove from recsterre (in fact those we have 234 ; to keep although they ar eentirely in the land).233 ; Delete rectangles we have to remove from recsterre (in fact those we have 234 ; to keep although they are entirely in the land). 235 235 vire1 = where( (indice*shift(indice, -1, -1) $ 236 236 *(1-shift(indice, 0, -1))*(1-shift(indice, -1, 0))*trimask) EQ 1) 237 if vire1[0] NE -1 THEN BEGIN 237 if vire1[0] NE -1 THEN BEGIN 238 238 indice[vire1] = 0 239 239 ; indice[vire1+nx+1] = 0 240 240 endif 241 241 242 242 vire2 = where( ((1-indice)*(1-shift(indice, -1, -1)) $ 243 243 *shift(indice, 0, -1)*shift(indice, -1, 0)*trimask) EQ 1) 244 if vire2[0] NE -1 THEN BEGIN 244 if vire2[0] NE -1 THEN BEGIN 245 245 indice[vire2+1] = 0 246 246 ; indice[vire2+nx] = 0 … … 259 259 trigarde = transpose(temporary(trigarde)) 260 260 trigarde = [trigarde, trigarde+1] 261 ; 261 ; 262 262 triang = triang[*, temporary(trigarde[*])] 263 263 IF testvar(var = key_performance) EQ 2 THEN $ … … 265 265 endif 266 266 endif 267 ; print, 'temps tri triangles', systime(1)-t1 268 ;------------------------------------------------------------ 269 ; When key_periodic equal 1, triang is a list of indexes's array which 267 ; print, 'temps tri triangles', systime(1)-t1 268 ;------------------------------------------------------------ 269 ; When key_periodic equal 1, triang is a list of indexes's array which 270 270 ; have a surplus column. 271 ; We have to put it back to the initial matrix by putting indexes of 271 ; We have to put it back to the initial matrix by putting indexes of 272 272 ; the last column equal to these of the last column... 273 273 ;------------------------------------------------------------ 274 274 tempdeux = systime(1) ; For key_performance =2 275 275 if keyword_set(key_periodic)*(nx-1 EQ jpi) $ 276 AND NOT keyword_set(basic) then BEGIN 276 AND NOT keyword_set(basic) then BEGIN 277 277 indicey = triang/nx 278 278 indicex = triang-indicey*nx … … 310 310 IF NOT keyword_set(key_forgetold) THEN BEGIN 311 311 @updateold 312 ENDIF 313 314 IF keyword_set(key_performance) THEN print, 'temps triangule', systime(1)-tempsun 312 ENDIF 313 314 IF keyword_set(key_performance) THEN print, 'temps triangule', systime(1)-tempsun 315 315 316 316 return, triang 317 317 318 END 318 END -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcmd.pro
r172 r226 5 5 ; 6 6 ; @file_comments 7 ; This function send back a string which contain the reading command 7 ; This function send back a string which contain the reading command 8 8 ; and drawing's parameters. 9 9 ; … … 11 11 ; 12 12 ; @keyword BOXZOOM 13 ; Vector indicating the geographic zone on which we want to cut the map. 14 ; If BOXZOOM has : 13 ; Vector indicating the geographic zone on which we want to cut the map. 14 ; If BOXZOOM has : 15 15 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 16 16 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 17 17 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 18 18 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 19 ; 6 elements: The extraction is made on Boxzoom 19 ; 6 elements: The extraction is made on Boxzoom 20 20 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 21 21 ; … … 54 54 numdessinout = smallout[2]-1 55 55 ; 56 options = extractatt(top_uvalue, 'options') 56 options = extractatt(top_uvalue, 'options') 57 57 optionsflag = extractatt(top_uvalue, 'optionsflag') 58 58 portrait = (strtrim(optionsflag[where(options EQ 'Portrait/Landscape'), 0], 1))[0] … … 83 83 ; Search of options 84 84 ; 85 options = extractatt(top_uvalue, 'options') 85 options = extractatt(top_uvalue, 'options') 86 86 optionsflag = extractatt(top_uvalue, 'optionsflag') 87 87 flags = optionsflag[*, numdessinin] … … 133 133 widcmd = strtrim(widcmd, 2) 134 134 IF widcmd[0] EQ '' THEN widcmd = 'zzz' 135 135 136 136 cutcmd, widcmd[0], toread, numberofread, prefix, nameexp, ending 137 137 ; … … 158 158 ; we complet the reading command 159 159 oldrdcmd = extractatt(top_uvalue, 'currentreadcmd') 160 nl = n_elements(oldrdcmd) 160 nl = n_elements(oldrdcmd) 161 161 oldrdcmd[nl-1] = oldrdcmd[nl-1] + ' $' 162 162 readcmd[i] = prefix + readcmd[i] … … 164 164 ENDELSE 165 165 ; exit if we have to read other fields... 166 if alreadyread+1 NE numberofread-1 THEN BEGIN 166 if alreadyread+1 NE numberofread-1 THEN BEGIN 167 167 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd 168 168 *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = alreadyread+1 … … 171 171 ENDIF 172 172 ; we finalize the reading command 173 IF ending NE '' THEN BEGIN 174 nl = n_elements(readcmd) 173 IF ending NE '' THEN BEGIN 174 nl = n_elements(readcmd) 175 175 readcmd[nl-1] = readcmd[nl-1] + ' $' 176 176 readcmd = [temporary(readcmd), ending] … … 186 186 tgnm = strlowcase(tag_names(exextra)) 187 187 indtmp = where(tgnm EQ 'box' OR tgnm EQ 'boxzoom', cnt) 188 IF cnt EQ 1 THEN BEGIN 188 IF cnt EQ 1 THEN BEGIN 189 189 boxextra = exextra.(indtmp[0]) 190 190 exextra = extractstru(exextra, ['box', 'boxzoom']) 191 ENDIF 191 ENDIF 192 192 extra = mixstru(exextra, extra) 193 193 sextra = struct2string(extra) … … 214 214 'vector':BEGIN 215 215 ; for the vectors, there is 2 components. we read u when alreadyvector 216 ; is a inte rger and v when alreadyvector is a interger+0.5216 ; is a integer and v when alreadyvector is a integer+0.5 217 217 if floor(alreadyvector)+1 EQ 0 then begin 218 218 if floor(alreadyvector) EQ alreadyvector then begin … … 226 226 ENDIF ELSE BEGIN 227 227 oldrdcmd = extractatt(top_uvalue, 'currentreadcmd') 228 nl = n_elements(oldrdcmd) 228 nl = n_elements(oldrdcmd) 229 229 oldrdcmd[nl-1] = oldrdcmd[nl-1] + ' $' 230 230 readcmd[i] = prefix + readcmd[i] … … 235 235 numberofread-1:BEGIN 236 236 ; we finalize the reading command 237 IF ending NE '' THEN BEGIN 238 nl = n_elements(readcmd) 237 IF ending NE '' THEN BEGIN 238 nl = n_elements(readcmd) 239 239 readcmd[nl-1] = readcmd[nl-1] + ' $' 240 240 readcmd = [temporary(readcmd), ending] … … 252 252 numberofread-0.5:BEGIN 253 253 ; we finalize the reading command 254 IF ending NE '' THEN BEGIN 255 nl = n_elements(readcmd) 254 IF ending NE '' THEN BEGIN 255 nl = n_elements(readcmd) 256 256 readcmd[nl-1] = readcmd[nl-1] + ' $' 257 257 readcmd = [temporary(readcmd), ending] … … 301 301 ENDIF ELSE BEGIN 302 302 oldrdcmd = extractatt(top_uvalue, 'currentreadcmd') 303 nl = n_elements(oldrdcmd) 303 nl = n_elements(oldrdcmd) 304 304 oldrdcmd[nl-1] = oldrdcmd[nl-1] + ' $' 305 305 readcmd[i] = prefix + readcmd[i] … … 307 307 ENDELSE 308 308 ; 309 if alreadyover+1 NE numberofread-1 THEN BEGIN 309 if alreadyover+1 NE numberofread-1 THEN BEGIN 310 310 ; we still need to read some files... 311 311 *top_uvalue[1, findline(top_uvalue, 'currentreadcmd')] = readcmd … … 315 315 ENDIF 316 316 ; we finalize the reading command 317 IF ending NE '' THEN BEGIN 318 nl = n_elements(readcmd) 317 IF ending NE '' THEN BEGIN 318 nl = n_elements(readcmd) 319 319 readcmd[nl-1] = readcmd[nl-1] + ' $' 320 320 readcmd = [temporary(readcmd), ending] … … 362 362 ; For [plots in z, box must have by default 0,profmax 363 363 if strpos(type, 'z') NE -1 then BEGIN 364 ; If more than 1 level is selected: 364 ; If more than 1 level is selected: 365 365 widget_control, widget_info(base, find_by_uname = 'dthlv1'), get_value = niv1 366 366 niv1 = niv1.combobox_index -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/identifyclick.pro
r150 r226 85 85 ; t/3/0 End of the double click 86 86 thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 3 AND press EQ 0:uval.click = 0 87 ; Impos ible case in theory:87 ; Impossible case in theory: 88 88 ELSE:BEGIN 89 89 print, thisEvent, uval.click, press -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
r221 r226 5 5 ; @categories 6 6 ; 7 ; 7 ; 8 8 ; @param NAMEFILE 9 9 ; 10 ;11 10 ; @keyword GRID {default='T'}{type=scalar string} 12 11 ; Used to specify on which grid type are located the data … … 14 13 ; @keyword _EXTRA 15 14 ; Used to pass your keywords to isafile and ncdf_getaxis 16 ; 15 ; 17 16 ; @returns 18 ; 19 ; 17 ; 20 18 ; @uses 21 ; 22 ; 19 ; 23 20 ; @restrictions 24 ; 25 ; 21 ; 26 22 ; @examples 27 ; 28 ; 23 ; 29 24 ; @history 30 ; 31 ; 32 ; @version 25 ; 26 ; @version 33 27 ; $Id$ 34 28 ; 35 29 ; @todo 36 30 ; seb : I don't know what to do with that... 37 ; 31 ; 38 32 ;- 39 33 ; … … 49 43 ; dont les noms sont 'x','lon...','xi_...' et 'y','lat...' ou 50 44 ; 'eta_...' ou bien en majuscule. 51 ; 4) il doit exi ter ds ce fichier une unique variable n''ayant45 ; 4) il doit exister ds ce fichier une unique variable n''ayant 52 46 ; qu''une dimension et etant la dimension temporelle. cette 53 47 ; variable sera prise comme axe des temps. Rq: si plusieurs … … 55 49 ; variable 56 50 ; 5) Cette variable axe des temps doit contenir l''attribut 57 ; 'units' qui doit etre ecrit suivant la syntaxe:58 ; "seconds since 0001-01-01 00:00:00" 59 ; "hours since 0001-01-01 00:00:00" 60 ; "days since 1979-01-01 00:59:59" 61 ; "months since 1979-01-01 00:59:59" 62 ; "years since 1979-01-01 00:59:59" 51 ; 'units' qui doit etre ecrit suivant la syntaxe: 52 ; "seconds since 0001-01-01 00:00:00" 53 ; "hours since 0001-01-01 00:00:00" 54 ; "days since 1979-01-01 00:59:59" 55 ; "months since 1979-01-01 00:59:59" 56 ; "years since 1979-01-01 00:59:59" 63 57 ; 64 58 ; je crois que c''est tout! … … 93 87 namedim = strarr(inside.ndims) 94 88 for dimiq = 0, inside.ndims-1 do begin 95 ncdf_diminq, cdfid, dimiq, tmpname, value 89 ncdf_diminq, cdfid, dimiq, tmpname, value 96 90 namedim[dimiq] = strlowcase(tmpname) 97 91 ENDFOR … … 110 104 (inter(invar.dim, dimidy))[0] NE -1 AND $ 111 105 ((where(invar.dim EQ inside.recdim))[0] NE -1 OR inside.recdim EQ -1) $ 112 THEN namevar[varid] = invar.name 106 THEN namevar[varid] = invar.name 113 107 ENDFOR 114 108 namevar = namevar[where(namevar NE '')] … … 135 129 tmpnm[0] EQ 'xi_u' AND tmpnm[1] EQ 'eta_rho':listgrid[i] = 'U' 136 130 tmpnm[0] EQ 'xi_u' AND tmpnm[1] EQ 'eta_v' :listgrid[i] = 'F' 137 ELSE: 138 ENDCASE 131 ELSE: 132 ENDCASE 139 133 ENDFOR 140 134 empty = where(listgrid EQ '') 141 IF empty[0] NE -1 THEN BEGIN 135 IF empty[0] NE -1 THEN BEGIN 142 136 ; could we define the grid type from the file name?? 143 137 pattern = ['GRID.', 'GRID_', 'GRID', 'UPID_', '30ID_'] … … 153 147 ENDFOR 154 148 listgrid[empty] = vargrid 155 ENDIF 149 ENDIF 156 150 ENDIF ELSE listgrid[*] = vargrid 157 151 ;------------------------------------------------------------ … … 159 153 ;------------------------------------------------------------ 160 154 date0fk = date2jul(19000101) 161 IF inside.recdim EQ -1 THEN BEGIN 155 IF inside.recdim EQ -1 THEN BEGIN 162 156 jpt = 1 163 157 time = date0fk … … 170 164 repeat BEGIN 171 165 IF varid LT inside.nvars THEN BEGIN 172 invar = ncdf_varinq(cdfid, varid) 173 varid = varid+1 166 invar = ncdf_varinq(cdfid, varid) 167 varid = varid+1 174 168 ENDIF ELSE varid = 0 175 169 endrep until (n_elements(invar.dim) EQ 1 AND invar.dim[0] EQ inside.recdim) OR (varid EQ 0) … … 177 171 ; 178 172 CASE 1 OF 179 varid EQ -1:BEGIN 173 varid EQ -1:BEGIN 180 174 dummy = report('the file '+fullname+' has no time axis.!C we create a fake calendar ...') 181 175 fakecal = 1 182 176 time = date0fk + lindgen(1>jpt) 183 177 END 184 invar.natts EQ 0:BEGIN 178 invar.natts EQ 0:BEGIN 185 179 dummy = report('the variable '+invar.name+' has no attribut.!C we create a fake calendar ...') 186 180 fakecal = 1 … … 197 191 fakecal = 1 198 192 time = date0fk + lindgen(1>jpt) 199 ENDIF ELSE BEGIN 193 ENDIF ELSE BEGIN 200 194 ; we read the time axis 201 195 ncdf_varget, cdfid, varid, time … … 223 217 err = 1 224 218 ENDIF 225 IF err GT 0 THEN BEGIN 219 IF err GT 0 THEN BEGIN 226 220 fakecal = 1 227 221 time = date0fk + lindgen(1>jpt) 228 ENDIF ELSE BEGIN 222 ENDIF ELSE BEGIN 229 223 debut = str_sep(mots[2], '-') 230 224 ; … … 241 235 'greg':IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg' 242 236 ELSE:BEGIN 243 ; notused = report('Unknown calendar: '+value+', we use greg calendar.') 237 ; notused = report('Unknown calendar: '+value+', we use greg calendar.') 244 238 key_caltype = 'greg' 245 239 END 246 240 ENDCASE 247 241 ENDIF ELSE BEGIN 248 ; notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 242 ; notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 249 243 IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg' 250 244 ENDELSE … … 259 253 'hour':time = julday(debut[1], debut[2], debut[0])+time/24.d 260 254 'day':time = julday(debut[1], debut[2], debut[0])+time 261 'month':BEGIN 255 'month':BEGIN 262 256 if total(fix(time) NE time) NE 0 then $ ; we switch to days with 30d/m 263 257 time = julday(debut[1], debut[2], debut[0])+round(time*30) $ -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xcreateanim.pro
r150 r226 5 5 ; @categories 6 6 ; 7 ;8 7 ; @param EVENT 9 8 ; 10 ;11 9 ; @returns 12 ; 13 ; 10 ; 14 11 ; @uses 15 ; 16 ; 12 ; 17 13 ; @restrictions 18 ; 19 ; 14 ; 20 15 ; @examples 21 ; 22 ; 16 ; 23 17 ; @history 24 ; 25 ; 18 ; 26 19 ; @version 27 ; $Id$ 28 ; 20 ; $Id$ 21 ; 29 22 ; @todo 30 23 ; seb 31 24 ; 32 25 ;- 33 pro xcreateanim_event, event 26 pro xcreateanim_event, event 34 27 ; 35 28 compile_opt idl2, strictarrsubs … … 61 54 widget_control, widget_info(event.top, find_by_uname = 'debut') $ 62 55 , get_value = vdate1 63 index1 = where(calendar eq date2jul(vdate1)) & index1 = index1[0] 56 index1 = where(calendar eq date2jul(vdate1)) & index1 = index1[0] 64 57 if index1 EQ -1 then return 65 58 ; 66 59 widget_control, widget_info(event.handler, find_by_uname = 'fin') $ 67 60 , get_value = vdate2 68 index2 = where(calendar eq date2jul(vdate2)) & index2 = index2[0] 61 index2 = where(calendar eq date2jul(vdate2)) & index2 = index2[0] 69 62 if index2 EQ -1 OR index2 LE index1 then return 70 63 ; We delete the widget before create the file .ps … … 73 66 ; creation of the routine which will serve us to do the drawing 74 67 ; 75 ; We recuperate the list of instructions 68 ; We recuperate the list of instructions 76 69 globalcommand = extractatt(top_uvalue, 'globalcommand') 77 70 ; We complete by first and last lines of the program … … 113 106 green = green[index] 114 107 blue = blue[index] 115 endif 108 endif 116 109 ; 117 110 if depth gt 8 then $ … … 133 126 IF keyword_set(fakecal) THEN date = ind ELSE date = jul2date(calendar[ind]) 134 127 xxx2ps, /noerase, date1 = date, date2 = date 135 ; 128 ; 136 129 image = tvrd(true = depth GT 8) 137 130 ; … … 142 135 wdelete, !d.window 143 136 ENDFOR 144 ENDIF 137 ENDIF 145 138 ; We put a last white picture 146 139 window, /free, /pixmap, xsize = xsize, ysize = ysize … … 155 148 wdelete, !d.window 156 149 ; File's closing. 157 write_gif, animdir+nomfic, /close 158 widget_control, base, /destroy 150 write_gif, animdir+nomfic, /close 151 widget_control, base, /destroy 159 152 ; Rerock in "normal" mode 160 153 thisOS = strupcase(strmid(!version.os_family, 0, 3)) … … 169 162 endif 170 163 ; 171 164 172 165 return 173 166 end … … 179 172 ; @categories 180 173 ; 181 ; 174 ; 182 175 ; @param PARENT 183 176 ; 184 ; 177 ; 185 178 ; @returns 186 ; 187 ; 179 ; 180 ; 188 181 ; @uses 189 ; 190 ; 182 ; 191 183 ; @restrictions 192 ; 193 ; 184 ; 194 185 ; @examples 195 ; 196 ; 186 ; 197 187 ; @history 198 ; 199 ; 188 ; 200 189 ; @version 201 ; $Id$ 202 ; 190 ; $Id$ 191 ; 203 192 ; @todo 204 193 ; seb … … 229 218 if strtrim(filenames[0], 1) EQ '' then filenames = filenames[1:n_elements(filenames)-1] 230 219 indexfile = (where(filelist EQ filenames[0]))[0] 231 calendar = (*(extractatt(top_uvalue, 'fileparameters'))[indexfile]).time_counter 220 calendar = (*(extractatt(top_uvalue, 'fileparameters'))[indexfile]).time_counter 232 221 key_caltype = (*(extractatt(top_uvalue, 'fileparameters'))[indexfile]).caltype 233 222 fakecal = (*(extractatt(top_uvalue, 'fileparameters'))[indexfile]).fakecal … … 237 226 calendarbis = (*(extractatt(top_uvalue, 'fileparameters'))[indexfilebis]).time_counter 238 227 if n_elements(calendarbis) NE n_elements(calendar) then begin 239 nothing = report(' Les diffrents plots n''utilisent pas le meme calendrier. !C Animation impossible!', /error)228 nothing = report('plots do not use the same calendar. !C Animation impossible!', /error) 240 229 return 241 230 ENDIF 242 231 if total(calendar NE calendarbis) NE 0 then begin 243 nothing = report(' Les diffrents plots n''utilisent pas le meme calendrier. !C Animation impossible!', /error)232 nothing = report('plots do not use the same calendar. !C Animation impossible!', /error) 244 233 return 245 234 endif … … 249 238 ; It is possible to do an animation. 250 239 ; 251 base = widget_base(/column, title = 'animation creation', uvalue = {parent:parent, indexfile:indexfile}) 240 base = widget_base(/column, title = 'animation creation', uvalue = {parent:parent, indexfile:indexfile}) 252 241 rien = widget_label(base, value = 'animation name') 253 242 rien = widget_text(base,value='anim_idl.gif', uname='Filename', /editable) … … 266 255 widget_control,base,/realize 267 256 xmanager,'xcreateanim', base, /no_block 268 257 269 258 return 270 259 end -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xxxmenubar_event.pro
r150 r226 5 5 ; @categories 6 6 ; 7 ; 7 ; 8 8 ; @param EVENT 9 9 ; 10 ;11 10 ; @returns 12 ; 13 ; 11 ; 14 12 ; @uses 15 ; 16 ; 13 ; 17 14 ; @restrictions 18 ; 19 ; 15 ; 20 16 ; @examples 21 ; 22 ; 17 ; 23 18 ; @history 24 ; 25 ; 26 ; @version 19 ; 20 ; @version 27 21 ; $Id$ 28 22 ; 29 ; @todo 23 ; @todo 30 24 ; seb 31 25 ;- … … 39 33 40 34 case event.value of 41 'Open' :begin 35 'Open' :begin 42 36 oldmeshparams = ccmeshparameters 43 37 newfile = selectfile() … … 62 56 ; What is the selected field ? Do we reselect it ? 63 57 fieldname = widget_info(vlstid, /combobox_gettext) 64 index = where(newfile.fileparameters.listvar EQ fieldname) 58 index = where(newfile.fileparameters.listvar EQ fieldname) 65 59 widget_control, vlstid, set_value = newfile.fileparameters.listvar 66 60 widget_control, vlstid, set_combobox_select = 0 > index[0] … … 117 111 xxx, CALLERWIDID = event.top, _extra = extra 118 112 end 119 'Quit':begin 113 'Quit':begin 120 114 widget_control, event.top, get_uvalue = top_uvalue 121 115 ptr_free, extractatt(top_uvalue, 'exextra') … … 142 136 , /POSTSCRIPT 143 137 END 144 'Animated gif' :begin 138 'Animated gif' :begin 145 139 IF float(strmid(!version.release,0,3)) GE 6.2 THEN xcreateanim, event.top 146 140 end … … 174 168 widget_control, event.top, get_uvalue = top_uvalue 175 169 ; portrait or landscape ??? 176 options = extractatt(top_uvalue, 'options') 170 options = extractatt(top_uvalue, 'options') 177 171 optionsflag = extractatt(top_uvalue, 'optionsflag') 178 172 portrait = (optionsflag[where(options EQ 'Portrait/Landscape'), 0])[0] … … 203 197 ENDIF 204 198 ; We recuperate the name of the file 205 filename = xquestion(' dans quel fichier bianire voulez vous sauver le widget ?', 'xxx_widget.dat')199 filename = xquestion('In which binary file do you want to save the widget ?', 'xxx_widget.dat') 206 200 ; We complete it by a .dat 207 201 if rstrpos(filename, '.dat') NE strlen(filename)-4 then filename = filename+'.dat' … … 219 213 for i = 0, n_elements(commande)-1 do print, commande[i] 220 214 end 221 'Portrait/Landscape' :begin 215 'Portrait/Landscape' :begin 222 216 widget_control, event.top, get_uvalue = top_uvalue 223 217 options = extractatt(top_uvalue, 'options') … … 255 249 ENDELSE 256 250 end 257 'Overlay' :begin 251 'Overlay' :begin 258 252 widget_control, event.top, get_uvalue = top_uvalue 259 253 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 260 options = extractatt(top_uvalue, 'options') 254 options = extractatt(top_uvalue, 'options') 261 255 flags = extractatt(top_uvalue, 'optionsflag') 262 256 index = where(options EQ 'Overlay') … … 269 263 widget_control, event.top, get_uvalue = top_uvalue 270 264 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 271 options = extractatt(top_uvalue, 'options') 265 options = extractatt(top_uvalue, 'options') 272 266 flags = extractatt(top_uvalue, 'optionsflag') 273 267 index = where(options EQ 'Vecteur') … … 280 274 widget_control, event.top, get_uvalue = top_uvalue 281 275 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 282 options = extractatt(top_uvalue, 'options') 276 options = extractatt(top_uvalue, 'options') 283 277 flags = extractatt(top_uvalue, 'optionsflag') 284 278 index = where(options EQ 'Longitude / x index') … … 314 308 (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom 315 309 end 316 'Latitude / y index':begin 310 'Latitude / y index':begin 317 311 widget_control, event.top, get_uvalue = top_uvalue 318 312 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 319 options = extractatt(top_uvalue, 'options') 313 options = extractatt(top_uvalue, 'options') 320 314 flags = extractatt(top_uvalue, 'optionsflag') 321 315 index = where(options EQ 'Latitude / y index') -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_calendar.pro
r157 r226 7 7 ; case uval of 8 8 ; 'done':widget_control, event.top, /destroy 9 ; 'set':BEGIN 9 ; 'set':BEGIN 10 10 ; widget_control, event.id, get_value = value 11 11 ; widget_control, ComboboxId, set_value = value 12 12 ; END 13 ; 'get':BEGIN 13 ; 'get':BEGIN 14 14 ; widget_control, ComboboxId, get_value = value 15 15 ; help, value, /struct … … 40 40 ; @file_comments 41 41 ; 42 ; 43 ; @categories 44 ; Compound widget 45 ; 42 ; @categories 43 ; Compound widget 44 ; 46 45 ; @param ID 47 46 ; … … 51 50 ; 52 51 ; @returns 53 ; 54 ; 55 ; @uses 56 ; 57 ; 58 ; @restrictions 59 ; 60 ; 61 ; @examples 62 ; 63 ; 64 ; @history 65 ; 66 ; 67 ; @version 52 ; 53 ; @uses 54 ; 55 ; @restrictions 56 ; 57 ; @examples 58 ; 59 ; @history 60 ; 61 ; @version 68 62 ; $Id$ 69 63 ;- … … 71 65 PRO cw_calendar_set_value, id, value 72 66 ; 73 compile_opt strictarr, strictarrsubs 67 compile_opt strictarr, strictarrsubs 74 68 ; 75 69 ; … … 79 73 widget_control, winfo_id, get_uvalue = infowid 80 74 key_caltype = infowid.caltype 81 75 82 76 ; high freqeuncy calendar 83 77 IF keyword_set(infowid.fakecal) THEN BEGIN 84 78 value2 = date2jul(long(value)) - infowid.fakecal 85 IF value2 LT n_elements(infowid.calendar) AND value2 GE 0 THEN BEGIN 79 IF value2 LT n_elements(infowid.calendar) AND value2 GE 0 THEN BEGIN 86 80 stepid = widget_info(id, find_by_uname = 'step') 87 81 widget_control, stepid, set_value = {combobox_select:value2} … … 89 83 widget_control, winfo_id, set_uvalue = infowid 90 84 ENDIF 91 ENDIF ELSE BEGIN 85 ENDIF ELSE BEGIN 92 86 ; 93 87 value = long(value[0]) … … 122 116 ; @categories 123 117 ; Compound widget 124 ; 118 ; 125 119 ; @param ID 126 120 ; 127 121 ; 128 122 ; @returns 129 ; 130 ; 131 ; @uses 132 ; 133 ; 134 ; @restrictions 135 ; 136 ; 137 ; @examples 138 ; 139 ; 140 ; @history 141 ; 142 ; 143 ; @version 123 ; 124 ; @uses 125 ; 126 ; @restrictions 127 ; 128 ; @examples 129 ; 130 ; @history 131 ; 132 ; @version 144 133 ; $Id$ 145 134 ;- 146 135 FUNCTION cw_calendar_get_value, id 147 136 ; 148 compile_opt strictarr, strictarrsubs 137 compile_opt strictarr, strictarrsubs 149 138 ; 150 139 winfo_id = widget_info(id, find_by_uname = 'infocal') … … 159 148 ; @categories 160 149 ; Compound widget 161 ; 150 ; 162 151 ; @param ID 163 152 ; … … 167 156 ; 168 157 ; @returns 169 ; 170 ; 171 ; @uses 172 ; 173 ; 174 ; @restrictions 175 ; 176 ; 177 ; @examples 178 ; 179 ; 180 ; @history 181 ; 182 ; 183 ; @version 184 ; $Id$ 185 ;- 186 FUNCTION get_cal_value, id, winfoid 187 ; 188 compile_opt strictarr, strictarrsubs 158 ; 159 ; @uses 160 ; 161 ; @restrictions 162 ; 163 ; @examples 164 ; 165 ; @history 166 ; 167 ; @version 168 ; $Id$ 169 ;- 170 FUNCTION get_cal_value, id, winfoid 171 ; 172 compile_opt strictarr, strictarrsubs 189 173 ; 190 174 winfo_id = widget_info(id, find_by_uname = 'infocal') … … 202 186 widget_control, wid_id, get_value = wid_value 203 187 allmonths = string(format = '(C(CMoA))', 31*(indgen(12))) 204 month = (where(allmonths EQ wid_value.combobox_gettext))[0] + 1 188 month = (where(allmonths EQ wid_value.combobox_gettext))[0] + 1 205 189 date = date + 100L * long(month) 206 190 ENDIF ELSE date = date + (oldate MOD 10000L)/100L*100L … … 224 208 ; @categories 225 209 ; Compound widget 226 ; 210 ; 227 211 ; @param EVENT 228 212 ; … … 235 219 ; 236 220 ; @returns 237 ; 238 ; 239 ; @uses 240 ; 241 ; 242 ; @restrictions 243 ; 244 ; 245 ; @examples 246 ; 247 ; 248 ; @history 249 ; 250 ; 251 ; @version 221 ; 222 ; @uses 223 ; 224 ; @restrictions 225 ; 226 ; @examples 227 ; 228 ; @history 229 ; 230 ; @version 252 231 ; $Id$ 253 232 ;- 254 233 PRO set_cal_combobox, event, casename, date0 255 234 ; 256 compile_opt strictarr, strictarrsubs 235 compile_opt strictarr, strictarrsubs 257 236 ; 258 237 ; casename: Which widget shall we move: 'day', 'month' or 'year' ? … … 269 248 ; index of days/months/years according to date0 270 249 case casename of 271 'day':BEGIN 250 'day':BEGIN 272 251 ; list of days corresponding to month0 and year0 273 252 index = where(monthcal EQ month0 AND yearcal EQ year0) 274 253 current = daycal[index] 275 254 END 276 'month':BEGIN 255 'month':BEGIN 277 256 ; list of months corresponding to year0 278 257 index = where(yearcal EQ year0) … … 283 262 current = current[indexbis] 284 263 END 285 'year':BEGIN 264 'year':BEGIN 286 265 ; keep only the uniq years 287 266 index = uniq(yearcal) … … 297 276 if casename EQ 'month' then begin 298 277 widget_control, wid_id, set_value = string(format = '(C(CMoA))', 31*(current-1)) 299 ENDIF ELSE BEGIN 278 ENDIF ELSE BEGIN 300 279 widget_control, wid_id, set_value = strtrim(current, 1) 301 280 ENDELSE … … 310 289 1:selected = 0 311 290 ; 2: a new date has been specified... 312 2:BEGIN 291 2:BEGIN 313 292 case casename of 314 293 'day':selected = (where(current EQ day0))[0] … … 325 304 end 326 305 ;---------------------------------------------------------------------- 327 ; move cyclic ly the calendar to the306 ; move cyclically the calendar to the 328 307 ; value 0 if event.out=1 or combobox_number-1 if event.out=-1 329 308 ;+ … … 333 312 ; @categories 334 313 ; Compound widget 335 ; 314 ; 336 315 ; @param EVENT 337 316 ; … … 341 320 ; 342 321 ; @returns 343 ; 344 ; 345 ; @uses 346 ; 347 ; 348 ; @restrictions 349 ; 350 ; 351 ; @examples 352 ; 353 ; 354 ; @history 355 ; 356 ; 357 ; @version 322 ; 323 ; @uses 324 ; 325 ; @restrictions 326 ; 327 ; @examples 328 ; 329 ; @history 330 ; 331 ; @version 358 332 ; $Id$ 359 333 ;- 360 334 PRO move, event, casename 361 335 ; 362 compile_opt strictarr, strictarrsubs 336 compile_opt strictarr, strictarrsubs 363 337 ; 364 338 possiblecase = ['day', 'month', 'year', 'impossiblecase'] … … 391 365 ; @categories 392 366 ; Compound widget 393 ; 367 ; 394 368 ; @param EVENT 395 369 ; 396 370 ; 397 371 ; @returns 398 ; 399 ; 400 ; @uses 401 ; 402 ; 403 ; @restrictions 404 ; 405 ; 406 ; @examples 407 ; 408 ; 409 ; @history 410 ; 411 ; 412 ; @version 372 ; 373 ; @uses 374 ; 375 ; @restrictions 376 ; 377 ; @examples 378 ; 379 ; @history 380 ; 381 ; @version 413 382 ; $Id$ 414 383 ;- … … 416 385 ; 417 386 @cm_4cal 418 compile_opt strictarr, strictarrsubs 387 compile_opt strictarr, strictarrsubs 419 388 ; 420 389 winfo_id = widget_info(event.handler, find_by_uname = 'infocal') … … 424 393 widget_control, event.id, get_uvalue = uval 425 394 ; high frequency calendar 426 IF uval.name EQ 'step' THEN BEGIN 395 IF uval.name EQ 'step' THEN BEGIN 427 396 infowid.date = jul2date(event.index + infowid.fakecal) 428 397 ENDIF ELSE BEGIN … … 434 403 ; we try to move the combobox just right, with name: possiblecase[whichcase+1] 435 404 if widget_info(event.handler, find_by_uname = possiblecase[whichcase+1]) EQ 0 then BEGIN 436 ; this widget do not exist we set cyclic ly the current widget to the405 ; this widget do not exist we set cyclically the current widget to the 437 406 ; value 0 if event.out=1 or combobox_number-1 if event.out=-1 438 407 widget_control, event.id, get_value = widvalue … … 451 420 ; we update the date 452 421 infowid = get_cal_value(event.handler, winfo_id) 453 ENDELSE 422 ENDELSE 454 423 ; 455 424 widget_control, winfo_id, set_uvalue = infowid … … 465 434 ; @categories 466 435 ; Compound widget 467 ; 436 ; 468 437 ; @param PARENT {in}{required} 469 438 ; The widget ID of the parent widget. … … 474 443 ; @param JDATE0 475 444 ; 476 ;477 445 ; @keyword CALTYPE 478 ; 479 ; 446 ; 480 447 ; @keyword FAKECAL 481 448 ; 482 ; 449 ; 483 450 ; @keyword UVALUE 484 451 ; 485 ;486 452 ; @keyword UNAME 487 453 ; 488 ; 454 ; 489 455 ; @keyword _EXTRA 490 456 ; Used to pass your keywords 491 ; 492 ; @returns 493 ; 494 ; 495 ; @uses 496 ; 497 ; 498 ; @restrictions 499 ; 500 ; 501 ; @examples 502 ; 503 ; 504 ; @history 505 ; 506 ; 507 ; @version 457 ; 458 ; @returns 459 ; 460 ; @uses 461 ; 462 ; @restrictions 463 ; 464 ; @examples 465 ; 466 ; @history 467 ; 468 ; @version 508 469 ; $Id$ 509 470 ; 510 471 ; @todo 511 472 ; seb 512 ; 473 ; 513 474 ;- 514 475 FUNCTION cw_calendar, parent, calendar, jdate0, CALTYPE = CALTYPE, FAKECAL = fakecal, UVALUE = uvalue, UNAME = uname, _extra = ex … … 516 477 @cm_4cal 517 478 ; 518 compile_opt strictarr, strictarrsubs 479 compile_opt strictarr, strictarrsubs 519 480 ; 520 481 if keyword_set(caltype) then key_caltype = caltype … … 547 508 , uvalue = {calendar:calendar, date:jul2date(jdate0), fakecal:fakecal, caltype: key_caltype}) 548 509 ; 549 IF keyword_set(fakecal) THEN BEGIN 510 IF keyword_set(fakecal) THEN BEGIN 550 511 cmbbid = cw_combobox_pm(base, UVALUE = {name:'step'}, UNAME = 'step' $ 551 512 , value = strtrim(indgen(n_elements(calendar)), 1)) 552 513 widget_control, cmbbid, set_value = {combobox_select:(where(calendar EQ jdate0))[0]} 553 ENDIF ELSE BEGIN 514 ENDIF ELSE BEGIN 554 515 ; 555 516 vallen = widget_info(base, string_size = 'm') -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_combobox_pm.pro
r157 r226 7 7 ; case uval of 8 8 ; 'done':widget_control, event.top, /destroy 9 ; 'dynamic_resize':BEGIN 9 ; 'dynamic_resize':BEGIN 10 10 ; widget_control, event.id, get_value = value 11 11 ; widget_control, ComboboxId, set_value = {dynamic_resize:value} 12 12 ; END 13 ; 'combobox_select':BEGIN 13 ; 'combobox_select':BEGIN 14 14 ; widget_control, event.id, get_value = value 15 15 ; widget_control, ComboboxId, set_value = {combobox_select:value} 16 16 ; END 17 ; 'value':BEGIN 17 ; 'value':BEGIN 18 18 ; widget_control, event.id, get_value = value 19 19 ; widget_control, ComboboxId, set_value = value 20 20 ; END 21 ; 'get':BEGIN 21 ; 'get':BEGIN 22 22 ; widget_control, ComboboxId, get_value = value 23 23 ; help, value, /struct … … 52 52 ; @categories 53 53 ; Compound widget 54 ; 54 ; 55 55 ; @param ID 56 56 ; … … 60 60 ; 61 61 ; @returns 62 ; 63 ; 62 ; 64 63 ; @uses 65 ; 66 ; 64 ; 67 65 ; @restrictions 68 ; 69 ; 66 ; 70 67 ; @examples 71 ; 72 ; 68 ; 73 69 ; @history 74 ; 75 ; 76 ; @version 70 ; 71 ; @version 77 72 ; $Id$ 78 73 ;- … … 104 99 ; @categories 105 100 ; Compound widget 106 ; 101 ; 107 102 ; @param ID 108 103 ; 109 ;110 104 ; @returns 111 ; 112 ; 105 ; 113 106 ; @uses 114 ; 115 ; 107 ; 116 108 ; @restrictions 117 ; 118 ; 109 ; 119 110 ; @examples 120 ; 121 ; 111 ; 122 112 ; @history 123 ; 124 ; 125 ; @version 113 ; 114 ; @version 126 115 ; $Id$ 127 116 ;- … … 147 136 ; @categories 148 137 ; Compound widget 149 ; 138 ; 150 139 ; @param EVENT 151 140 ; 152 ;153 141 ; @returns 154 ; 155 ; 142 ; 156 143 ; @uses 157 ; 158 ; 144 ; 159 145 ; @restrictions 160 ; 161 ; 146 ; 162 147 ; @examples 163 ; 164 ; 148 ; 165 149 ; @history 166 ; 167 ; 168 ; @version 150 ; 151 ; @version 169 152 ; $Id$ 170 153 ;- … … 187 170 case uval OF 188 171 'plus':BEGIN 189 if index LT (cmbbnumb - 1) then BEGIN 172 if index LT (cmbbnumb - 1) then BEGIN 190 173 index = index + 1 191 174 widget_control, ComboboxId, set_combobox_select = index … … 193 176 END 194 177 'minus':BEGIN 195 if index GT 0 then BEGIN 178 if index GT 0 then BEGIN 196 179 index = index - 1 197 180 widget_control, ComboboxId, set_combobox_select = index … … 212 195 ; @categories 213 196 ; Compound widget 214 ; 197 ; 215 198 ; @param PARENT {in}{required} 216 199 ; The widget ID of the parent widget. … … 219 202 ; Buttons will be arranged in the number of columns 220 203 ; specified by this keyword. 221 ; 204 ; 222 205 ; @keyword ROW 223 206 ; Buttons will be arranged in the number of rows 224 207 ; specified by this keyword. 225 ; 208 ; 226 209 ; @keyword UVALUE 227 210 ; The user value to be associated with the widget. 228 ; 211 ; 229 212 ; @keyword UNAME 230 213 ; The user name to be associated with the widget. 231 ; 214 ; 232 215 ; @keyword VALUE 233 216 ; … … 258 241 ; index the array of names originally used to set the widget''s 259 242 ; value 260 ; OUT:It is an integer which can take 3 values: 243 ; OUT:It is an integer which can take 3 values: 261 244 ; 1 : If we press + when the index is already at the max 262 245 ; Comment: In this case, the index stay at the max … … 271 254 ; 1) GET_VALUE 272 255 ; widget_control,wid_id,get_value=resultat 273 ; Send back, in the result variable, a structure of 3 elements whose 256 ; Send back, in the result variable, a structure of 3 elements whose 274 257 ; names are inspired by keywords we can pass at widget_control when 275 258 ; we use WIDGET_COMBOBOX: … … 285 268 ; 2) SET_VALUE 286 269 ; widget_control,wid_id,set_value=impose 287 ; Allows to modify the state of the combobox like we can do it for 288 ; WIDGET_COMBOBOX. May impose: 270 ; Allows to modify the state of the combobox like we can do it for 271 ; WIDGET_COMBOBOX. May impose: 289 272 ; a) The contents of the list widget (string or string array) 290 ; b) A structure which can have for elements (from 1 to 3): 273 ; b) A structure which can have for elements (from 1 to 3): 291 274 ; DYNAMIC_RESIZE:Set this keyword to activate (if set to 1) 292 275 ; or deactivate (if set to 0) dynamic resizing of the … … 323 306 IF (N_PARAMS() NE 1) THEN MESSAGE, 'Incorrect number of arguments' 324 307 ON_ERROR, 2 ;return to caller 325 ; che king for row and column keywords326 row = keyword_set(row)*(1-keyword_set(column)) 327 column = keyword_set(column)*(1-keyword_set(row))+(keyword_set(column) EQ row) 308 ; checking for row and column keywords 309 row = keyword_set(row)*(1-keyword_set(column)) 310 column = keyword_set(column)*(1-keyword_set(row))+(keyword_set(column) EQ row) 328 311 if NOT keyword_set(uvalue) then uvalue = '' 329 312 if NOT keyword_set(uname) then uname = '' … … 333 316 , FUNC_GET_VALUE='cw_combobox_pm_get_value' $ 334 317 , PRO_SET_VALUE='cw_combobox_pm_set_value' $ 335 , UVALUE = uvalue, UNAME = uname, _extra = ex) 318 , UVALUE = uvalue, UNAME = uname, _extra = ex) 336 319 ; 337 320 vallen = widget_info(base, string_size = 'm') 338 321 vallen = 35 + (vallen[0]-1)*max(strlen(value)) 339 if keyword_set(row) THEN BEGIN 322 if keyword_set(row) THEN BEGIN 340 323 nothing = widget_button(base, value = '-', uvalue = 'minus', xoffset = 0 $ 341 324 , yoffset = 5, xsize = 15, ysize = 15) … … 345 328 , xoffset = vallen+11, yoffset = 5 $ 346 329 , xsize = 15, ysize = 15) 347 ENDIF ELSE BEGIN 330 ENDIF ELSE BEGIN 348 331 nothing = widget_combobox(base, VALUE = value, UVALUE = 'Combobox', UNAME = 'Combobox' $ 349 332 , xoffset = 0, yoffset = 0, xsize = vallen) … … 354 337 , xoffset = vallen/2 $ 355 338 , yoffset = 24, xsize = 15, ysize = 15) 356 ENDELSE 339 ENDELSE 357 340 ; 358 341 ; widget_control,base,/realize -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro
r172 r226 12 12 ; widget_control, Id, set_value = boxzoom 13 13 ; END 14 ; 'get':BEGIN 14 ; 'get':BEGIN 15 15 ; widget_control, Id, get_value = value 16 16 ; print, value … … 45 45 ; @categories 46 46 ; Compound widget 47 ; 47 ; 48 48 ; @param ID 49 49 ; … … 53 53 ; 54 54 ; @returns 55 ; 56 ; 55 ; 57 56 ; @uses 58 ; 59 ; 57 ; 60 58 ; @restrictions 61 ; 62 ; 59 ; 63 60 ; @examples 64 ; 65 ; 61 ; 66 62 ; @history 67 ; 68 ; 69 ; @version 63 ; 64 ; @version 70 65 ; $Id$ 71 66 ;- … … 86 81 ; What is the type of boxzoom ? 87 82 currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1 88 options = extractatt(top_uvalue, 'options') 83 options = extractatt(top_uvalue, 'options') 89 84 flags = extractatt(top_uvalue, 'optionsflag') 90 85 flags = flags[*, currentplot] … … 119 114 Case N_Elements(Value) OF 120 115 0:boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2] 121 1:BEGIN 116 1:BEGIN 122 117 if value EQ -1 then boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2] $ 123 118 ELSE boxzoom=[lonn1, lonn2, latt1, latt2, 0.,value[0]] … … 127 122 5:boxzoom=[Value[0:3], 0, Value[4]] 128 123 6:boxzoom = Value 129 Else:BEGIN 124 Else:BEGIN 130 125 rien = report('Wrong Definition of Boxzoom') 131 126 END … … 151 146 min = floor(min([glamt,glamf], max = max)) 152 147 max = ceil(max) 153 ENDIF ELSE BEGIN 148 ENDIF ELSE BEGIN 154 149 min = 0 155 150 max = jpi-1 … … 195 190 min = floor(min([gphit,gphif], max = max)) 196 191 max = ceil(max) 197 ENDIF ELSE BEGIN 192 ENDIF ELSE BEGIN 198 193 min = 0 199 194 max = jpj-1 … … 250 245 widget_control, dthlv2id, set_value = {value:strtrim(gdep2, 1)} 251 246 ENDIF ELSE gdep2 = gdep1+1 252 ; We make sure that given depth es containat least one level.247 ; We make sure that given depths contains at least one level. 253 248 if boxzoom[4] GT boxzoom[5] then begin 254 249 rien = boxzoom[4] … … 256 251 boxzoom[5] = rien 257 252 endif 258 ; 253 ; 259 254 rien = where(gdep1 LT boxzoom[4], indice1) 260 255 indice1 = indice1 < (jpk-1) … … 279 274 widget_control, depth1id, set_value = {slider_min:min1, slider_max:max1, value:boxzoom[4]} 280 275 min2 = gdep2[indice1] 281 if indice2 EQ jpk-1 then BEGIN 276 if indice2 EQ jpk-1 then BEGIN 282 277 max2 = max([gdept, gdepw]) 283 278 max2 = strtrim(string(max2,format='(e8.0)'), 1) … … 295 290 ; @categories 296 291 ; Compound widget 297 ; 292 ; 298 293 ; @param ID 299 294 ; 300 295 ; 301 296 ; @returns 302 ; 303 ; 297 ; 304 298 ; @uses 305 ; 306 ; 299 ; 307 300 ; @restrictions 308 ; 309 ; 301 ; 310 302 ; @examples 311 ; 312 ; 303 ; 313 304 ; @history 314 ; 315 ; 316 ; @version 305 ; 306 ; @version 317 307 ; $Id$ 318 308 ;- … … 337 327 ; @categories 338 328 ; Compound widget 339 ; 329 ; 340 330 ; @param EVENT 341 331 ; 342 332 ; 343 333 ; @returns 344 ; 345 ; 334 ; 346 335 ; @uses 347 ; 348 ; 336 ; 349 337 ; @restrictions 350 ; 351 ; 338 ; 352 339 ; @examples 353 ; 354 ; 340 ; 355 341 ; @history 356 ; 357 ; 358 ; @version 342 ; 343 ; @version 359 344 ; $Id$ 360 345 ;- … … 408 393 widget_control, dthlv2id, set_value = {combobox_select:event.index} 409 394 ; So we redefine the value and the max of the slider 2 410 if event.index EQ jpk-1 then BEGIN 395 if event.index EQ jpk-1 then BEGIN 411 396 max = max([gdept, gdepw]) 412 397 max = strtrim(string(max,format='(e8.0)'), 1) … … 417 402 ; So we redefine the max of the slider 1 418 403 widget_control, depth1id, set_value = {slider_max:gdep1[event.index]} 419 END 420 ; We redefine the value and the min of the slider depth1 404 END 405 ; We redefine the value and the min of the slider depth1 421 406 if event.index EQ 0 then min = 0 ELSE min = gdep1[event.index-1]+1 422 407 widget_control, depth1id, set_value = {slider_min:min, value:gdep1[event.index]} … … 443 428 ; Se we redefine the min of the slider 2 444 429 widget_control, depth2id, set_value = {slider_min:gdep2[event.index]} 445 END 430 END 446 431 ; We redefine the value and the max of the slider depth 2 447 if event.index EQ jpk-1 then BEGIN 432 if event.index EQ jpk-1 then BEGIN 448 433 max = max([gdept, gdepw]) 449 434 max = strtrim(string(max,format='(e8.0)'), 1) … … 488 473 widget_control, dthlv2id, set_value = {combobox_select:indice} 489 474 ; So we redefine the min of the slider 2 490 if indice EQ jpk-1 then BEGIN 475 if indice EQ jpk-1 then BEGIN 491 476 max = max([gdept, gdepw]) 492 477 max = strtrim(string(max,format='(e8.0)'), 1) … … 510 495 ; @categories 511 496 ; Compound widget 512 ; 497 ; 513 498 ; @param PARENT {in}{required} 514 499 ; The widget ID of the parent widget. 515 ; 500 ; 516 501 ; @keyword UVALUE 517 502 ; The user value to be associated with the widget. 518 ; 503 ; 519 504 ; @keyword UNAME 520 505 ; The user name to be associated with the widget. 521 ; 506 ; 522 507 ; @keyword STRICT 523 508 ; … … 527 512 ; 528 513 ; @keyword BOXZOOM 529 ; Vector indicating the geographic zone on which we want to cut the map. 530 ; If BOXZOOM has : 514 ; Vector indicating the geographic zone on which we want to cut the map. 515 ; If BOXZOOM has : 531 516 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 532 517 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 533 518 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 534 519 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 535 ; 6 elements: The extraction is made on Boxzoom 520 ; 6 elements: The extraction is made on Boxzoom 536 521 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 537 522 ; 538 523 ; @keyword _EXTRA 539 524 ; Used to pass your keywords 540 ; 525 ; 541 526 ; @returns 542 ; 543 ; 527 ; 544 528 ; @uses 545 ; 546 ; 529 ; 547 530 ; @restrictions 548 ; 549 ; 531 ; 550 532 ; @examples 551 ; 552 ; 533 ; 553 534 ; @history 554 ; 555 ; 556 ; @version 535 ; 536 ; @version 557 537 ; $Id$ 558 538 ; 559 539 ; @todo 560 540 ; seb: Documenter 561 ; 541 ; 562 542 ;- 563 543 FUNCTION cw_domain, parent, BOXZOOM = boxzoom, STRICT = strict, UVALUE = uvalue, UNAME = uname, UNZOOM = unzoom, _extra = ex … … 596 576 , FUNC_GET_VALUE = 'cw_domain_get_value' $ 597 577 , PRO_SET_VALUE = 'cw_domain_set_value' $ 598 , UVALUE = uvalue, UNAME = uname, _extra = ex) 578 , UVALUE = uvalue, UNAME = uname, _extra = ex) 599 579 ;------------------------------------------------ 600 580 baseh = widget_base(base, column = 1+keyword_set(unzoom), space = 0) -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_droplist_pm.pro
r157 r226 6 6 ; case uval of 7 7 ; 'done':widget_control, event.top, /destroy 8 ; 'dynamic_resize':BEGIN 8 ; 'dynamic_resize':BEGIN 9 9 ; widget_control, event.id, get_value = value 10 10 ; widget_control, DroplistId, set_value = {dynamic_resize:value} 11 11 ; END 12 ; 'droplist_select':BEGIN 12 ; 'droplist_select':BEGIN 13 13 ; widget_control, event.id, get_value = value 14 14 ; widget_control, DroplistId, set_value = {droplist_select:value} 15 15 ; END 16 ; 'value':BEGIN 16 ; 'value':BEGIN 17 17 ; widget_control, event.id, get_value = value 18 18 ; widget_control, DroplistId, set_value = value 19 19 ; END 20 ; 'get':BEGIN 20 ; 'get':BEGIN 21 21 ; widget_control, DroplistId, get_value = value 22 22 ; help, value, /struct … … 54 54 ; @categories 55 55 ; Compound widget 56 ; 56 ; 57 57 ; @param ID 58 ;59 58 ; 60 59 ; @param VALUE … … 62 61 ; 63 62 ; @returns 64 ; 65 ; 63 ; 66 64 ; @uses 67 ; 68 ; 65 ; 69 66 ; @restrictions 70 ; 71 ; 67 ; 72 68 ; @examples 73 ; 74 ; 69 ; 75 70 ; @history 76 ; 77 ; 78 ; @version 71 ; 72 ; @version 79 73 ; $Id$ 80 74 ;- … … 104 98 ; @categories 105 99 ; Compound widget 106 ; 100 ; 107 101 ; @param ID 108 102 ; 109 103 ; @returns 110 ; 111 ; 104 ; 112 105 ; @uses 113 ; 114 ; 106 ; 115 107 ; @restrictions 116 ; 117 ; 108 ; 118 109 ; @examples 119 ; 120 ; 110 ; 121 111 ; @history 122 ; 123 ; 124 ; @version 112 ; 113 ; @version 125 114 ; $Id$ 126 115 ;- … … 141 130 ; @categories 142 131 ; Compound widget 143 ; 132 ; 144 133 ; @param EVENT 145 134 ; 146 ;147 135 ; @returns 148 ; 149 ; 136 ; 150 137 ; @uses 151 ; 152 ; 138 ; 153 139 ; @restrictions 154 ; 155 ; 140 ; 156 141 ; @examples 157 ; 158 ; 142 ; 159 143 ; @history 160 ; 161 ; 162 ; @version 144 ; 145 ; @version 163 146 ; $Id$ 164 147 ;- … … 200 183 ; @categories 201 184 ; Compound widget 202 ; 185 ; 203 186 ; @param PARENT {in}{required} 204 187 ; The widget ID of the parent widget. … … 207 190 ; Buttons will be arranged in the number of columns 208 191 ; specified by this keyword. 209 ; 192 ; 210 193 ; @keyword ROW 211 194 ; Buttons will be arranged in the number of rows 212 195 ; specified by this keyword. 213 ; 196 ; 214 197 ; @keyword UVALUE 215 198 ; The user value to be associated with the widget. 216 ; 199 ; 217 200 ; @keyword UNAME 218 201 ; The user name to be associated with the widget. 219 ; 202 ; 220 203 ; @keyword _EXTRA 221 204 ; Used to pass your keywords … … 243 226 ; index the array of names originally used to set the widget''s 244 227 ; value 245 ; OUT:It is an integer which can take 3 values: 228 ; OUT:It is an integer which can take 3 values: 246 229 ; 1 : If we press + when the index is already at the max 247 230 ; Comment: In this case, the index stay at the max … … 256 239 ; 1) GET_VALUE 257 240 ; widget_control,wid_id,get_value=resultat 258 ; Send back, in the result variable, a structure of 3 elements whose 241 ; Send back, in the result variable, a structure of 3 elements whose 259 242 ; names are inspired by keywords we can pass at widget_control when 260 243 ; we use WIDGET_COMBOBOX: … … 273 256 ; pour WIDGET_DROPLIST Impose peut etre: 274 257 ; a) The contents of the list widget (string or string array) 275 ; b) A structure which can have for elements (from 1 to 3): 258 ; b) A structure which can have for elements (from 1 to 3): 276 259 ; DYNAMIC_RESIZE:Set this keyword to activate (if set to 1) 277 260 ; or deactivate (if set to 0) dynamic resizing of the … … 308 291 IF (N_PARAMS() NE 1) THEN MESSAGE, 'Incorrect number of arguments' 309 292 ON_ERROR, 2 ;return to caller 310 ; che king for row and column keywords311 row = keyword_set(row)*(1-keyword_set(column)) 312 column = keyword_set(column)*(1-keyword_set(row))+(keyword_set(column) EQ row) 293 ; checking for row and column keywords 294 row = keyword_set(row)*(1-keyword_set(column)) 295 column = keyword_set(column)*(1-keyword_set(row))+(keyword_set(column) EQ row) 313 296 if NOT keyword_set(uvalue) then uvalue = '' 314 297 if NOT keyword_set(uname) then uname = '' … … 318 301 , FUNC_GET_VALUE='cw_droplist_pm_get_value' $ 319 302 , PRO_SET_VALUE='cw_droplist_pm_set_value' $ 320 , UVALUE = uvalue, UNAME = uname, _extra = ex) 303 , UVALUE = uvalue, UNAME = uname, _extra = ex) 321 304 ; 322 305 if keyword_set(row) THEN nothing = widget_button(base,value= '-', uvalue= 'minus') -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_slide_slice.pro
r157 r226 5 5 ; @categories 6 6 ; Compound widget 7 ; 7 ; 8 8 ; @param ID 9 ;10 9 ; 11 10 ; @param VALUE … … 13 12 ; 14 13 ; @returns 15 ; 16 ; 14 ; 17 15 ; @uses 18 ; 19 ; 16 ; 20 17 ; @restrictions 21 ; 22 ; 18 ; 23 19 ; @examples 24 ; 25 ; 20 ; 26 21 ; @history 27 ; 28 ; 29 ; @version 22 ; 23 ; @version 30 24 ; $Id$ 31 25 ;- … … 49 43 widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:boxzoom[0]<maxi} 50 44 thickness = boxzoom[1]-boxzoom[0] 51 ENDIF ELSE BEGIN 45 ENDIF ELSE BEGIN 52 46 mini = floor(min([gphit, gphif], max = maxi)) 53 47 maxi = ceil(maxi)-thickness … … 57 51 thicknessval = thicknessuval.choix 58 52 index = where(thicknessval EQ thickness) & index = index[0] 59 if index EQ -1 then BEGIN 53 if index EQ -1 then BEGIN 60 54 index = 20 61 55 thicknessval[20] = strtrim(thickness, 1) … … 73 67 ; @categories 74 68 ; Compound widget 75 ; 69 ; 76 70 ; @param EVENT 77 71 ; 78 ;79 72 ; @returns 80 ; 81 ; 73 ; 82 74 ; @uses 83 ; 84 ; 75 ; 85 76 ; @restrictions 86 ; 87 ; 77 ; 88 78 ; @examples 89 ; 90 ; 79 ; 91 80 ; @history 92 ; 93 ; 94 ; @version 81 ; 82 ; @version 95 83 ; $Id$ 96 84 ;- … … 117 105 mini = floor(min([glamt, glamf], max = maxi)) 118 106 maxi = ceil(maxi)-thickness 119 ENDIF ELSE BEGIN 107 ENDIF ELSE BEGIN 120 108 mini = floor(min([gphit, gphif], max = maxi)) 121 109 maxi = ceil(maxi)-thickness … … 136 124 ; print, lon1, mini, maxi 137 125 ; widget_control, sliderid, set_value = {value:lon1, slider_min_max:[mini, maxi]} 138 ; ENDIF ELSE BEGIN 126 ; ENDIF ELSE BEGIN 139 127 ; mini = floor(min([gphit, glamf], max = maxi)) 140 128 ; maxi = ceil(maxi) … … 145 133 ; print, 'ds if',firstxt, 0, jpi-1 146 134 ; widget_control, sliderid, set_value = {value:firstxt, slider_min_max:[0, jpi-1]} 147 ; ENDIF ELSE BEGIN 135 ; ENDIF ELSE BEGIN 148 136 ; widget_control, sliderid, set_value = {value:firstyt, slider_min_max:[0, jpj-1]} 149 137 ; ENDELSE … … 154 142 if type EQ 'y' then begin 155 143 boxzoom[0] = slider & boxzoom[1] = slider+thickness 156 ENDIF ELSE BEGIN 144 ENDIF ELSE BEGIN 157 145 boxzoom[2] = slider & boxzoom[3] = slider+thickness 158 ENDELSE 146 ENDELSE 159 147 ; ENDIF ELSE BEGIN 160 148 ; if strpos(type,'y') NE -1 then begin 161 149 ; boxzoom[0] = glamt[slider, 0] & boxzoom[1] = glamf[slider+thickness, 0] 162 ; ENDIF ELSE BEGIN 150 ; ENDIF ELSE BEGIN 163 151 ; boxzoom[2] = gphit[0, slider] & boxzoom[3] = gphif[0, slider+thickness] 164 ; ENDELSE 152 ; ENDELSE 165 153 ; ENDELSE 166 154 widget_control, domainid, set_value = boxzoom … … 179 167 ; 180 168 ; @keyword BOXZOOM 181 ; Vector indicating the geographic zone on which we want to cut the map. 182 ; If BOXZOOM has : 169 ; Vector indicating the geographic zone on which we want to cut the map. 170 ; If BOXZOOM has : 183 171 ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] 184 172 ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] 185 173 ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] 186 174 ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] 187 ; 6 elements: The extraction is made on Boxzoom 175 ; 6 elements: The extraction is made on Boxzoom 188 176 ; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef! 189 177 ; … … 191 179 ; Buttons will be arranged in the number of columns 192 180 ; specified by this keyword. 193 ; 181 ; 194 182 ; @keyword FRAME 195 183 ; Specifies the width of the frame to be drawn around the base. 196 ; 184 ; 197 185 ; @keyword ROW 198 186 ; Buttons will be arranged in the number of rows 199 187 ; specified by this keyword. 200 ; 188 ; 201 189 ; @keyword UVALUE 202 190 ; The user value to be associated with the widget. 203 ; 191 ; 204 192 ; @keyword UNAME 205 193 ; The user name to be associated with the widget. 206 ; 194 ; 207 195 ; @keyword _EXTRA 208 196 ; Used to pass your keywords 209 ; 197 ; 210 198 ; @returns 211 ; 212 ; 199 ; 213 200 ; @uses 214 ; 215 ; 201 ; 216 202 ; @restrictions 217 ; 218 ; 203 ; 219 204 ; @examples 220 ; 221 ; 205 ; 222 206 ; @history 223 ; 224 ; 225 ; @version 207 ; 208 ; @version 226 209 ; $Id$ 227 ; 210 ; 228 211 ; @todo 229 212 ; seb: documenter … … 236 219 @common 237 220 ;------------------------------------------------ 238 ; che king exclusive keywords221 ; checking exclusive keywords 239 222 column = keyword_set(column)*(1-keyword_set(row)) 240 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 223 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 241 224 if NOT keyword_set(uvalue) then uvalue = '' 242 225 if NOT keyword_set(uname) then uname = '' … … 247 230 , PRO_SET_VALUE='cw_slide_slice_set_value' $ 248 231 , ROW = row, COLUMN = column, UVALUE = uvalue, UNAME = uname $ 249 , FRAME = frame, _extra = ex) 232 , FRAME = frame, _extra = ex) 250 233 ;------------------------------------------------ 251 234 if NOT keyword_set(boxzoom) then boxzoom = [lon1, lon2, lat1, lat2] … … 264 247 , value = mini > boxzoom[0] < maxi, /column, uname = 'slider' $ 265 248 , uvalue = {name:'slider'}) 266 ENDIF ELSE BEGIN 249 ENDIF ELSE BEGIN 267 250 mini = floor(min([gphit, gphif], max = maxi)) 268 251 thickness = boxzoom[3]-boxzoom[2] … … 273 256 ENDELSE 274 257 index = where(thicknessval EQ thickness) & index = index[0] 275 if index EQ -1 then BEGIN 258 if index EQ -1 then BEGIN 276 259 index = 20 277 260 thicknessval[20] = strtrim(thickness, 1) … … 280 263 endif 281 264 widget_control, droplistid, set_value = {droplist_select:index} 282 265 283 266 ; if type EQ 'xt' then begin 284 267 ; mini = floor(min([glamt,glamf], max = maxi)) 285 268 ; maxi = ceil(maxi) 286 ; ENDIF ELSE BEGIN 269 ; ENDIF ELSE BEGIN 287 270 ; mini = floor(min([gphit,gphif], max = maxi)) 288 271 ; maxi = ceil(maxi) 289 272 ; ENDELSE 290 273 291 274 ;------------------------------------------------ 292 275 return, base -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_slider_pm.pro
r163 r226 6 6 ; case uval of 7 7 ; 'done':widget_control, event.top, /destroy 8 ; 'slider_min':BEGIN 8 ; 'slider_min':BEGIN 9 9 ; widget_control, event.id, get_value = value 10 10 ; widget_control, SliderBarId, set_value = {slider_min:value} 11 11 ; END 12 ; 'slider_max':BEGIN 12 ; 'slider_max':BEGIN 13 13 ; widget_control, event.id, get_value = value 14 14 ; widget_control, SliderBarId, set_value = {slider_max:value} 15 15 ; END 16 ; 'slider_value':BEGIN 16 ; 'slider_value':BEGIN 17 17 ; widget_control, event.id, get_value = value 18 18 ; widget_control, SliderBarId, set_value = value 19 19 ; END 20 ; 'get':BEGIN 20 ; 'get':BEGIN 21 21 ; widget_control, SliderBarId, get_value = value 22 22 ; help, value, /struct … … 57 57 ; 58 58 ; @returns 59 ; 60 ; 59 ; 61 60 ; @uses 62 ; 63 ; 64 ; @restrictions 65 ; 66 ; 67 ; @examples 68 ; 69 ; 70 ; @history 71 ; 72 ; 73 ; @version 61 ; 62 ; @restrictions 63 ; 64 ; @examples 65 ; 66 ; @history 67 ; 68 ; @version 74 69 ; $Id$ 75 70 ;- … … 93 88 ; 94 89 ; @returns 95 ; 96 ; 90 ; 97 91 ; @uses 98 ; 99 ; 100 ; @restrictions 101 ; 102 ; 103 ; @examples 104 ; 105 ; 106 ; @history 107 ; 108 ; 109 ; @version 92 ; 93 ; @restrictions 94 ; 95 ; @examples 96 ; 97 ; @history 98 ; 99 ; @version 110 100 ; $Id$ 111 101 ;- … … 124 114 ; @categories 125 115 ; Compound widget 126 ; 116 ; 127 117 ; @param ID 128 ;129 118 ; 130 119 ; @param VALUE … … 132 121 ; 133 122 ; @returns 134 ; 135 ; 123 ; 136 124 ; @uses 137 ; 138 ; 139 ; @restrictions 140 ; 141 ; 142 ; @examples 143 ; 144 ; 145 ; @history 146 ; 147 ; 148 ; @version 125 ; 126 ; @restrictions 127 ; 128 ; @examples 129 ; 130 ; @history 131 ; 132 ; @version 149 133 ; $Id$ 150 134 ;- … … 161 145 case strtrim(strlowcase(tagnames[tag]), 2) of 162 146 'slider_min':BEGIN 163 ; IF float(value.slider_min[0]) LT minmax[1] THEN BEGIN 147 ; IF float(value.slider_min[0]) LT minmax[1] THEN BEGIN 164 148 minmax[0] = value.slider_min[0] 165 149 widget_control, sbid, set_slider_min = floor(float(value.slider_min[0])) … … 169 153 widget_control, dcid, set_value = decvalue(value.slider_min) 170 154 widget_control, dcid, set_combobox_select = decind(value.slider_min) 171 ENDIF 172 ; ENDIF 155 ENDIF 156 ; ENDIF 173 157 end 174 158 'slider_max':BEGIN 175 ; IF float(value.slider_max[0]) GT minmax[0] THEN BEGIN 159 ; IF float(value.slider_max[0]) GT minmax[0] THEN BEGIN 176 160 minmax[1] = value.slider_max[0] 177 161 widget_control, sbid, set_slider_max = ceil(float(value.slider_max[0])) … … 181 165 widget_control, dcid, set_value = decvalue(value.slider_max) 182 166 widget_control, dcid, set_combobox_select = decind(value.slider_max) 183 ENDIF 184 ; ENDIF 167 ENDIF 168 ; ENDIF 185 169 end 186 170 'value':IF float(value.value[0]) GE minmax[0] $ … … 189 173 endcase 190 174 endfor 191 ENDIF ELSE BEGIN 175 ENDIF ELSE BEGIN 192 176 IF float(value[0]) GE minmax[0] $ 193 177 AND float(value[0]) LE minmax[1] THEN value2 = float(value[0]) 194 178 ENDELSE 195 IF n_elements(value2) NE 0 THEN BEGIN 179 IF n_elements(value2) NE 0 THEN BEGIN 196 180 widget_control, sbid, set_value = fix(value2) 197 181 widget_control, dcid, set_value = decvalue(value2) 198 182 widget_control, dcid, set_combobox_select = decind(value2) 199 ENDIF 183 ENDIF 200 184 return 201 185 end … … 206 190 ; 207 191 ; @categories 208 ; Compound widget 209 ; 192 ; Compound widget 193 ; 210 194 ; @param ID 211 195 ; 212 ; 213 ; @returns 214 ; 215 ; 196 ; @returns 197 ; 216 198 ; @uses 217 ; 218 ; 219 ; @restrictions 220 ; 221 ; 222 ; @examples 223 ; 224 ; 225 ; @history 226 ; 227 ; 228 ; @version 199 ; 200 ; @restrictions 201 ; 202 ; @examples 203 ; 204 ; @history 205 ; 206 ; @version 229 207 ; $Id$ 230 208 ;- … … 246 224 ; @categories 247 225 ; Compound widget 248 ; 226 ; 249 227 ; @param EVENT 250 ; 251 ; 252 ; @returns 253 ; 254 ; 228 ; 229 ; @returns 230 ; 255 231 ; @uses 256 ; 257 ; 258 ; @restrictions 259 ; 260 ; 261 ; @examples 262 ; 263 ; 264 ; @history 265 ; 266 ; 267 ; @version 232 ; 233 ; @restrictions 234 ; 235 ; @examples 236 ; 237 ; @history 238 ; 239 ; @version 268 240 ; $Id$ 269 241 ;- … … 284 256 'minus':if (value - 1) GE minmax[0] then value2 = value - 1 ELSE out = -1 285 257 'SliderBar':if (event.value + value - floor(value)) LE minmax[1] THEN value2 = event.value + value - floor(value) 286 'decimal':BEGIN 258 'decimal':BEGIN 287 259 CASE 1 OF 288 260 value GT minmax[1]: value2 = minmax[1] … … 313 285 ; @categories 314 286 ; Compound widget 315 ; 287 ; 316 288 ; @param PARENT {in}{required} 317 289 ; The widget ID of the parent widget. … … 319 291 ; @keyword UVALUE 320 292 ; The user value to be associated with the widget. 321 ; 293 ; 322 294 ; @keyword UNAME 323 295 ; The user name to be associated with the widget. 324 ; 296 ; 325 297 ; @keyword VALUE 326 298 ; 327 ;328 299 ; @keyword MAXIMUM 329 ; 330 ; 300 ; 331 301 ; @keyword MINIMUM 332 302 ; 333 ; 303 ; 334 304 ; @keyword STRMINLEN 335 305 ; … … 365 335 ; computationally expensive operations until the user releases the 366 336 ; slider. 367 ; OUT:It is an integer which can take 3 values: 337 ; OUT:It is an integer which can take 3 values: 368 338 ; 1 : If we press + when the index is already at the max 369 339 ; Comment: In this case, the index stay at the max … … 378 348 ; 1) GET_VALUE 379 349 ; widget_control,wid_id,get_value=resultat 380 ; Send back in the result variable a structure of 2 elements whose name 381 ; are inspired from keywords we can pass at 350 ; Send back in the result variable a structure of 2 elements whose name 351 ; are inspired from keywords we can pass at 382 352 ; widget_control when we use WIDGET_SLIDER: 383 353 ; VALUE:the value setting of the widget … … 386 356 ; 2) SET_VALUE 387 357 ; widget_control,wid_id,set_value=impose 388 ; Allows to modify the state of the combobox like we can do it for 389 ; WIDGET_COMBOBOX. May impose: 358 ; Allows to modify the state of the combobox like we can do it for 359 ; WIDGET_COMBOBOX. May impose: 390 360 ; a) a integer: give the new position of the slider. 391 ; b) A structure which can have for elements (from 1 to 3): 361 ; b) A structure which can have for elements (from 1 to 3): 392 362 ; VALUE: an integer which give the new position of the slider 393 363 ; SLIDER_MIN:Set to a new minimum value for the specified … … 428 398 if NOT keyword_set(title) then title = ' ' 429 399 ; 430 ; che king exclusive keywords400 ; checking exclusive keywords 431 401 column = (keyword_set(column)*(1-keyword_set(row))+keyword_set(vertical)) < 1 432 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 402 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 433 403 if NOT keyword_set(uvalue) then uvalue = '' 434 404 if NOT keyword_set(uname) then uname = '' … … 437 407 , FUNC_GET_VALUE = 'cw_slider_pm_get_value' $ 438 408 , PRO_SET_VALUE = 'cw_slider_pm_set_value' $ 439 , space = 0, UVALUE = uvalue, UNAME = uname, _extra = ex) 409 , space = 0, UVALUE = uvalue, UNAME = uname, _extra = ex) 440 410 ; 441 411 mlen = (widget_info(base, string_size = 'm'))[0] -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_specifie.pro
r157 r226 6 6 ; @categories 7 7 ; Compound widget 8 ; 8 ; 9 9 ; @param ID 10 ;11 10 ; 12 11 ; @param VALUE … … 14 13 ; 15 14 ; @returns 16 ; 17 ; 18 ; @uses 19 ; 20 ; 21 ; @restrictions 22 ; 23 ; 24 ; @examples 25 ; 26 ; 27 ; @history 28 ; 29 ; 30 ; @version 31 ; $Id$ 32 ;- 33 ;***************************************************** 15 ; 16 ; @uses 17 ; 18 ; @restrictions 19 ; 20 ; @examples 21 ; 22 ; @history 23 ; 24 ; @version 25 ; $Id$ 26 ;- 34 27 PRO cw_specifie_set_value, id, value 35 28 ; … … 43 36 widget_control, widget_info(id,find_by_uname='palnum'), set_value = strtrim(value.lct, 2) 44 37 autres = extractstru(value, ['min', 'max', 'inter', 'lct', 'nothing', 'xindex', 'yindex']) 45 if size(autres, /type) EQ 8 then BEGIN 38 if size(autres, /type) EQ 8 then BEGIN 46 39 autresid = widget_info(id,find_by_uname='autres') 47 40 widget_control, widget_info(id, find_by_uname = 'autres'), get_value = autresautres … … 64 57 ; @categories 65 58 ; Compound widget 66 ; 59 ; 67 60 ; @param ID 68 61 ; 69 ; 70 ; @returns 71 ; 72 ; 73 ; @uses 74 ; 75 ; 76 ; @restrictions 77 ; 78 ; 79 ; @examples 80 ; 81 ; 82 ; @history 83 ; 84 ; 85 ; @version 86 ; $Id$ 87 ;- 88 ;***************************************************** 62 ; @returns 63 ; 64 ; @uses 65 ; 66 ; @restrictions 67 ; 68 ; @examples 69 ; 70 ; @history 71 ; 72 ; @version 73 ; $Id$ 74 ;- 89 75 FUNCTION cw_specifie_get_value, id 90 76 ; … … 118 104 ; @categories 119 105 ; Compound widget 120 ; 106 ; 121 107 ; @param EVENT 122 108 ; 123 ; 124 ; @returns 125 ; 126 ; 127 ; @uses 128 ; 129 ; 130 ; @restrictions 131 ; 132 ; 133 ; @examples 134 ; 135 ; 136 ; @history 137 ; 138 ; 139 ; @version 140 ; $Id$ 141 ;- 142 ;***************************************************** 109 ; @returns 110 ; 111 ; @uses 112 ; 113 ; @restrictions 114 ; 115 ; @examples 116 ; 117 ; @history 118 ; 119 ; @version 120 ; $Id$ 121 ;- 143 122 FUNCTION cw_specifie_event, event 144 123 ;------------------------------------------------------------ 145 ; on recuper les ID des differents widgets124 ; on recupere les ID des differents widgets 146 125 ;------------------------------------------------------------ 147 126 ;------------------------------------------------------------ … … 157 136 ;------------------------------------------------------------ 158 137 case uval of 159 'default':BEGIN 138 'default':BEGIN 160 139 ;--------------- 161 ; We find the name of the variable: 140 ; We find the name of the variable: 162 141 vlstid = widget_info(event.top, find_by_uname = 'varlist') 163 142 fieldname = widget_info(vlstid, /combobox_gettext) … … 170 149 widget_control, widget_info(event.handler, find_by_uname = 'autres'), set_value = '' 171 150 END 172 'palcol':BEGIN 151 'palcol':BEGIN 173 152 ind = fix(strmid(event.value, 0, strpos(event.value, '-'))) 174 153 widget_control, widget_info(event.handler, find_by_uname = 'palnum'), set_value = strtrim(ind, 1) … … 186 165 ; @categories 187 166 ; Compound widget 188 ; 167 ; 189 168 ; @param PARENT {in}{required} 190 169 ; The widget ID of the parent widget. … … 193 172 ; Buttons will be arranged in the number of columns 194 173 ; specified by this keyword. 195 ; 174 ; 196 175 ; @keyword ROW 197 176 ; Buttons will be arranged in the number of rows 198 177 ; specified by this keyword. 199 ; 178 ; 200 179 ; @keyword UVALUE 201 180 ; The user value to be associated with the widget. 202 ; 181 ; 203 182 ; @keyword UNAME 204 183 ; The user name to be associated with the widget. … … 206 185 ; @keyword FRAME 207 186 ; 208 ;209 187 ; @keyword FORXXX 210 188 ; 211 ;212 189 ; @keyword _EXTRA 213 190 ; Used to pass your keywords 214 191 ; 215 ; 216 ; @returns 217 ; 218 ; 219 ; @uses 220 ; 221 ; 222 ; @restrictions 223 ; 224 ; 225 ; @examples 226 ; 227 ; 228 ; @history 229 ; 230 ; 231 ; @version 232 ; $ID$ 192 ; @returns 193 ; 194 ; @uses 195 ; 196 ; @restrictions 197 ; 198 ; @examples 199 ; 200 ; @history 201 ; 202 ; @version 203 ; $Id$ 233 204 ; 234 205 ; @todo 235 206 ; seb: documenter 236 ; 207 ; 237 208 ;- 238 209 FUNCTION cw_specifie, parent, ROW = row, COLUMN = column, UVALUE = uvalue, UNAME = uname, FRAME = frame, FORXXX = forxxx, _extra = ex 239 ; che king exclusive keywords210 ; checking exclusive keywords 240 211 ; 241 212 compile_opt idl2, strictarrsubs 242 213 ; 243 214 column = keyword_set(column)*(1-keyword_set(row)) 244 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 215 row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) 245 216 ;------------------------------------------------ 246 217 if NOT keyword_set(uvalue) then uvalue = '' … … 250 221 , FUNC_GET_VALUE='cw_specifie_get_value' $ 251 222 , PRO_SET_VALUE='cw_specifie_set_value' $ 252 , UVALUE = uvalue, UNAME = uname, _extra = ex) 253 ; base1 223 , UVALUE = uvalue, UNAME = uname, _extra = ex) 224 ; base1 254 225 base1 = widget_base(base) 255 226 rien = widget_label(base1, value = 'Min', xoffset = 85, yoffset = 15) … … 277 248 278 249 279 ; widget text containi g other keywords pass into top_uvalue.exextra250 ; widget text containing other keywords pass into top_uvalue.exextra 280 251 ; Does it remain some? If yes, we have to put them as string 281 252 282 253 rien = widget_text(base, value = ' ', /editable, uname = 'autres', uvalue = 'autres', xsize = 54, ysize = 3, yoffset = 65, /wrap, /no_newline) 283 254 -
trunk/SRC/ToBeReviewed/WIDGET/xnotice.pro
r163 r226 9 9 ; @categories 10 10 ; Information 11 ; 11 ; 12 12 ; @param TEXT {in}{required}{type=string vector or scalar} 13 ; it is a string or a vector of string. If it is a scalar, we 13 ; it is a string or a vector of string. If it is a scalar, we 14 14 ; look for the line separator !C to create a text with several lines. 15 15 ; 16 16 ; @keyword CHKWIDGET 17 ; Force to verify that they are some active widget to create a widget, 17 ; Force to verify that they are some active widget to create a widget, 18 18 ; otherwise print at the prompt 19 19 ; … … 21 21 ; The identity of the created widget 22 22 ; 23 ; @restrictions 24 ; It do not call xmanager -> It do not create any event! 25 ; We have to delete this widget manu elly:23 ; @restrictions 24 ; It do not call xmanager -> It do not create any event! 25 ; We have to delete this widget manually: 26 26 ; widget_control, widgetid, /destroy 27 27 ; -
trunk/SRC/ToBeReviewed/WIDGET/xxx.pro
r192 r226 5 5 ; @categories 6 6 ; 7 ;8 7 ; @param EVENT 9 8 ; 10 9 ; 11 10 ; @returns 12 ; 13 ; 11 ; 14 12 ; @uses 15 ; 16 ; 13 ; 17 14 ; @restrictions 18 ; 19 ; 15 ; 20 16 ; @examples 21 ; 22 ; 17 ; 23 18 ; @history 24 ; 25 ; 26 ; @version 19 ; 20 ; @version 27 21 ; $Id$ 28 22 ;- … … 35 29 ;------------------------------------------------------------ 36 30 ; = widget_info(event.top,find_by_uname = '') 37 ; What is the type of even ment ?31 ; What is the type of event ? 38 32 ; if event.id EQ 622 then help, event, /struct 39 33 widget_control, event.id, get_uvalue=uval … … 42 36 ;help, event, /struct 43 37 ;help, uval , /struct 44 ; case on the type of even ment38 ; case on the type of event 45 39 widget_control, event.top, get_uvalue = top_uvalue 46 40 ; If we activate the keyword separate at the call of xxx … … 122 116 ; @categories 123 117 ; Widget 124 ; 118 ; 125 119 ; @param DATAFILENAME 126 120 ; … … 134 128 ; @keyword SEPARATE 135 129 ; To separate the button part and the drawing part in 2 windows. 136 ; Useful for small screens, but be careful to do not saturate the 130 ; Useful for small screens, but be careful to do not saturate the 137 131 ; video memory of some antiquated Tx. 138 132 ; 139 133 ; @keyword RESTORE 140 ; 'toto.dat' or toto.dat is a file created at the time of a precedent 134 ; 'toto.dat' or toto.dat is a file created at the time of a precedent 141 135 ; use of xxx thanks to the command "Widget" of the menu "save as". 142 ; 136 ; 143 137 ; @keyword _EXTRA 144 138 ; Used to pass your keywords … … 148 142 ; 149 143 ; @keyword REDRAW 150 ; 144 ; 151 145 ; 152 146 ; @keyword SEPARATE 153 147 ; 154 148 ; 155 ; @keyword UVALUE 149 ; @keyword UVALUE 156 150 ; The user value to be associated with the widget. 157 151 ; … … 191 185 if keyword_set(restore) then BEGIN 192 186 restore = isafile(filename = restore, iodir = homedir, _extra = ex) 193 if size(restore, /type) NE 7 then restore = 0 ELSE BEGIN 187 if size(restore, /type) NE 7 then restore = 0 ELSE BEGIN 194 188 restore, isafile(file = restore, iodir = homedir, _extra = ex) 195 189 newgrid = *(extractatt(uvalue, 'meshparameters'))[0] 196 190 change = changegrid(newgrid) 197 ENDELSE 191 ENDELSE 198 192 endif 199 193 if n_elements(CallerWidId) NE 0 THEN $ … … 203 197 ; list of files we want to look at 204 198 ; 205 if keyword_set(uvalue) then BEGIN 199 if keyword_set(uvalue) then BEGIN 206 200 currentfile = extractatt(uvalue, 'currentfile') 207 201 filelist = extractatt(uvalue, 'filelist') … … 222 216 ENDELSE 223 217 ; 224 if keyword_set(uvalue) THEN BEGIN 218 if keyword_set(uvalue) THEN BEGIN 225 219 smallin = extractatt(uvalue, 'smallin') 226 220 smallout = extractatt(uvalue, 'smallout') 227 ENDIF ELSE BEGIN 221 ENDIF ELSE BEGIN 228 222 smallin = [1, 1, 1] 229 223 smallout = [1, 1, 1] 230 ENDELSE 224 ENDELSE 231 225 nbredessin = smallin[0]*smallin[1] 232 226 numdessinin = smallin[2]-1 233 227 ; warning flg definition must be consistent with cw_pdmenu argument 234 228 ; see also flag definition in cw_pagelayout 235 if keyword_set(uvalue) then BEGIN 229 if keyword_set(uvalue) then BEGIN 236 230 flag = extractatt(uvalue, 'optionsflag') 237 231 key_portrait = flag[0, numdessinin] … … 252 246 ; The top base 253 247 ;------------------------------------------------------------ 254 IF xxxsize[0] LE scrsize[0] AND xxxsize[1] LE scrsize[1] THEN BEGIN 248 IF xxxsize[0] LE scrsize[0] AND xxxsize[1] LE scrsize[1] THEN BEGIN 255 249 base = widget_base(title = 'xxx', GROUP_LEADER = group, /tracking_events $ 256 250 , uname = 'base', space = 0) 257 ENDIF ELSE BEGIN 251 ENDIF ELSE BEGIN 258 252 base = widget_base(title = 'xxx', GROUP_LEADER = group, /tracking_events $ 259 253 , uname = 'base', space = 0 $ … … 278 272 selectact = (extractatt(uvalue, 'types'))[numdessinin] 279 273 selectact = (where(pltlst EQ selectact))[0] 280 widget_control, actid, set_combobox_select = 0 > selectact 274 widget_control, actid, set_combobox_select = 0 > selectact 281 275 ENDIF ELSE selectfile = 0 282 276 … … 316 310 yoff = yoff + 37 317 311 xoff = 5 318 ; b outton 'OK'312 ; button 'OK' 319 313 baseok = widget_button(base, value = ' OK ', uvalue = {name:'ok'}, uname = 'ok button' $ 320 314 , /frame, xoffset = xoff, yoffset = yoff) … … 337 331 selectvar = (extractatt(uvalue, 'varinfo'))[1, numdessinin] 338 332 selectvar = (where(currentlistvar EQ selectvar))[0] 339 widget_control, vlstid, set_combobox_select = 0 > selectvar 333 widget_control, vlstid, set_combobox_select = 0 > selectvar 340 334 ENDIF ELSE selectvar = 0 341 335 ;------------------------------------------------------------ … … 348 342 selectfile = (extractatt(uvalue, 'varinfo'))[0, numdessinin] 349 343 selectfile = (where(file_basename(filelist) EQ selectfile))[0] 350 widget_control, flstid, set_combobox_select = 0 > selectfile 344 widget_control, flstid, set_combobox_select = 0 > selectfile 351 345 ENDIF ELSE selectfile = 0 352 346 ;------------------------------------------------------------ … … 375 369 dummyid = cw_calendar(basecalid, currentcalendar, date2, FAKECAL = fakecal, uname = 'calendar2', uvalue = {name:'calendar2'}, /frame) 376 370 ;------------------------------------------------------------ 377 ; Domain 371 ; Domain 378 372 ;------------------------------------------------------------ 379 373 yoff = yoff + 60 … … 399 393 basegraph = widget_base(title = 'xxx window', group_leader = base, uvalue = base) $ 400 394 ELSE basegraph = base 401 395 402 396 graphid = widget_draw(basegraph, uname = 'graph', /button_events, retain = 2 $ 403 397 , uvalue = {name:'graph', press:0, click:0, x:[0., 0.], y:[0., 0.]} $ … … 416 410 if keyword_set(uvalue) then BEGIN ; 417 411 ; We recopy the pointer uvalue in top_uvalue. 418 ; Beware, we have to redefine completely top_value from variables 419 ; pointed by uvalue. Otherwise, if we simply do top_value = uvalue, 420 ; when we delete by uvalue and variables on which it point, we 412 ; Beware, we have to redefine completely top_value from variables 413 ; pointed by uvalue. Otherwise, if we simply do top_value = uvalue, 414 ; when we delete by uvalue and variables on which it point, we 421 415 ; also delete variables on which point top_value. 422 416 case 1 of … … 443 437 ; widgets's state 444 438 updatewidget, base 445 ; 439 ; 446 440 END 447 441 ELSE:BEGIN … … 450 444 FOR i = 0, 14 do *top_uvalue[1, i] = *uvalue[1, i] 451 445 FOR i = 18, 27 do *top_uvalue[1, i] = *uvalue[1, i] 452 numfile = n_elements(extractatt(uvalue, 'filelist')) 446 numfile = n_elements(extractatt(uvalue, 'filelist')) 453 447 *top_uvalue[1, 15] = ptrarr(numfile, /allocate_heap) 454 448 *top_uvalue[1, 16] = ptrarr(numfile, /allocate_heap) 455 449 *top_uvalue[1, 17] = ptrarr(numfile, /allocate_heap) 456 450 for i = 0, numfile-1 do begin 457 *(*top_uvalue[1, 15])[i] = *(*uvalue[1, 15])[i] 458 *(*top_uvalue[1, 16])[i] = *(*uvalue[1, 16])[i] 459 *(*top_uvalue[1, 17])[i] = *(*uvalue[1, 17])[i] 451 *(*top_uvalue[1, 15])[i] = *(*uvalue[1, 15])[i] 452 *(*top_uvalue[1, 16])[i] = *(*uvalue[1, 16])[i] 453 *(*top_uvalue[1, 17])[i] = *(*uvalue[1, 17])[i] 460 454 endfor 461 455 *top_uvalue[1, 28] = ptrarr(nbredessin, /allocate_heap) 462 for i = 0, nbredessin-1 do *(*top_uvalue[1, 28])[i] = *(*uvalue[1, 28])[i] 456 for i = 0, nbredessin-1 do *(*top_uvalue[1, 28])[i] = *(*uvalue[1, 28])[i] 463 457 widget_control, base, set_uvalue = top_uvalue 464 458 ; Copy the screen of the widget of uvalue in top_value's one … … 478 472 ; 479 473 ENDIF ELSE BEGIN 480 ; Otherwise we will define all elements we will hook at the widget 481 ; thanks to the top_value which is a pointer array with 2 482 ; columns: names and variables. 474 ; Otherwise we will define all elements we will hook at the widget 475 ; thanks to the top_value which is a pointer array with 2 476 ; columns: names and variables. 483 477 ; We initialize all these elements. 484 478 ; Variables concerning the widget in its generality. … … 486 480 ; variables se rapportant aux differents fichiers que l''on peut lire 487 481 ; variables specifiques a chaque dessin 488 ; 489 482 ; 483 490 484 ; creation of the pointer we will hook at the widget. 491 485 top_uvalue = ptrarr(2, 29, /allocate_heap) … … 516 510 *top_uvalue[0, 21] = 'nameprocedures' & *top_uvalue[1, 21] = strarr(nbredessin) 517 511 *top_uvalue[0, 22] = 'types' & *top_uvalue[1, 22] = strarr(nbredessin) 518 *top_uvalue[0, 23] = 'varinfo' & *top_uvalue[1, 23] = strarr(2, nbredessin) 512 *top_uvalue[0, 23] = 'varinfo' & *top_uvalue[1, 23] = strarr(2, nbredessin) 519 513 *top_uvalue[0, 24] = 'domaines' & *top_uvalue[1, 24] = fltarr(6, nbredessin) 520 514 *top_uvalue[0, 25] = 'dates' & *top_uvalue[1, 25] = lonarr(2, nbredessin) … … 526 520 createhistory, base, smallin 527 521 ; 528 ENDELSE 529 ;------------------------------------------------------------ 530 xmanager, 'xxx', base, /no_block 522 ENDELSE 523 ;------------------------------------------------------------ 524 xmanager, 'xxx', base, /no_block 531 525 ;------------------------------------------------------------ 532 526 ;------------------------------------------------------------ -
trunk/SRC/Utilities/report.pro
r224 r226 11 11 ; @param TEXT {in}{required} 12 12 ; one string or one vector of string. Si le string ne 13 ; comporte qu''un element, on cherche les eventuels c haracteres de13 ; comporte qu''un element, on cherche les eventuels caracteres de 14 14 ; retour a la ligne: '!C'. If text is set to an array of strings, each 15 15 ; array element is displayed as a separate line of text. -
trunk/SRC/Utilities/routine_name.pro
r224 r226 59 59 ; 60 60 name = str_sep(allnames, '%') ; we cut it out again. 61 name = strtrim(name, 2) ; we remo uve blanks in front of and behind61 name = strtrim(name, 2) ; we remove blanks in front of and behind 62 62 name = strcompress(name) ; we compress blanks 63 63 ; we do not hold back the two first elements who are a blanck and the line concerning -
trunk/SRC/Utilities/text_box.pro
r224 r226 24 24 ; prior to writing the text. If both BG_COLOR and !p.color 25 25 ; are zero then the background color is reset to 255 to 26 ; g aurantee a readability.26 ; guarantee a readability. 27 27 ; 28 28 ; @keyword RIGHT
Note: See TracChangeset
for help on using the changeset viewer.