Changeset 224 for trunk/SRC/Utilities/fitintobox.pro
- Timestamp:
- 03/15/07 11:22:28 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/fitintobox.pro
r163 r224 4 4 ;+ 5 5 ; 6 ; @file_comments 6 ; @file_comments 7 7 ; Check that the input array has size and dimensions 8 8 ; compatible with the domain that was defined with the previous call 9 9 ; of domdef. 10 10 ; 11 ; @categories 11 ; @categories 12 12 ; Compatibility 13 ; 14 ; @param sz {in}{required} 15 ; 13 ; 14 ; @param sz {in}{required} 15 ; 16 16 ; @param nx {in}{required} 17 17 ; … … 25 25 ; 26 26 ; @param jpk {in}{required} 27 ; 27 ; 28 28 ; @param jpt {in}{required} 29 29 ; 30 ; @returns -1 31 ; 32 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 30 ; @returns 31 ; -1 32 ; 33 ; @history 34 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 33 35 ; 10 juin 2000. 34 36 ; June 2005: S. Masson rewrite all. 35 37 ; 36 ; @version $Id$ 38 ; @version 39 ; $Id$ 37 40 ; 38 41 ; @hidden … … 57 60 RETURN, report(['Error: ' $ 58 61 , 'the array dimensions ' + tostr(sz) + ' are incompatible' $ 59 , 'with the the domain dimensions ' $ 62 , 'with the the domain dimensions ' $ 60 63 , '[jpi/nx, jpj/ny, jpk/nz, jpt] = [' $ 61 64 + strtrim(jpi, 1) + '/' + strtrim(nx, 1) $ … … 67 70 ;+ 68 71 ; 69 ; @categories 72 ; @categories 70 73 ; Compatibility 71 74 ; 72 75 ; @param field {in}{required}{type=array or struct} 73 ; an array or a structure that can be read by the function 76 ; an array or a structure that can be read by the function 74 77 ; litchamp.pro 75 ; 78 ; 76 79 ; @param nx {in}{optional}{default=define by grille.pro} 77 80 ; … … 92 95 ; @param lastz {in}{optional}{default=define by grille.pro} 93 96 ; 94 ; @keyword WDEPTH 97 ; @keyword WDEPTH 95 98 ; To specify that we are at W level 96 99 ; 97 ; @returns 100 ; @returns 98 101 ; an array with dimensions matching the domain 99 102 ; or -1 if there is an error... … … 102 105 ; @uses cm_4cal 103 106 ; 104 ; @examples 107 ; @examples 105 108 ; IDL> help, fitintobox(findgen(jpi,jpj)) 106 109 ; <Expression> FLOAT = Array[41, 3] 107 110 ; IDL> help, fitintobox(findgen(jpi,jpj,78)) 108 ; Error: 111 ; Error: 109 112 ; the array dimensions [180,148,78] are incompatible 110 ; with the the domain dimensions 113 ; with the the domain dimensions 111 114 ; [jpi/nx, jpj/ny, jpk/nz, jpt] = [180/41, 148/3, 31/31, 1] 112 115 ; <Expression> INT = -1 113 116 ; 114 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 117 ; @history 118 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 115 119 ; 10 juin 2000. 116 120 ; June 2005: S. Masson rewrite all. 117 121 ; 118 ; @version $Id$ 122 ; @version 123 ; $Id$ 119 124 ;- 120 125 ;------------------------------------------------------------ … … 152 157 CASE 1 OF 153 158 ; x arrays 154 sz[1] EQ jpi :arr = (temporary(arr))[firstx:lastx ] 155 sz[1] EQ nx : 159 sz[1] EQ jpi :arr = (temporary(arr))[firstx:lastx ] 160 sz[1] EQ nx : 156 161 ; y arrays 157 sz[1] EQ jpj :arr = (temporary(arr))[ firsty:lasty ] 158 sz[1] EQ ny : 162 sz[1] EQ jpj :arr = (temporary(arr))[ firsty:lasty ] 163 sz[1] EQ ny : 159 164 ; z arrays 160 sz[1] EQ jpk :arr = (temporary(arr))[ firstz:lastz ] 161 sz[1] EQ nz : 165 sz[1] EQ jpk :arr = (temporary(arr))[ firstz:lastz ] 166 sz[1] EQ nz : 162 167 ; t arrays 163 168 sz[1] EQ jpt : 164 ELSE:return, err_mess(sz[1], jpi, nx, jpj, ny, jpk, nz, jpt) 169 ELSE:return, err_mess(sz[1], jpi, nx, jpj, ny, jpk, nz, jpt) 165 170 ENDCASE 166 171 END … … 170 175 CASE 1 OF 171 176 ; xy arrays 172 sz[1] EQ jpi AND sz[2] EQ jpj :arr = (temporary(arr))[firstx:lastx, firsty:lasty ] 177 sz[1] EQ jpi AND sz[2] EQ jpj :arr = (temporary(arr))[firstx:lastx, firsty:lasty ] 173 178 sz[1] EQ jpi AND sz[2] EQ ny :arr = (temporary(arr))[firstx:lastx, * ] 174 179 sz[1] EQ nx AND sz[2] EQ jpj :arr = (temporary(arr))[ *, firsty:lasty ] 175 180 sz[1] EQ nx AND sz[2] EQ ny :arr = (temporary(arr))[ *, * ] 176 181 ; x(y)z arrays 177 sz[1] EQ jpi AND ny EQ 1 AND sz[2] EQ jpk :arr = (temporary(arr))[firstx:lastx, firstz:lastz ] 182 sz[1] EQ jpi AND ny EQ 1 AND sz[2] EQ jpk :arr = (temporary(arr))[firstx:lastx, firstz:lastz ] 178 183 sz[1] EQ jpi AND ny EQ 1 AND sz[2] EQ nz :arr = (temporary(arr))[firstx:lastx, * ] 179 184 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ jpk :arr = (temporary(arr))[ *, firstz:lastz ] 180 185 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ nz : 181 186 ; (x)yz arrays 182 nx EQ 1 AND sz[1] EQ jpj AND sz[2] EQ jpk :arr = (temporary(arr))[ firsty:lasty, firstz:lastz ] 187 nx EQ 1 AND sz[1] EQ jpj AND sz[2] EQ jpk :arr = (temporary(arr))[ firsty:lasty, firstz:lastz ] 183 188 nx EQ 1 AND sz[1] EQ jpj AND sz[2] EQ nz :arr = (temporary(arr))[ firsty:lasty, * ] 184 189 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ jpk :arr = (temporary(arr))[ *, firstz:lastz ] 185 190 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz : 186 191 ; xt arrays 187 sz[1] EQ jpi AND sz[2] EQ jpt:arr = (temporary(arr))[firstx:lastx , *] 192 sz[1] EQ jpi AND sz[2] EQ jpt:arr = (temporary(arr))[firstx:lastx , *] 188 193 sz[1] EQ nx AND sz[2] EQ jpt: 189 194 ; yt arrays … … 191 196 sz[1] EQ ny AND sz[2] EQ jpt: 192 197 ; zt arrays 193 sz[1] EQ jpk AND sz[2] EQ jpt:arr = (temporary(arr))[ firstz:lastz, *] 198 sz[1] EQ jpk AND sz[2] EQ jpt:arr = (temporary(arr))[ firstz:lastz, *] 194 199 sz[1] EQ nz AND sz[2] EQ jpt: 195 200 ELSE:return, err_mess(sz[1:2], jpi, nx, jpj, ny, jpk, nz, jpt) … … 201 206 CASE 1 OF 202 207 ; xyz arrays 203 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ jpk :arr = (temporary(arr))[firstx:lastx, firsty:lasty, firstz:lastz ] 208 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ jpk :arr = (temporary(arr))[firstx:lastx, firsty:lasty, firstz:lastz ] 204 209 sz[1] EQ jpi AND sz[2] EQ ny AND sz[3] EQ jpk :arr = (temporary(arr))[firstx:lastx, *, firstz:lastz ] 205 210 sz[1] EQ nx AND sz[2] EQ jpj AND sz[3] EQ jpk :arr = (temporary(arr))[ *, firsty:lasty, firstz:lastz ] 206 211 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpk :arr = (temporary(arr))[ *, *, firstz:lastz ] 207 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ nz :arr = (temporary(arr))[firstx:lastx, firsty:lasty, * ] 212 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ nz :arr = (temporary(arr))[firstx:lastx, firsty:lasty, * ] 208 213 sz[1] EQ jpi AND sz[2] EQ ny AND sz[3] EQ nz :arr = (temporary(arr))[firstx:lastx, *, * ] 209 214 sz[1] EQ nx AND sz[2] EQ jpj AND sz[3] EQ nz :arr = (temporary(arr))[ *, firsty:lasty, * ] 210 215 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ nz : 211 216 ; xyt arrays 212 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ jpt:arr = (temporary(arr))[firstx:lastx, firsty:lasty, *] 217 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ jpt:arr = (temporary(arr))[firstx:lastx, firsty:lasty, *] 213 218 sz[1] EQ jpi AND sz[2] EQ ny AND sz[3] EQ jpt:arr = (temporary(arr))[firstx:lastx, *, *] 214 219 sz[1] EQ nx AND sz[2] EQ jpj AND sz[3] EQ jpt:arr = (temporary(arr))[ *, firsty:lasty, *] 215 220 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpt: 216 221 ; (x)yzt arrays 217 nx EQ 1 AND sz[1] EQ jpj AND sz[2] EQ jpk AND sz[3] EQ jpt:arr = (temporary(arr))[ firsty:lasty, firstz:lastz, *] 222 nx EQ 1 AND sz[1] EQ jpj AND sz[2] EQ jpk AND sz[3] EQ jpt:arr = (temporary(arr))[ firsty:lasty, firstz:lastz, *] 218 223 nx EQ 1 AND sz[1] EQ jpj AND sz[2] EQ nz AND sz[3] EQ jpt:arr = (temporary(arr))[ firsty:lasty, *, *] 219 224 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ jpk AND sz[3] EQ jpt:arr = (temporary(arr))[ *, firstz:lastz, *] 220 225 nx EQ 1 AND sz[1] EQ ny AND sz[2] EQ nz AND sz[3] EQ jpt: 221 226 ; x(y)zt arrays 222 sz[1] EQ jpi AND ny EQ 1 AND sz[2] EQ jpk AND sz[3] EQ jpt:arr = (temporary(arr))[firstx:lastx, firstz:lastz, *] 227 sz[1] EQ jpi AND ny EQ 1 AND sz[2] EQ jpk AND sz[3] EQ jpt:arr = (temporary(arr))[firstx:lastx, firstz:lastz, *] 223 228 sz[1] EQ jpi AND ny EQ 1 AND sz[2] EQ nz AND sz[3] EQ jpt:arr = (temporary(arr))[firstx:lastx, *, *] 224 229 sz[1] EQ nx AND ny EQ 1 AND sz[2] EQ jpk AND sz[3] EQ jpt:arr = (temporary(arr))[ *, firstz:lastz, *] … … 232 237 CASE 1 OF 233 238 ; xyzt arrays 234 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ jpk AND sz[4] EQ jpt:arr = (temporary(arr))[firstx:lastx, firsty:lasty, firstz:lastz, *] 239 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ jpk AND sz[4] EQ jpt:arr = (temporary(arr))[firstx:lastx, firsty:lasty, firstz:lastz, *] 235 240 sz[1] EQ jpi AND sz[2] EQ ny AND sz[3] EQ jpk AND sz[4] EQ jpt:arr = (temporary(arr))[firstx:lastx, *, firstz:lastz, *] 236 241 sz[1] EQ nx AND sz[2] EQ jpj AND sz[3] EQ jpk AND sz[4] EQ jpt:arr = (temporary(arr))[ *, firsty:lasty, firstz:lastz, *] 237 242 sz[1] EQ nx AND sz[2] EQ ny AND sz[3] EQ jpk AND sz[4] EQ jpt:arr = (temporary(arr))[ *, *, firstz:lastz, *] 238 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ nz AND sz[4] EQ jpt:arr = (temporary(arr))[firstx:lastx, firsty:lasty, *, *] 243 sz[1] EQ jpi AND sz[2] EQ jpj AND sz[3] EQ nz AND sz[4] EQ jpt:arr = (temporary(arr))[firstx:lastx, firsty:lasty, *, *] 239 244 sz[1] EQ jpi AND sz[2] EQ ny AND sz[3] EQ nz AND sz[4] EQ jpt:arr = (temporary(arr))[firstx:lastx, *, *, *] 240 245 sz[1] EQ nx AND sz[2] EQ jpj AND sz[3] EQ nz AND sz[4] EQ jpt:arr = (temporary(arr))[ *, firsty:lasty, *, *]
Note: See TracChangeset
for help on using the changeset viewer.