Changeset 399 for trunk/SRC/Grid/computegrid.pro
- Timestamp:
- 07/02/09 10:38:54 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Grid/computegrid.pro
r371 r399 353 353 ;==================================================== 354 354 ; 355 jpiglo = long(nx) 356 jpjglo = long(ny) 357 jpkglo = long(nz) 358 IF keyword_set(romsh) THEN BEGIN 359 jpiglo = jpiglo - 1 360 jpjglo = jpjglo - 1 361 fullcgrid = 1 362 ENDIF 355 IF keyword_set(romsh) THEN fullcgrid = 1 356 CASE 1 OF 357 keyword_set(fbase2tbase):key_gridtype = 'c_f' 358 keyword_set(ubase2tbase):key_gridtype = 'c_u' 359 keyword_set(vbase2tbase):key_gridtype = 'c_v' 360 else:key_gridtype = 'c' 361 ENDCASE 362 IF strlen(key_gridtype) EQ 3 THEN fullcgrid = 1 363 ; 364 IF n_elements(xminmesh) NE 0 AND n_elements(xmaxmesh) NE 0 THEN BEGIN 365 IF nx EQ jpi AND xminmesh EQ ixminmesh AND xmaxmesh EQ ixmaxmesh THEN xalreadycut = 1 366 ENDIF 367 IF keyword_set(xalreadycut) THEN BEGIN 368 xmin = 0 369 xmax = jpi - 1 370 nxx = jpi 371 ENDIF ELSE BEGIN 372 jpiglo = long(nx) 373 IF keyword_set(romsh) THEN jpiglo = jpiglo - 1 374 IF n_elements(xminmesh) NE 0 THEN ixminmesh = long(xminmesh[0]) ELSE ixminmesh = 0l 375 IF n_elements(xmaxmesh) NE 0 THEN ixmaxmesh = long(xmaxmesh[0]) ELSE ixmaxmesh = jpiglo-1 376 IF ixmaxmesh LT 0 THEN ixmaxmesh = jpiglo -1 + ixmaxmesh 377 ixmaxmesh = 0 > ixmaxmesh < (jpiglo-1) 378 ixminmesh = 0 > ixminmesh < ixmaxmesh 379 jpi = ixmaxmesh-ixminmesh+1 380 xmin = ixminmesh 381 xmax = ixmaxmesh 382 nxx = jpiglo 383 ENDELSE 384 385 IF n_elements(yminmesh) NE 0 AND n_elements(ymaxmesh) NE 0 THEN BEGIN 386 IF ny EQ jpj AND yminmesh EQ iyminmesh AND ymaxmesh EQ iymaxmesh THEN yalreadycut = 1 387 ENDIF 388 IF keyword_set(yalreadycut) THEN BEGIN 389 ymin = 0 390 ymax = jpj - 1 391 nyy = jpj 392 ENDIF ELSE BEGIN 393 jpjglo = long(ny) 394 IF keyword_set(romsh) THEN jpjglo = jpjglo - 1 395 IF n_elements(yminmesh) NE 0 THEN iyminmesh = long(yminmesh[0]) ELSE iyminmesh = 0l 396 IF n_elements(ymaxmesh) NE 0 THEN iymaxmesh = long(ymaxmesh[0]) ELSE iymaxmesh = jpjglo-1 397 IF key_gridtype EQ 'c_v' OR key_gridtype EQ 'c_f' THEN iymaxmesh = iymaxmesh-1 398 IF iymaxmesh LT 0 THEN iymaxmesh = jpjglo -1 + iymaxmesh 399 iymaxmesh = 0 > iymaxmesh < (jpjglo-1) 400 iyminmesh = 0 > iyminmesh < iymaxmesh 401 jpj = iymaxmesh-iyminmesh+1 402 ymin = iyminmesh 403 ymax = iymaxmesh 404 nyy = jpjglo 405 ENDELSE 406 407 IF n_elements(zminmesh) NE 0 AND n_elements(zmaxmesh) NE 0 THEN BEGIN 408 IF nz EQ jpk AND zminmesh EQ izminmesh AND zmaxmesh EQ izmaxmesh THEN zalreadycut = 1 409 ENDIF 410 IF keyword_set(zalreadycut) THEN BEGIN 411 zmin = 0 412 zmax = jpk - 1 413 nzz = jpk 414 ENDIF ELSE BEGIN 415 jpkglo = long(nz) 416 IF n_elements(zminmesh) NE 0 THEN izminmesh = long(zminmesh[0]) ELSE izminmesh = 0l 417 IF n_elements(zmaxmesh) NE 0 THEN izmaxmesh = long(zmaxmesh[0]) ELSE izmaxmesh = jpkglo-1 418 IF izmaxmesh LT 0 THEN izmaxmesh = jpkglo -1 + izmaxmesh 419 izmaxmesh = 0 > izmaxmesh < (jpkglo-1) 420 izminmesh = 0 > izminmesh < izmaxmesh 421 jpk = izmaxmesh-izminmesh+1 422 zmin = izminmesh 423 zmax = izmaxmesh 424 nzz = jpkglo 425 ENDELSE 363 426 ; 364 427 ; impact of plain keyword: … … 372 435 ENDIF 373 436 ; 374 IF n_elements(xminmesh) NE 0 THEN ixminmesh = long(xminmesh[0]) ELSE ixminmesh = 0l375 IF n_elements(xmaxmesh) NE 0 THEN ixmaxmesh = long(xmaxmesh[0]) ELSE ixmaxmesh = jpiglo-1376 IF n_elements(yminmesh) NE 0 THEN iyminmesh = long(yminmesh[0]) ELSE iyminmesh = 0l377 IF n_elements(ymaxmesh) NE 0 THEN iymaxmesh = long(ymaxmesh[0]) ELSE iymaxmesh = jpjglo-1378 IF n_elements(zminmesh) NE 0 THEN izminmesh = long(zminmesh[0]) ELSE izminmesh = 0l379 IF n_elements(zmaxmesh) NE 0 THEN izmaxmesh = long(zmaxmesh[0]) ELSE izmaxmesh = jpkglo-1380 ;381 CASE 1 OF382 keyword_set(fbase2tbase):key_gridtype = 'c_f'383 keyword_set(ubase2tbase):key_gridtype = 'c_u'384 keyword_set(vbase2tbase):key_gridtype = 'c_v'385 else:key_gridtype = 'c'386 ENDCASE387 IF key_gridtype EQ 'c_v' OR key_gridtype EQ 'c_f' THEN BEGIN388 iymaxmesh = iymaxmesh-1389 ENDIF390 IF strlen(key_gridtype) EQ 3 THEN fullcgrid = 1391 ;392 IF ixmaxmesh LT 0 THEN ixmaxmesh = jpiglo -1 + ixmaxmesh393 IF iymaxmesh LT 0 THEN iymaxmesh = jpjglo -1 + iymaxmesh394 IF izmaxmesh LT 0 THEN izmaxmesh = jpkglo -1 + izmaxmesh395 437 ; avoid basics errors... 396 ixmaxmesh = 0 > ixmaxmesh < (jpiglo-1)397 ixminmesh = 0 > ixminmesh < ixmaxmesh398 iymaxmesh = 0 > iymaxmesh < (jpjglo-1)399 iyminmesh = 0 > iyminmesh < iymaxmesh400 izmaxmesh = 0 > izmaxmesh < (jpkglo-1)401 izminmesh = 0 > izminmesh < izmaxmesh402 ;403 jpi = ixmaxmesh-ixminmesh+1404 jpj = iymaxmesh-iyminmesh+1405 jpk = izmaxmesh-izminmesh+1406 438 ; 407 439 jpidta = jpiglo … … 468 500 ; force glamt to have 2 dimensions 469 501 ; 470 CASE size(reform(glamt), /n_dimensions) OF 471 0:glamt = replicate(glamt, jpi, jpj) 472 1:glamt = glamt[ixminmesh:ixmaxmesh]#replicate(1, jpj) 473 2:glamt = glamt[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh] 502 IF n_elements(glamt) EQ nxx*nyy THEN glamt = reform(glamt, nxx, nyy, /over) $ 503 ELSE glamt = reform(glamt, nxx, /over) 504 CASE size(glamt, /n_dimensions) OF 505 1:BEGIN 506 IF n_elements(glamt) EQ 1 THEN glamt = replicate(glamt[0], jpi, jpj) $ 507 ELSE glamt = glamt[xmin:xmax]#replicate(1, jpj) 508 END 509 2:glamt = glamt[xmin:xmax, ymin:ymax] 474 510 ENDCASE 475 511 ; keep 2d array even with degenerated dimension … … 498 534 ; force gphit to have 2 dimensions 499 535 ; 500 CASE size(reform(gphit), /n_dimensions) OF 501 0:gphit = replicate(gphit, jpi, jpj) 502 1:gphit = replicate(1, jpi)#gphit[iyminmesh:iymaxmesh] 503 2:gphit = gphit[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh] 536 IF n_elements(gphit) EQ nxx*nyy THEN gphit = reform(gphit, nxx, nyy, /over) $ 537 ELSE gphit = reform(gphit, nyy, /over) 538 CASE size(gphit, /n_dimensions) OF 539 1:BEGIN 540 IF n_elements(gphit) EQ 1 THEN gphit = replicate(gphit[0], jpi, jpj) $ 541 ELSE gphit = replicate(1, jpi)#gphit[ymin:ymax] 542 END 543 2:gphit = gphit[xmin:xmax, ymin:ymax] 504 544 ENDCASE 505 545 ; keep 2d array even with degenerated dimension … … 990 1030 END 991 1031 ELSE:BEGIN 992 gdept = zaxis[ izminmesh:izmaxmesh]1032 gdept = zaxis[zmin:zmax] 993 1033 IF n_elements(zreverse) EQ 0 THEN BEGIN 994 1034 IF jpk GT 1 THEN BEGIN … … 1028 1068 ; 1029 1069 if tmask[0] NE -1 then BEGIN 1070 tmask = byte(temporary(tmask)) 1030 1071 IF keyword_set(romsh) THEN tmask = tmask[0:jpiglo-1, 0:jpjglo-1] 1031 IF n_elements(mask) EQ jpiglo*jpjglo AND jpkgloGT 1 THEN BEGIN1032 tmask = tmask[*]#replicate(1 , jpkglo)1033 tmask = reform(tmask, jpiglo, jpjglo, jpkglo, /overwrite)1072 IF n_elements(mask) EQ nxx*nyy AND nzz GT 1 THEN BEGIN 1073 tmask = tmask[*]#replicate(1b, nzz) 1074 tmask = reform(tmask, nxx, nyy, nzz, /overwrite) 1034 1075 ENDIF 1035 IF jpiglo EQ 1 OR jpjglo EQ 1 THEN tmask = reform(tmask, jpiglo, jpjglo, jpkglo, /overwrite)1036 tmask = byte(tmask[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh, izminmesh:izmaxmesh])1037 tmask = reform(tmask, jpi, jpj, jpk, /over)1076 IF nxx EQ 1 OR nyy EQ 1 OR nzz EQ 1 THEN tmask = reform(tmask, nxx, nyy, nzz, /overwrite) 1077 tmask = tmask[xmin:xmax, ymin:ymax, zmin:zmax] 1078 IF jpi EQ 1 OR jpj EQ 1 OR jpk EQ 1 THEN tmask = reform(tmask, jpi, jpj, jpk, /over) 1038 1079 if key_shift NE 0 then tmask = shift(tmask, key_shift, 0, 0) 1039 1080 ; because tmask = reverse(tmask, 2) is not working if the 3rd … … 1242 1283 ENDELSE 1243 1284 IF keyword_set(romsh) THEN $ 1244 romszinfos = {h:romsh[ ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh], zeta:replicate(0., jpi, jpj), theta_s:-1, theta_b:-1, hc:-1} $1285 romszinfos = {h:romsh[xmin:xmax, ymin:ymax], zeta:replicate(0., jpi, jpj), theta_s:-1, theta_b:-1, hc:-1} $ 1245 1286 ELSE romszinfos = {h:-1, zeta:-1, theta_s:-1, theta_b:-1, hc:-1} 1246 1287
Note: See TracChangeset
for help on using the changeset viewer.