- Timestamp:
- 09/20/16 20:15:00 (8 years ago)
- Location:
- trunk/SRC
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Grid/computegrid.pro
r499 r501 264 264 ;- 265 265 PRO computegrid, startx, starty, stepxin, stepyin, nxin, nyin $ 266 , XAXIS =xaxis, YAXIS=yaxis, ZAXIS=zaxis, ZZAXIS=zzaxis $267 , MASK =mask, GLAMBOUNDARY=glamboundary $268 , XMINMESH =xminmesh, XMAXMESH=xmaxmesh $269 , YMINMESH =yminmesh, YMAXMESH=ymaxmesh $270 , ZMINMESH =zminmesh, ZMAXMESH=zmaxmesh $271 , ONEARTH =onearth, PERIODIC=periodic $272 , PLAIN =plain, SHIFT=shift, STRIDE=stride $273 , YREVERSE =yreverse, ZREVERSE=zreverse $274 , FULLCGRID =fullcgrid, XYINDEX=xyindex $275 , UBASE2TBASE =ubase2tbase, VBASE2TBASE=vbase2tbase $276 , FBASE2TBASE =fbase2tbase, FFBASE2TBASE=ffbase2tbase $277 , STRCALLING =strcalling, ROMSH=romsh, _EXTRA=ex266 , XAXIS = xaxis, YAXIS = yaxis, ZAXIS = zaxis, ZZAXIS = zzaxis $ 267 , MASK = mask, GLAMBOUNDARY = glamboundary $ 268 , XMINMESH = xminmesh, XMAXMESH = xmaxmesh $ 269 , YMINMESH = yminmesh, YMAXMESH = ymaxmesh $ 270 , ZMINMESH = zminmesh, ZMAXMESH = zmaxmesh $ 271 , ONEARTH = onearth, PERIODIC = periodic $ 272 , PLAIN = plain, SHIFT = shift, STRIDE = stride $ 273 , YREVERSE = yreverse, ZREVERSE = zreverse $ 274 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 275 , UBASE2TBASE = ubase2tbase, VBASE2TBASE = vbase2tbase $ 276 , FBASE2TBASE = fbase2tbase, FFBASE2TBASE = ffbase2tbase $ 277 , STRCALLING = strcalling, ROMSH = romsh, _EXTRA = ex 278 278 ; 279 279 compile_opt idl2, strictarrsubs … … 432 432 nzz = jpk 433 433 ENDIF ELSE BEGIN 434 jpkglo = long(nz)434 jpkglo = long(nz) 435 435 IF n_elements(zminmesh) NE 0 THEN izminmesh = long(zminmesh[0]) ELSE izminmesh = 0l 436 436 IF n_elements(zmaxmesh) NE 0 THEN izmaxmesh = long(zmaxmesh[0]) ELSE izmaxmesh = jpkglo-1 … … 570 570 ; check the periodicity if iyminmesh and iymaxmesh have the default definitions... 571 571 IF NOT keyword_set(plain) AND key_onearth EQ 1 $ 572 AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo-1 AND jpj GE 3 AND jpi GE 2 THEN BEGIN572 AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo-1 AND jpj GE 3 AND jpi GE 2 THEN BEGIN 573 573 574 574 CASE 1 OF 575 575 ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 $ 576 AND array_equal(gphit[1:*, jpj-1], reverse(gphit[1:*, jpj-3])) EQ 1:BEGIN576 AND array_equal(gphit[1:*, jpj-1], reverse(gphit[1:*, jpj-3])) EQ 1:BEGIN 577 577 ; T pivot 578 578 ymaxmesh = -1 … … 586 586 END 587 587 ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 $ 588 AND array_equal(gphit[*, jpj-1], reverse(gphit[*, jpj-2])) EQ 1:BEGIN588 AND array_equal(gphit[*, jpj-1], reverse(gphit[*, jpj-2])) EQ 1:BEGIN 589 589 ; F pivot 590 590 ymaxmesh = -1 … … 604 604 ; check x periodicity... 605 605 ;==================================================== 606 IF n_elements(periodic) NE 0 THEN forcenoperio = 1 - keyword_set(periodic)606 IF n_elements(periodic) NE 0 THEN forcenoperio = 1 - keyword_set(periodic) 607 607 ; check the periodicity if ixminmesh and ixmaxmesh have the default definitions... 608 608 IF NOT keyword_set(plain) AND NOT keyword_set(forcenoperio) AND key_onearth EQ 1 $ … … 610 610 CASE 0 OF 611 611 total((glamt[0, *] - glamt[jpi-2, *]) MOD 360) $ 612 + total((glamt[1, *] - glamt[jpi-1, *]) MOD 360):BEGIN612 + total((glamt[1, *] - glamt[jpi-1, *]) MOD 360):BEGIN 613 613 xminmesh = 1 614 614 xmaxmesh = -1 … … 685 685 IF array_equal(sort(xtest), lindgen(jpi)) EQ 0 THEN BEGIN 686 686 ras = report(['WARNING: we cannot sort the xaxis with a simple shift...', $ 687 'we force key_periodic = 0 and key_shift = 0', $688 'only horizontal plot may be ok...'])687 'we force key_periodic = 0 and key_shift = 0', $ 688 'only horizontal plot may be ok...']) 689 689 key_periodic = 0 690 690 xnotsorted = 1 … … 751 751 ELSE:BEGIN 752 752 if (keyword_set(key_onearth) AND keyword_set(xnotsorted)) $ 753 OR (keyword_set(key_periodic) AND key_irregular) then BEGIN753 OR (keyword_set(key_periodic) AND key_irregular) then BEGIN 754 754 stepxf = (glamt + 720) MOD 360 755 755 IF jpj EQ 1 THEN stepxf = reform(stepxf, jpi, jpj, /over) … … 758 758 stepxf = min(abs(stepxf), dimension = 3) 759 759 IF NOT keyword_set(key_periodic) THEN $ 760 stepxf[jpi-1, *] = stepxf[jpi-2, *]760 stepxf[jpi-1, *] = stepxf[jpi-2, *] 761 761 ENDIF ELSE BEGIN 762 762 stepxf = shift(glamt, -1, -1) - glamt 763 763 IF keyword_set(key_periodic) THEN $ 764 stepxf[jpi-1, *] = 360 + stepxf[jpi-1, *] $764 stepxf[jpi-1, *] = 360 + stepxf[jpi-1, *] $ 765 765 ELSE stepxf[jpi-1, *] = stepxf[jpi-2, *] 766 766 ENDELSE … … 797 797 IF jpi GT 1 THEN BEGIN 798 798 if NOT keyword_set(key_periodic) THEN $ 799 stepyf[jpi-1, *] = stepyf[jpi-2, *]799 stepyf[jpi-1, *] = stepyf[jpi-2, *] 800 800 stepyf[jpi-1, jpj-1] = stepyf[jpi-2, jpj-2] 801 801 ENDIF … … 831 831 e1t = 0.5*(stepxu+shift(stepxu, 1, 0)) 832 832 IF NOT keyword_set(key_periodic) THEN $ 833 e1t[0, *] = e1t[1, *]833 e1t[0, *] = e1t[1, *] 834 834 ENDIF ELSE e1t = replicate(stepx, jpi, jpj) 835 835 ENDIF ELSE e1t = replicate(1b, jpi, jpj) … … 857 857 IF jpj EQ 1 THEN e2t = reform(e2t, jpi, jpj, /over) 858 858 ; 859 ;==================================================== 860 ; def of glamu: defined as the middle of T(i,j) T(i+1,j) 861 ;==================================================== 862 ; 863 IF keyword_set(irregular) THEN BEGIN 864 glamu = glamt + 0.5 * stepxu 865 IF keyword_set(glamboundary) AND key_onearth THEN $ 866 glamu = glamboundary[0] > temporary(glamu) < glamboundary[1] 867 ENDIF ELSE glamu = glamf 868 ; 869 IF jpj EQ 1 THEN glamu = reform(glamu, jpi, jpj, /over) 870 ; 871 ;==================================================== 872 ; def of gphiu: defined as the middle of T(i,j) T(i+1,j) 873 ;==================================================== 874 ; 875 IF jpi GT 1 THEN BEGIN 876 ; we must compute stepyu: y distance between T(i+1,j) T(i,j) 877 IF keyword_set(key_irregular) THEN BEGIN 878 stepyu = shift(gphit, -1, 0) - gphit 879 IF NOT keyword_set(key_periodic) THEN $ 880 stepyu[jpi-1, *] = stepyu[jpi-2, *] 881 gphiu = gphit + 0.5 * stepyu 882 ENDIF ELSE gphiu = gphit 883 ENDIF ELSE gphiu = gphit 884 IF key_onearth THEN gphiu = -90. > gphiu < 90. 885 ; 886 IF jpj EQ 1 THEN gphiu = reform(gphiu, jpi, jpj, /over) 887 ; 888 ;==================================================== 889 ; def of glamv: defined as the middle of T(i,j) T(i,j+1) 890 ;==================================================== 891 ; 892 IF jpj GT 1 THEN BEGIN 893 ; we must compute stepxv: x distance between T(i,j) T(i,j+1) 894 IF keyword_set(irregular) THEN BEGIN 895 IF keyword_set(key_periodic) THEN BEGIN 896 stepxv = (glamt + 720) MOD 360 897 stepxv = shift(stepxv, 0, -1) - stepxv 898 stepxv = [ [[stepxv]], [[stepxv + 360]], [[stepxv - 360]] ] 899 stepxv = min(abs(stepxv), dimension = 3) 900 ENDIF ELSE stepxv = shift(glamt, 0, -1) - glamt 901 stepxv[*, jpj-1] = stepxv[*, jpj-2] 902 glamv = glamt + 0.5 * stepxv 903 IF keyword_set(glamboundary) AND key_onearth THEN $ 904 glamv = glamboundary[0] > temporary(glamv) < glamboundary[1] 905 ENDIF ELSE glamv = glamt 906 ENDIF ELSE glamv = glamt 907 ; 908 ;==================================================== 909 ; def of gphiv: defined as the middle of T(i,j) T(i,j+1) 910 ;==================================================== 911 ; 912 IF keyword_set(key_irregular) THEN $ 913 gphiv = gphit + 0.5 * stepyv $ 914 ELSE gphiv = gphif 915 IF key_onearth THEN gphiv = -90. > gphiv < 90. 916 ; 917 IF jpj EQ 1 THEN gphiv = reform(gphiv, jpi, jpj, /over) 918 859 919 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 IF keyword_set(fullcgrid) THEN BEGIN 861 ; 862 ;==================================================== 863 ; def of glamu: defined as the middle of T(i,j) T(i+1,j) 864 ;==================================================== 865 ; 866 IF keyword_set(irregular) THEN BEGIN 867 glamu = glamt + 0.5 * stepxu 868 IF keyword_set(glamboundary) AND key_onearth THEN $ 869 glamu = glamboundary[0] > temporary(glamu) < glamboundary[1] 870 ENDIF ELSE glamu = glamf 871 ; 872 IF jpj EQ 1 THEN glamu = reform(glamu, jpi, jpj, /over) 873 ; 874 ;==================================================== 875 ; def of gphiu: defined as the middle of T(i,j) T(i+1,j) 876 ;==================================================== 877 ; 878 IF jpi GT 1 THEN BEGIN 879 ; we must compute stepyu: y distance between T(i+1,j) T(i,j) 880 IF keyword_set(key_irregular) THEN BEGIN 881 stepyu = shift(gphit, -1, 0) - gphit 882 IF NOT keyword_set(key_periodic) THEN $ 883 stepyu[jpi-1, *] = stepyu[jpi-2, *] 884 gphiu = gphit + 0.5 * stepyu 885 ENDIF ELSE gphiu = gphit 886 ENDIF ELSE gphiu = gphit 887 IF key_onearth THEN gphiu = -90. > gphiu < 90. 888 ; 889 IF jpj EQ 1 THEN gphiu = reform(gphiu, jpi, jpj, /over) 890 ; 891 ;==================================================== 892 ; def of glamv: defined as the middle of T(i,j) T(i,j+1) 893 ;==================================================== 894 ; 895 IF jpj GT 1 THEN BEGIN 896 ; we must compute stepxv: x distance between T(i,j) T(i,j+1) 897 IF keyword_set(irregular) THEN BEGIN 898 IF keyword_set(key_periodic) THEN BEGIN 899 stepxv = (glamt + 720) MOD 360 900 stepxv = shift(stepxv, 0, -1) - stepxv 901 stepxv = [ [[stepxv]], [[stepxv + 360]], [[stepxv - 360]] ] 902 stepxv = min(abs(stepxv), dimension = 3) 903 ENDIF ELSE stepxv = shift(glamt, 0, -1) - glamt 904 stepxv[*, jpj-1] = stepxv[*, jpj-2] 905 glamv = glamt + 0.5 * stepxv 906 IF keyword_set(glamboundary) AND key_onearth THEN $ 907 glamv = glamboundary[0] > temporary(glamv) < glamboundary[1] 908 ENDIF ELSE glamv = glamt 909 ENDIF ELSE glamv = glamt 910 ; 911 ;==================================================== 912 ; def of gphiv: defined as the middle of T(i,j) T(i,j+1) 913 ;==================================================== 914 ; 915 IF keyword_set(key_irregular) THEN $ 916 gphiv = gphit + 0.5 * stepyv $ 917 ELSE gphiv = gphif 918 IF key_onearth THEN gphiv = -90. > gphiv < 90. 919 ; 920 IF jpj EQ 1 THEN gphiv = reform(gphiv, jpi, jpj, /over) 920 IF keyword_set(fullcgrid) THEN BEGIN 921 921 ; 922 922 ;==================================================== … … 925 925 ; 926 926 IF jpi GT 1 AND n_elements(stepx) NE 1 THEN $ 927 e1u = stepxu ELSE e1u = e1t927 e1u = stepxu ELSE e1u = e1t 928 928 ; 929 929 ;==================================================== … … 1004 1004 ; 1005 1005 IF keyword_set(key_onearth) THEN BEGIN 1006 e1t = r * !pi/180. * temporary(e1t) * cos(!pi/180.*gphit) 1007 IF keyword_set(fullcgrid) THEN BEGIN 1008 e1u = r * !pi/180. * temporary(e1u) * cos(!pi/180.*gphiu) 1009 e1v = r * !pi/180. * temporary(e1v) * cos(!pi/180.*gphiv) 1010 e1f = r * !pi/180. * temporary(e1f) * cos(!pi/180.*gphif) 1011 ENDIF 1006 IF keyword_set(key_irregular) THEN BEGIN 1007 ; T 1008 e1t = map_npoints(glamu, gphiu, shift(glamu, 1, 0), shift(gphiu, 1, 0), /two_by_two) 1009 e1t = reform(e1t, jpi, jpj, /over) 1010 IF NOT keyword_set(key_periodic) THEN e1t[0, *] = e1t[1, *] 1011 e2t = map_npoints(glamv, gphiv, shift(glamv, 0, 1), shift(gphiv, 0, 1), /two_by_two) 1012 e2t = reform(e2t, jpi, jpj, /over) 1013 e2t[*, 0] = e2t[*, 1] 1014 IF keyword_set(fullcgrid) THEN BEGIN 1015 ; U 1016 e1u = map_npoints(glamt, gphit, shift(glamt, -1, 0), shift(gphit, -1, 0), /two_by_two) 1017 e1u = reform(e1u, jpi, jpj, /over) 1018 IF NOT keyword_set(key_periodic) THEN e1u[jpi-1, *] = e1u[jpi-2, *] 1019 e2u = map_npoints(glamf, gphif, shift(glamf, 0, 1), shift(gphif, 0, 1), /two_by_two) 1020 e2u = reform(e2u, jpi, jpj, /over) 1021 e2u[*, 0] = e2u[*, 1] 1022 ; V 1023 e1v = map_npoints(glamf, gphif, shift(glamf, 1, 0), shift(gphif, 1, 0), /two_by_two) 1024 e1v = reform(e1v, jpi, jpj, /over) 1025 IF NOT keyword_set(key_periodic) THEN e1v[0, *] = e1v[1, *] 1026 e2v = map_npoints(glamt, gphit, shift(glamt, 0, -1), shift(gphit, 0, -1), /two_by_two) 1027 e2v = reform(e2v, jpi, jpj, /over) 1028 e2v[*, jpj-1] = e2v[*, jpj-2] 1029 ; F 1030 e1f = map_npoints(glamv, gphiv, shift(glamv, -1, 0), shift(gphiv, -1, 0), /two_by_two) 1031 e1f = reform(e1f, jpi, jpj, /over) 1032 IF NOT keyword_set(key_periodic) THEN e1f[jpi-1, *] = e1f[jpi-2, *] 1033 e2f = map_npoints(glamu, gphiu, shift(glamu, 0, -1), shift(gphiu, 0, -1), /two_by_two) 1034 e2f = reform(e2f, jpi, jpj, /over) 1035 e2f[*, jpj-1] = e2f[*, jpj-2] 1036 ENDIF 1037 1038 ENDIF ELSE BEGIN 1039 e1t = r * !pi/180. * temporary(e1t) * cos(!pi/180.*gphit) 1040 IF keyword_set(fullcgrid) THEN BEGIN 1041 e1u = r * !pi/180. * temporary(e1u) * cos(!pi/180.*gphiu) 1042 e1v = r * !pi/180. * temporary(e1v) * cos(!pi/180.*gphiv) 1043 e1f = r * !pi/180. * temporary(e1f) * cos(!pi/180.*gphif) 1044 ENDIF 1045 ENDELSE 1012 1046 ENDIF 1013 1047 ; … … 1042 1076 ; z axis 1043 1077 ; 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 ; 1064 1065 1066 1067 1068 1069 1070 1071 1072 1078 CASE n_elements(zaxis) OF 1079 0:BEGIN 1080 gdept = 0. 1081 key_zreverse = 0 1082 END 1083 1:BEGIN 1084 gdept = zaxis 1085 key_zreverse = 0 1086 END 1087 ELSE:BEGIN 1088 gdept = zaxis[zmin:zmax] 1089 IF n_elements(zreverse) EQ 0 THEN BEGIN 1090 IF jpk GT 1 THEN BEGIN 1091 if gdept[0] GT gdept[1] then key_zreverse = 1 ELSE key_zreverse = 0 1092 ENDIF ELSE key_zreverse = 0 1093 ENDIF ELSE key_zreverse = zreverse 1094 IF keyword_set(key_zreverse) THEN gdept = reverse(gdept) 1095 END 1096 ENDCASE 1097 ; 1098 if n_elements(gdept) GT 1 then BEGIN 1099 stepz = shift(gdept, -1)-gdept 1100 stepz[jpk-1] = stepz[jpk-2] 1101 gdepw = 0. > (gdept-stepz/2.) 1102 ENDIF ELSE BEGIN 1103 stepz = 1. 1104 gdepw = gdept 1105 ENDELSE 1106 IF keyword_set(romsh) THEN gdepw = gdept 1073 1107 ; 1074 1108 ;==================================================== … … 1076 1110 ;==================================================== 1077 1111 ; 1078 1079 1080 1081 1082 1112 e3t = stepz 1113 IF n_elements(stepz) GT 1 THEN BEGIN 1114 e3w = 0.5*(stepz+shift(stepz, 1)) 1115 e3w[0] = 0.5*e3t[0] 1116 ENDIF ELSE e3w = e3t 1083 1117 ; 1084 1118 ;==================================================== … … 1228 1262 IF jpi GT 1 THEN BEGIN 1229 1263 if (keyword_set(key_onearth) AND keyword_set(xnotsorted)) $ 1230 OR (keyword_set(key_periodic) AND key_irregular) then BEGIN1264 OR (keyword_set(key_periodic) AND key_irregular) then BEGIN 1231 1265 stepxf = (glamt + 720) MOD 360 1232 1266 stepxf = shift(stepxf, -1, -1) - stepxf … … 1234 1268 stepxf = min(abs(stepxf), dimension = 3) 1235 1269 IF NOT keyword_set(key_periodic) THEN $ 1236 stepxf[jpi-1, *] = stepxf[jpi-2, *]1270 stepxf[jpi-1, *] = stepxf[jpi-2, *] 1237 1271 ENDIF ELSE BEGIN 1238 1272 stepxf = shift(glamt, -1, -1) - glamt 1239 1273 IF keyword_set(key_periodic) THEN $ 1240 stepxf[jpi-1, *] = 360 + stepxf[jpi-1, *] $1241 1274 stepxf[jpi-1, *] = 360 + stepxf[jpi-1, *] $ 1275 ELSE stepxf[jpi-1, *] = stepxf[jpi-2, *] 1242 1276 ENDELSE 1243 1277 IF jpj GT 1 THEN BEGIN … … 1259 1293 IF jpi GT 1 THEN BEGIN 1260 1294 if NOT keyword_set(key_periodic) THEN $ 1261 stepyf[jpi-1, *] = stepyf[jpi-2, *]1295 stepyf[jpi-1, *] = stepyf[jpi-2, *] 1262 1296 stepyf[jpi-1, jpj-1] = stepyf[jpi-2, jpj-2] 1263 1297 ENDIF … … 1316 1350 ; 1317 1351 IF total(tmask) EQ jpi*jpj*jpk $ 1318 AND NOT keyword_set(key_irregular) THEN triangles_list = -1 $1352 AND NOT keyword_set(key_irregular) THEN triangles_list = -1 $ 1319 1353 ELSE BEGIN 1320 1354 ; are we using ORCA2 ? … … 1357 1391 1358 1392 ccmeshparameters = {filename:strcalling $ 1359 , glaminfo:float(string(glaminfo, format = '(E11.4)')) $1360 , gphiinfo:float(string(gphiinfo, format = '(E11.4)')) $1361 , jpiglo:jpiglo, jpjglo:jpjglo, jpkglo:jpkglo $1362 , jpi:jpi, jpj:jpj, jpk:jpk $1363 , ixminmesh:ixminmesh, ixmaxmesh:ixmaxmesh $1364 , iyminmesh:iyminmesh, iymaxmesh:iymaxmesh $1365 , izminmesh:izminmesh, izmaxmesh:izmaxmesh $1366 , key_shift:key_shift, key_periodic:key_periodic $1367 , key_stride:key_stride, key_gridtype:key_gridtype $1368 , key_yreverse:key_yreverse, key_zreverse:key_zreverse $1369 , key_partialstep:key_partialstep, key_onearth:key_onearth}1393 , glaminfo:float(string(glaminfo, format = '(E11.4)')) $ 1394 , gphiinfo:float(string(gphiinfo, format = '(E11.4)')) $ 1395 , jpiglo:jpiglo, jpjglo:jpjglo, jpkglo:jpkglo $ 1396 , jpi:jpi, jpj:jpj, jpk:jpk $ 1397 , ixminmesh:ixminmesh, ixmaxmesh:ixmaxmesh $ 1398 , iyminmesh:iyminmesh, iymaxmesh:iymaxmesh $ 1399 , izminmesh:izminmesh, izmaxmesh:izmaxmesh $ 1400 , key_shift:key_shift, key_periodic:key_periodic $ 1401 , key_stride:key_stride, key_gridtype:key_gridtype $ 1402 , key_yreverse:key_yreverse, key_zreverse:key_zreverse $ 1403 , key_partialstep:key_partialstep, key_onearth:key_onearth} 1370 1404 1371 1405 ccreadparameters = {funclec_name:'read_ncdf' $ 1372 , jpidta:jpidta, jpjdta:jpjdta, jpkdta:jpkdta $1373 , ixmindta:ixmindta, ixmaxdta:ixmaxdta $1374 , iymindta:iymindta, iymaxdta:iymaxdta $1375 , izmindta:izmindta, izmaxdta:izmaxdta}1406 , jpidta:jpidta, jpjdta:jpjdta, jpkdta:jpkdta $ 1407 , ixmindta:ixmindta, ixmaxdta:ixmaxdta $ 1408 , iymindta:iymindta, iymaxdta:iymaxdta $ 1409 , izmindta:izmindta, izmaxdta:izmaxdta} 1376 1410 ;------------------------------------------------------------ 1377 1411 IF keyword_set(key_performance) EQ 1 THEN $ 1378 print, 'time computegrid', systime(1)-time11412 print, 'time computegrid', systime(1)-time1 1379 1413 ;------------------------------------------------------------ 1380 1414 return -
trunk/SRC/Grid/ncdf_meshroms.pro
r493 r501 273 273 nothing = execute(command) 274 274 ENDFOR 275 d1t = 1.e3*(shift(d1t, -1, 0) - d1t)276 d2t = 1.e3*(shift(d2t, 0, -1) - d2t)275 d1t = shift(d1t, -1, 0) - d1t 276 d2t = shift(d2t, 0, -1) - d2t 277 277 for i = 0, n_elements(namebase2)-1 do begin 278 278 command = namebase2[i]+'t = '+namebase2[i]+'t[0:jpi-2, 0:jpj-2]' … … 306 306 nothing = execute(command) 307 307 ENDFOR 308 tmpsave = 2. * 1.e3 *d1u[0, 0:jpj-2]309 d1u = 1.e3*(shift(d1u, -1, 0) - d1u)310 d2u = 1.e3*(shift(d2u, 0, -1) - d2u)308 tmpsave = 2. * d1u[0, 0:jpj-2] 309 d1u = shift(d1u, -1, 0) - d1u 310 d2u = shift(d2u, 0, -1) - d2u 311 311 for i = 0, n_elements(namebase2)-1 do begin 312 312 command = namebase2[i]+'u = '+namebase2[i]+'u[*, 0:jpj-2]' … … 342 342 nothing = execute(command) 343 343 ENDFOR 344 d1v = 1.e3*(shift(d1v, -1, 0) - d1v)345 tmpsave = 2. * 1.e3 *d2v[0:jpi-2, 0]346 d2v = 1.e3*(shift(d2v, 0, -1) - d2v)344 d1v = shift(d1v, -1, 0) - d1v 345 tmpsave = 2. * d2v[0:jpi-2, 0] 346 d2v = shift(d2v, 0, -1) - d2v 347 347 for i = 0, n_elements(namebase2)-1 do begin 348 348 command = namebase2[i]+'v = '+namebase2[i]+'v[0:jpi-2, *]' … … 372 372 nothing = execute(command) 373 373 ENDFOR 374 tmpsave1 = 2. * 1.e3 *d1f[0, *]375 d1f = 1.e3*(shift(d1f, -1, 0) - d1f)376 tmpsave2 = 2. * 1.e3 *d2f[*, 0]377 d2f = 1.e3*(shift(d2f, 0, -1) - d2f)374 tmpsave1 = 2. * d1f[0, *] 375 d1f = shift(d1f, -1, 0) - d1f 376 tmpsave2 = 2. * d2f[*, 0] 377 d2f = shift(d2f, 0, -1) - d2f 378 378 fmaskredy = byte(maskf[jpi-1, *]) 379 379 IF jpk GT 1 THEN fmaskredy = reform(fmaskredy[*]#replicate(1b, jpk), 1, jpj, jpk, /overwrite) -
trunk/SRC/Grid/romsdepth.pro
r370 r501 25 25 ; 26 26 ;- 27 FUNCTION romsdepth 27 FUNCTION romsdepth, new_s_coord = new_s_coord 28 28 ; 29 29 compile_opt idl2, strictarrsubs … … 46 46 grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 47 47 hroms = hroms[firstx:lastx, firsty:lasty] 48 nt = n_elements(zeta)/nx/ny 49 ; 50 cff1 = 1./sinh(theta_s) 51 cff2 = 0.5/tanh(0.5*theta_s) 48 nt = n_elements(zeta[firstx:lastx, firsty:lasty, *])/nx/ny 52 49 ; 53 50 IF type EQ 'W' THEN BEGIN … … 59 56 ENDELSE 60 57 ; 61 cs = (1.-theta_b)*cff1*sinh(theta_s*sc)+theta_b*(cff2*tanh(theta_s*(sc+0.5))-0.5) 62 cff = hc*(sc-cs) 63 cff1 = cs 58 IF keyword_set(new_s_coord) THEN BEGIN 59 60 IF theta_s GT 0. THEN BEGIN 61 csrf = ( 1. - cosh(theta_s*sc) ) / ( cosh(theta_s) - 1. ) 62 ENDIF ELSE BEGIN 63 csrf = - sc*sc 64 ENDELSE 65 if theta_b GT 0. THEN BEGIN 66 cs = ( exp(theta_b*csrf) - 1. ) / ( 1. - exp(-theta_b) ) 67 ENDIF ELSE BEGIN 68 cs = csrf 69 ENDELSE 70 71 hh = (hroms[*]#replicate(1., jpk)) 72 z0 = hh * ( replicate(1., nx*ny)#(hc*sc)[*] + hh * replicate(1., nx*ny)#cs[*] ) / ( hc + hh ) 73 74 75 ENDIF ELSE BEGIN 76 77 cff1 = 1./sinh(theta_s) 78 cff2 = 0.5/tanh(0.5*theta_s) 79 80 cs = (1.-theta_b)*cff1*sinh(theta_s*sc)+theta_b*(cff2*tanh(theta_s*(sc+0.5))-0.5) 81 cff = hc*(sc-cs) 82 cff1 = cs 83 84 z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk)) 85 86 ENDELSE 87 64 88 ; 65 89 hinv = 1./hroms 66 90 hinv = hinv[*]#replicate(1., jpk) 67 91 ; put a z dimension to zeta 68 zeta = transpose( temporary(zeta))92 zeta = transpose((temporary(zeta))[firstx:lastx, firsty:lasty, *]) 69 93 zeta = reform((temporary(zeta))[*]#replicate(1., jpk), nt, ny, nx, jpk, /overwrite) 70 94 zeta = transpose(temporary(zeta), [2, 1, 3, 0]) 71 95 72 z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk))73 96 z = (z0[*]#replicate(1., nt)) + temporary(zeta) * ((1.+z0*hinv)[*]#replicate(1., nt)) 74 97 z = reform(z, nx, ny, jpk, nt, /overwrite) -
trunk/SRC/Interpolation/compute_fromreg_imoms3_weigaddr.pro
r495 r501 8 8 ; Interpolation 9 9 ; 10 ; @param alonin {in}{required}{type= 2d array}10 ; @param alonin {in}{required}{type=1d array} 11 11 ; longitude of the input data 12 12 ; 13 ; @param alatin {in}{required}{type= 2d array}13 ; @param alatin {in}{required}{type=1d array} 14 14 ; latitude of the input data 15 15 ; … … 133 133 IF total(alon[indexlon] GT olon) NE 0 THEN stop 134 134 IF total(alon[indexlon + 1L] LE olon) NE 0 THEN stop 135 IF (where(indexlon L E1L ))[0] NE -1 THEN stop135 IF (where(indexlon LT 1L ))[0] NE -1 THEN stop 136 136 IF (where(indexlon GE jpia-3L))[0] NE -1 THEN stop 137 137 indexlat = value_locate(alat, olat) -
trunk/SRC/Interpolation/neighbor.pro
r371 r501 69 69 IF arg_present(distance) THEN distance = sqrt(distance) 70 70 ENDELSE 71 RETURN, where(distance EQ min(distance)) 71 minval = min(distance, indmin) 72 RETURN, indmin 72 73 END -
trunk/SRC/ReadWrite/ncdf_getatt.pro
r495 r501 58 58 ; if this attribute does not exist. 59 59 ; 60 ; @keyword interval_operation 61 ; Set this keyword to a named variable in which the value of 62 ; interval_operation is returned. Return -1 if this attribute 63 ; does not exist. 64 ; 60 65 ; @keyword _EXTRA 61 66 ; defined only to be able to call <pro>ncdf_getatt</pro> with the … … 76 81 , MISSING_VALUE = missing_value, UNITS = units, CALENDAR = calendar $ 77 82 , LONG_NAME = long_name, STANDARD_NAME = standard_name, DOUBLE = double $ 78 , _extra = ex83 , INTERVAL_OPERATION = interval_operation, _extra = ex 79 84 ; 80 85 compile_opt idl2, strictarrsubs … … 94 99 long_name = '' 95 100 standard_name = '' 101 interval_operation = -1 96 102 ; 97 103 varinq = ncdf_varinq(cdfid, varid) … … 136 142 '_fillvalue':ncdf_attget, cdfid, varid, attname, missing_value 137 143 'missing_value':ncdf_attget, cdfid, varid, attname, missing_value 144 'interval_operation':BEGIN 145 ncdf_attget, cdfid, varid, attname, tmp 146 tmp = string(tmp) 147 interval_operation = fix(strmid(tmp,0,strpos(tmp,' '))) 148 END 138 149 ELSE: 139 150 ENDCASE … … 148 159 missing_value = tmp 149 160 ENDIF ELSE BEGIN 150 ras = report('Warning: missing value is not a number: ' + missing_value) 151 missing_value = 'no' 161 ;; ras = report('Warning: missing value is not a number: ' + missing_value) 162 ;; missing_value = 'no' 163 missing_value = (byte(strlowcase(a)))[0] 152 164 ENDELSE 153 165 ENDIF -
trunk/SRC/ToBeReviewed/GRILLE/grille.pro
r495 r501 396 396 ; for the vertical sections with roms 397 397 IF keyword_set(type) AND n_elements(romszinfos) NE 0 THEN BEGIN 398 romsdp = romsdepth( )398 romsdp = romsdepth(/new_s_coord) 399 399 IF romsdp[0] NE -1 THEN BEGIN 400 400 IF jpt EQ 1 THEN BEGIN -
trunk/SRC/ToBeReviewed/LECTURE/read_ncdf.pro
r500 r501 120 120 , GRID = grid, CALLITSELF = callitself, DIREC = direc $ 121 121 , ZETAFILENAME = zetafilename, ZETAZERO = zetazero $ 122 , ZINVAR = zinvar, _EXTRA = ex122 , ZINVAR = zinvar, ISROMS = isroms, _EXTRA = ex 123 123 ; 124 124 compile_opt idl2, strictarrsubs … … 164 164 dimnames[i] = tmp 165 165 ENDFOR 166 ;------------------------------------------------------------167 ; we check if the variable has a vertical dimension and/or168 ; a record dimension. This is useful to define boxzoom169 ; keyword in domdef170 ;------------------------------------------------------------171 dummy = where(varinq.dim EQ inq.recdim, tinvar)172 ; check the presence of a vertical dimension according to the173 ; number of dimensions and the presence of a record dimension174 zinvar = (varinq.ndims EQ 3 AND tinvar NE 1) OR varinq.ndims EQ 4175 ;------------------------------------------------------------176 ; shall we redefine the grid parameters177 ;------------------------------------------------------------178 IF keyword_set(init) THEN initncdf, filename, _extra = ex179 166 ;------------------------------------------------------------ 180 167 ; check the time axis and the debut and ending dates … … 248 235 END 249 236 ENDCASE 237 IF inq.recdim EQ -1 AND jpt NE 1 THEN inq.recdim = varinq.dim[varinq.ndims-1] 238 ;------------------------------------------------------------ 239 ; we check if the variable has a vertical dimension and/or 240 ; a record dimension. This is useful to define boxzoom 241 ; keyword in domdef 242 ;------------------------------------------------------------ 243 dummy = where(varinq.dim EQ inq.recdim, tinvar) 244 ; check the presence of a vertical dimension according to the 245 ; number of dimensions and the presence of a record dimension 246 zinvar = (varinq.ndims EQ 3 AND tinvar NE 1) OR varinq.ndims EQ 4 247 ;------------------------------------------------------------ 248 ; shall we redefine the grid parameters 249 ;------------------------------------------------------------ 250 IF keyword_set(init) THEN initncdf, filename, _extra = ex 250 251 ;------------------------------------------------------------ 251 252 ; Name of the grid on which the field refer to. … … 405 406 ; if it is roms outputs, we need to get additional infos... 406 407 IF NOT keyword_set(callitself) THEN BEGIN 407 IF strmid(dimnames[0], 0, 3) EQ 'xi_' AND strmid(dimnames[1], 0, 4) EQ 'eta_'THEN BEGIN408 IF (strmid(dimnames[0], 0, 3) EQ 'xi_' AND strmid(dimnames[1], 0, 4) EQ 'eta_') OR keyword_set(isroms) THEN BEGIN 408 409 ncdf_attget, cdfid, 'theta_s', theta_s, /global 409 410 ncdf_attget, cdfid, 'theta_b', theta_b, /global -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/sbar_plot.pro
r495 r501 53 53 if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex 54 54 ; 2) I place the drawing on the screen like on the postscript 55 IF chkstru(ex, 'overplot') EQ 0 THEN placedessin, 'autre', _extra = ex $56 ELSE IF ex.overplot EQ 0 THEN placedessin, 'autre', _extra = ex55 IF chkstru(ex, 'overplot') EQ 0 THEN placedessin, 'autre', /nocolorbar, _extra = ex $ 56 ELSE IF ex.overplot EQ 0 THEN placedessin, 'autre', /nocolorbar, _extra = ex 57 57 ; 3) Drawing 58 58 if n_elements(COLORS) NE 0 then BEGIN -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/splot.pro
r495 r501 45 45 if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex 46 46 ; 2) i put the drawing on the screen like on the postscript 47 placedessin, 'autre', _extra = ex47 placedessin, 'autre', /nocolorbar, _extra = ex 48 48 ; 3) Drawing 49 49 if n_elements(y) EQ 0 then plot, x, xstyle = 1, ystyle = 1, _EXTRA = ex $
Note: See TracChangeset
for help on using the changeset viewer.