Changeset 69 for trunk/Grid/computegrid.pro
- Timestamp:
- 05/11/06 12:35:53 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Grid/computegrid.pro
r13 r69 70 70 ; computed by using the first line of glamt. 71 71 ; 72 ; /PLAIN: force PERIODIC = 0, SHIFT = 0, STRIDE = [1, 1, 1] and 73 ; suppress the automatic redefinition of the domain in case of 74 ; x periodicity overlap, y periodicity overlap (ORCA type only) 75 ; and mask border to 0. 76 ; 72 77 ; SHIFT = scalar to force the manual definition of key_shift. By 73 78 ; debault, key_shift is automaticaly computed according to 74 79 ; glamboundary (when defined) by using the FIRST LINE of glamt. if 75 80 ; key_periodic=0 then in any case key_shift = 0. 81 ; 82 ; STRCALLING: a string containing the calling command used to 83 ; call computegrid (this is used by xxx.pro) 76 84 ; 77 85 ; STRIDE = : a 3 elements vector to specify the stride in x, y, z … … 114 122 ; COMMON BLOCKS: cm_4mesh cm_4data cm_4cal 115 123 ; 116 ; SIDE EFFECTS: 124 ; SIDE EFFECTS: if the grid has x/y periodicity orverlap and/or if 125 ; the mask has 0 everywhere at the border (like a close sea) and 126 ; if (we did not activate /plain and xminmesh, xmaxmesh, yminmesh, 127 ; ymaxmesh keywords are defined to their default values), we redefine 128 ; xminmesh, xmaxmesh, yminmesh, ymaxmesh in order to reove the 129 ; overlapping part and/or to open the domain (avoid ti be forced 130 ; to use cell_fill = 1). 117 131 ; 118 132 ; RESTRICTIONS:FUV points definition... … … 135 149 , ZMINMESH = zminmesh, ZMAXMESH = zmaxmesh $ 136 150 , ONEARTH = onearth, PERIODIC = periodic $ 137 , SHIFT = shift, STRIDE = stride $151 , PLAIN = plain, SHIFT = shift, STRIDE = stride $ 138 152 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 139 , FBASE2TBASE = fbase2tbase, _extra = ex 153 , FBASE2TBASE = fbase2tbase, STRCALLING = strcalling $ 154 , _extra = ex 140 155 ;--------------------------------------------------------- 141 156 @cm_4mesh … … 232 247 jpkglo = long(nz) 233 248 ; 249 ; impact of plain keyword: 250 ; 251 IF keyword_set(plain) THEN BEGIN 252 periodic = 0 253 shift = 0 254 stride = [1, 1, 1] 255 ENDIF 256 ; 234 257 IF n_elements(xminmesh) NE 0 THEN ixminmesh = long(xminmesh[0]) ELSE ixminmesh = 0l 235 258 IF n_elements(xmaxmesh) NE 0 THEN ixmaxmesh = long(xmaxmesh[0]) ELSE ixmaxmesh = jpiglo-1 … … 282 305 periodic = 0 283 306 shift = 0 284 ENDIF ;307 ENDIF 285 308 286 309 r = 6371000. … … 358 381 IF jpj EQ 1 THEN gphit = reform(gphit, jpi, jpj, /over) 359 382 ; 383 ;==================================================== 384 ; check y periodicity... Only according to ORCA grid 385 ;==================================================== 386 ; check the peridicity if iyminmesh and iymaxmesh have the default definitions... 387 IF NOT keyword_set(plain) AND key_onearth EQ 1 AND key_stride[1] EQ 1 $ 388 AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo-1 AND jpj GE 3 THEN BEGIN 389 390 CASE 1 OF 391 ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 $ 392 AND array_equal(gphit[1:*, jpj-1], reverse(gphit[1:*, jpj-3])) EQ 1:BEGIN 393 ; T pivot 394 ymaxmesh = -1 395 recall = 1 396 END 397 ixminmesh EQ 1l AND ixmaxmesh eq jpiglo-2 $ 398 AND array_equal(gphit[*, jpj-1], reverse(shift(gphit[*, jpj-3], -1))) EQ 1:BEGIN 399 ; T pivot 400 ymaxmesh = -1 401 recall = 1 402 END 403 ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 $ 404 AND array_equal(gphit[*, jpj-1], reverse(gphit[*, jpj-2])) EQ 1:BEGIN 405 ; F pivot 406 ymaxmesh = -1 407 recall = 1 408 END 409 ixminmesh EQ 1l AND ixmaxmesh eq jpiglo-2 $ 410 AND array_equal(gphit[*, jpj-1], reverse(gphit[*, jpj-2])) EQ 1:BEGIN 411 ; F pivot 412 ymaxmesh = -1 413 recall = 1 414 END 415 ELSE: 416 ENDCASE 417 ENDIF 418 ; 419 ;==================================================== 420 ; check x periodicity... 421 ;==================================================== 422 IF n_elements(periodic) NE 0 THEN forcenoperio = 1 - keyword_set(periodic) 423 ; check the peridicity if ixminmesh and ixmaxmesh have the default definitions... 424 IF NOT keyword_set(plain) AND NOT keyword_set(forcenoperio) AND key_onearth EQ 1 $ 425 AND key_stride[0] EQ 1 AND ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 AND jpi GE 3 THEN BEGIN 426 CASE 0 OF 427 total((glamt[0, *] - glamt[jpi-2, *]) MOD 360) $ 428 + total((glamt[1, *] - glamt[jpi-1, *]) MOD 360):BEGIN 429 xminmesh = 1 430 xmaxmesh = -1 431 recall = 1 432 END 433 total((glamt[0, *] - glamt[jpi-2, *]) MOD 360):BEGIN 434 xminmesh = 1 435 recall = 1 436 END 437 total((glamt[1, *] - glamt[jpi-1, *]) MOD 360):BEGIN 438 xmaxmesh = -1 439 recall = 1 440 END 441 ELSE: 442 ENDCASE 443 ENDIF 444 ;==================================================== 445 ; recall computegrid if needed... 446 ;==================================================== 447 IF keyword_set(recall) THEN BEGIN 448 computegrid, XAXIS = glamt, YAXIS = gphit, ZAXIS = zaxis $ 449 , MASK = mask, GLAMBOUNDARY = glamboundary $ 450 , XMINMESH = xminmesh, XMAXMESH = xmaxmesh $ 451 , YMINMESH = yminmesh, YMAXMESH = ymaxmesh $ 452 , ZMINMESH = zminmesh, ZMAXMESH = zmaxmesh $ 453 , PERIODIC = periodic, SHIFT = shift, STRIDE = stride $ 454 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 455 , FBASE2TBASE = fbase2tbase, STRCALLING = strcalling $ 456 , _extra = ex 457 return 458 ENDIF 360 459 ;==================================================== 361 460 ; def of key_shift … … 484 583 IF jpj EQ 1 THEN glamf = reform(glamf, jpi, jpj, /over) 485 584 ENDIF ELSE glamf = glamt + 0.5 486 IF keyword_set(glamboundary) AND key_onearth THEN $ 487 glamf = glamboundary[0] > temporary(glamf) < glamboundary[1] 585 ; 586 IF keyword_set(key_periodic) AND (max(glamf)-min(glamt)) GE 360 THEN BEGIN 587 IF NOT keyword_set(glamboundary) THEN BEGIN 588 bigger = where(glamf GE min(glamt)+360) 589 glamf[bigger] = glamf[bigger]-360. 590 ENDIF ELSE glamf = glamboundary[0] > temporary(glamf) < glamboundary[1] 591 ENDIF 488 592 ; 489 593 ;==================================================== … … 795 899 ENDIF 796 900 ENDELSE 901 ; 902 IF jpi GT 2 AND jpj GT 2 AND NOT keyword_set(plain) $ 903 AND ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 $ 904 AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo-1 $ 905 AND total(tmask[*, 0, *]) EQ 0 AND total(tmask[*, jpj-1, *]) EQ 0 $ 906 AND total(tmask[0, *, *]) EQ 0 AND total(tmask[jpi-1, *, *]) EQ 0 THEN BEGIN 907 xminmesh = 1 908 xmaxmesh = -1 909 yminmesh = 1 910 ymaxmesh = -1 911 computegrid, XAXIS = glamt, YAXIS = gphit, ZAXIS = zaxis $ 912 , MASK = mask, GLAMBOUNDARY = glamboundary $ 913 , XMINMESH = xminmesh, XMAXMESH = xmaxmesh $ 914 , YMINMESH = yminmesh, YMAXMESH = ymaxmesh $ 915 , ZMINMESH = zminmesh, ZMAXMESH = zmaxmesh $ 916 , ONEARTH = onearth, PERIODIC = periodic $ 917 , PLAIN = plain, SHIFT = shift, STRIDE = stride $ 918 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 919 , FBASE2TBASE = fbase2tbase, STRCALLING = strcalling $ 920 , _extra = ex 921 return 922 ENDIF 797 923 ; 798 924 IF NOT keyword_set(fullcgrid) THEN BEGIN … … 890 1016 ;==================================================== 891 1017 ; 892 IF total( mask) EQ jpi*jpj*jpk $1018 IF total(tmask) EQ jpi*jpj*jpk $ 893 1019 AND NOT keyword_set(key_irregular) THEN triangles_list = -1 $ 894 ELSE triangles_list = triangule(/keep_cont) 1020 ELSE BEGIN 1021 ; are we using ORCA2 ? 1022 IF jpiglo EQ 182 AND jpi EQ 181 AND jpjglo EQ 149 AND jpj EQ 148 THEN $ 1023 triangles_list = triangule() ELSE triangles_list = triangule(/keep_cont) 1024 ENDELSE 895 1025 ; 896 1026 ;==================================================== … … 898 1028 ;==================================================== 899 1029 ; 900 jpt = 1 901 time = 0 1030 IF n_elements(time) EQ 0 OR n_elements(jpt) EQ 0 THEN BEGIN 1031 jpt = 1 1032 time = 0 1033 ENDIF 902 1034 ; 903 1035 IF NOT keyword_set(key_forgetold) THEN BEGIN 904 1036 @updateold 905 1037 ENDIF 1038 ;==================================================== 1039 ; grid parameters used by xxx 1040 ;==================================================== 1041 ; 1042 IF NOT keyword_set(strcalling) THEN BEGIN 1043 IF n_elements(ccmeshparameters) EQ 0 THEN strcalling = 'computegrid' $ 1044 ELSE strcalling = ccmeshparameters.filename 1045 ENDIF 1046 glaminfo = moment(glamt) 1047 IF finite(glaminfo[2]) EQ 0 THEN glaminfo = glaminfo[0:1] 1048 gphiinfo = moment(gphit) 1049 IF finite(gphiinfo[2]) EQ 0 THEN gphiinfo = gphiinfo[0:1] 1050 ccmeshparameters = {filename:strcalling $ 1051 , glaminfo:glaminfo $ 1052 , gphiinfo:gphiinfo $ 1053 , jpiglo:jpiglo, jpjglo:jpjglo, jpkglo:jpkglo $ 1054 , jpi:jpi, jpj:jpj, jpk:jpk $ 1055 , ixminmesh:ixminmesh, ixmaxmesh:ixmaxmesh $ 1056 , iyminmesh:iyminmesh, iymaxmesh:iymaxmesh $ 1057 , izminmesh:izminmesh, izmaxmesh:izmaxmesh $ 1058 , key_shift:key_shift, key_periodic:key_periodic $ 1059 , key_stride:key_stride, key_gridtype:key_gridtype $ 1060 , key_yreverse:key_yreverse, key_zreverse:key_zreverse $ 1061 , key_partialstep:key_partialstep, key_onearth:key_onearth} 1062 1063 ccreadparameters = {funclec_name:'read_ncdf' $ 1064 , jpidta:jpidta, jpjdta:jpjdta, jpkdta:jpkdta $ 1065 , ixmindta:ixmindta, ixmaxdta:ixmaxdta $ 1066 , iymindta:iymindta, iymaxdta:iymaxdta $ 1067 , izmindta:izmindta, izmaxdta:izmaxdta} 906 1068 ;------------------------------------------------------------ 907 1069 IF keyword_set(key_performance) EQ 1 THEN $
Note: See TracChangeset
for help on using the changeset viewer.