Changeset 172 for trunk/SRC/Grid/computegrid.pro
- Timestamp:
- 09/11/06 09:11:26 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Grid/computegrid.pro
r163 r172 4 4 ;+ 5 5 ; 6 ; @file_comments compute the grid parameters from cm_4mesh common: 7 ; 8 ; computegrid, startx, starty, stepx, stepy, nx, ny 9 ; computegrid, startx, starty, stepx, stepy 10 ; computegrid, xaxis = xaxis, yaxis = yaxis 11 ; or a suitable mix... 12 ; 13 ; glamt 14 ; glamf 15 ; gphit 16 ; gphit 17 ; e1t 18 ; e2t 19 ; horizontal parameters 20 ; 21 ; glamu {in} 22 ; glamv {in} 23 ; gphiu {in} 24 ; gphiv {in} 25 ; e1u {in} 26 ; e1v {in} 27 ; e1f {in} 28 ; e2u {in} 29 ; e2v {in} 30 ; e2f {in} 31 ; horizontal parameters if FULLCGRID keyword is defined 32 ; 33 ; gdept 34 ; gdepw 35 ; e3t 36 ; e3w 37 ; verticals parameters 38 ; 6 ; @file_comments 7 ; 8 ; compute the grid parameters (cm_4mesh) common 9 ; 10 ; domains sizes: 11 ;--------------- 12 ; jpi, jpj, jpk, jpiglo, jpjglo, jpkglo, jpidta, jpjdta, jpkdta 13 ; 14 ; domains positions regarding to the original grid: 15 ;-------------------------------------------------- 16 ; ixminmesh, ixmaxmesh, iyminmesh, iymaxmesh, izminmesh, izmaxmesh 17 ; ixmindta, ixmaxdta, iymindta, iymaxdta, izmindta, izmaxdta 18 ; 19 ; horizontal parameters: 20 ; ---------------------- 21 ; glamt, glamf, gphit, gphit, e1t, e2t 22 ; 23 ; additional horizontal parameters if FULLCGRID keyword is defined: 24 ; ----------------------------------------------------------------- 25 ; glamu, glamv, gphiu, gphiv, e1u, e1v, e1f, e2u, e2v, e2f 26 ; 27 ; verticals parameters: 28 ; --------------------- 29 ; gdept, gdepw, e3t, e3w 30 ; 31 ; masks: 32 ; ------ 39 33 ; tmask 40 ; masks 41 ; 42 ; umaskred {in} 43 ; vmaskred {in} 44 ; fmaskredx {in} 45 ; fmaskredy {in} 46 ; masks if FULLCGRID keyword is defined 47 ; 48 ; triangles_list 34 ; 35 ; additional masks if FULLCGRID keyword is defined: 36 ; ------------------------------------------------- 37 ; umaskred, vmaskred, fmaskredx, fmaskredy 38 ; 39 ; triangles_list: 40 ; --------------- 49 41 ; triangulation 42 ; 43 ; key_* variables: 44 ; ---------------- 45 ; key_onearth, key_periodic, key_shift, key_stride, key_partialstep, 46 ; key_yreverse, key_zreverse, key_gridtype 47 ; 48 ; xxx related variables: 49 ; ---------------------- 50 ; ccmeshparameters, ccreadparameters 50 51 ; 51 52 ; @categories 52 53 ; Grid 53 54 ; 54 ; @param startx {in}{required} scalar, x starting point 55 ; @param starty {in}{required} scalar, y starting point 56 ; @param stepxin {in}{required} scalar or vector: x direction step, must be > 0 57 ; if vector nx is not used 58 ; @param stepyin {in}{required} scalar or vector: y direction step, 59 ; could be > 0 (south to north) or < 0 (north to south) 60 ; if vector ny is not used 61 ; @param nxin {in}{required} scalar, number of points in x direction 62 ; @param nyin {in}{required} scalar, number of points in y direction 63 ; 64 ; @keyword FULLCGRID activate to specify that you want to compute 65 ; all the parameters of a C grid. Computation of glam[uv], 66 ; gphi[uv], e1[uvf], e2[uvf], [uv]maskred and fmaskred[xy] 67 ; will be add to the default computations 68 ; 69 ; @keyword GLAMBOUNDARY a 2 elements vector, [lon1,lon2], the longitude 70 ; boundaries that should be used to visualize the data. 71 ; we must have lon2 > lon1 and lon2 - lon1 le 360 72 ; key_shift will be defined automaticaly computed according to 73 ; glamboundary by using the FIRST LINE of glamt but 74 ; key_shift will /= 0 only if key_periodic = 1 75 ; 76 ; @keyword MASK to specify the mask with a 2 or 3 dimension array 77 ; 78 ; @keyword ONEARTH {default= key_onearth=1} 79 ; = 0 or 1 to force the manual definition of 80 ; key_onearth (to specify if the data are on earth -> use longitude 81 ; /latitude etc...). 82 ; note that ONEARTH = 0 forces PERIODIC = 0, SHIFT = 0, 83 ; and is cancelling GLAMBOUNDARY 84 ; 85 ; @keyword PERIODIC {default=key_periodic is automatically computed by using the first line of glamt} 86 ; = 0 or 1 to force the manual definition of key_periodic. 87 ; 88 ; @keyword PLAIN force PERIODIC = 0, SHIFT = 0, STRIDE = [1, 1, 1] and 55 ; @param startx {in}{optional}{type=scalar} 56 ; x starting point, optional if [XY]AXIS keyword is used 57 ; 58 ; @param starty {in}{optional}{type=scalar} 59 ; y starting point, optional if [XY]AXIS keyword is used 60 ; 61 ; @param stepxin {in}{optional}{type=scalar or vector} 62 ; x direction step, optional if [XY]AXIS keyword is used, must be > 0 63 ; if stepxin is a vector nx is not used 64 ; 65 ; @param stepyin {in}{optional}{type=scalar or vector} 66 ; y direction step, optional if [XY]AXIS keyword is used, 67 ; could be > 0 (south to north) or < 0 (north to south) 68 ; if stepyin is a vector ny is not used 69 ; 70 ; @param nxin {in}{optional}{type=scalar} 71 ; number of points in x direction, 72 ; optional if [XY]AXIS keyword is used or stepxin is a vector 73 ; 74 ; @param nyin {in}{optional}{type=scalar} 75 ; number of points in y direction, 76 ; optional if [XY]AXIS keyword is used or stepyin is a vector 77 ; 78 ; @keyword FULLCGRID {default=0}{type=scalar: 0 or 1} 79 ; Activate to specify that you want to compute all the C grid parameters: 80 ; definition of glam[uv], gphi[uv], e1[uvf], e2[uvf], [uv]maskred and 81 ; fmaskred[xy] will be add to the default computations 82 ; 83 ; @keyword GLAMBOUNDARY {default=those defined in the file}{type=2 elements vector} 84 ; Longitude boundaries that should be used to visualize the data. 85 ; lon2 > lon1 86 ; lon2 - lon1 le 360 87 ; By default, the common (cm_4mesh) variable key_shift will be automatically 88 ; defined according to GLAMBOUNDARY. 89 ; 90 ; @keyword MASK {default=array of 1}{type=2D or 3D array} 91 ; Specify the land(0)/sea(1) mask 92 ; 93 ; @keyword ONEARTH {default=1}{type=scalar: 0 or 1} 94 ; Force the manual definition of data localization on the earth or not 95 ; 0) if the data are not on the earth 96 ; 1) if the data are on earth (in that case we can for example use 97 ; the labels 'longitude', 'latitude' in plots). 98 ; The resulting value will be stored in the common (cm_4mesh) variable key_onearth 99 ; ONEARTH = 0 forces PERIODIC = 0, SHIFT = 0 and is cancelling GLAMBOUNDARY 100 ; 101 ; @keyword PERIODIC {default=computed by using the first line of glamt}{type=scalar: 0 or 1} 102 ; Force the manual definition of the grid zonal periodicity. 103 ; The resulting value will be stored in the common (cm_4mesh) variable key_periodic 104 ; PERIODIC = 0 forces SHIFT = 0 105 ; 106 ; @keyword PLAIN {default=0}{type=scalar: 0 or 1} 107 ; Force PERIODIC = 0, SHIFT = 0, STRIDE = [1, 1, 1] and 89 108 ; suppress the automatic redefinition of the domain in case of 90 109 ; x periodicity overlap, y periodicity overlap (ORCA type only) 91 110 ; and mask border to 0. 92 111 ; 93 ; @keyword SHIFT = scalar to force the manual definition of key_shift. By94 ; default, key_shift is automatically computed according to95 ; glamboundary (when defined) by using the FIRST LINE of glamt. if96 ; key_periodic=0 then in any case key_shift = 0.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. 114 ; The resulting value will be stored in the common (cm_4mesh) variable key_shift 115 ; Note that if key_periodic=0 then in any case key_shift = 0. 97 116 ; 98 117 ; @keyword STRCALLING {type=string} … … 100 119 ; call computegrid (this is used by xxx.pro) 101 120 ; 102 ; @keyword STRIDE {default=[1, 1, 1]} a 3 elements vector to specify the stride in x, y, z 103 ; direction. The resulting value 104 ; will be stored in the common (cm_4mesh) variable key_stride 105 ; 106 ; @keyword XAXIS to specify longitude1 with a 1 or 2 dimension array, in 107 ; this case startx, stepx and nx are not used but could be 108 ; necessary if the y axis is not defined with yaxis. It must be 109 ; possible to sort the first line of xaxis in the increasing 110 ; order by shifting its elements. 111 ; 112 ; @keyword YAXIS to specify latitudes with a 1 or 2 dimension array, in 113 ; this case starty, stepy and ny are not used but starty and 114 ; stepy could be necessary if the x axis is not defined with xaxis. 115 ; It must be sorted in the increasing or deceasing order 116 ; (along each column if 2d array). 121 ; @keyword STRIDE {default=[1, 1, 1]}{type=3 elements vector} 122 ; Specify the stride in x, y and z direction. The resulting 123 ; value will be stored in the common (cm_4mesh) variable key_stride 124 ; 125 ; @keyword XAXIS {type=1D or 2D array} 126 ; Specify longitudes in this case startx, stepx and nx are not used but 127 ; could be necessary if the y axis is not defined with yaxis. It must be 128 ; possible to sort the first line of xaxis in the increasing order by 129 ; shifting its elements. 130 ; 131 ; @keyword YAXIS {type=1D or 2D array} 132 ; Specify latitudes in this case starty, stepy and ny are not used but 133 ; starty and stepy could be necessary if the x axis is not defined with 134 ; xaxis. It must be sorted in the increasing or deceasing order (along each column if 2d array). 117 135 ; 118 136 ; @keyword XYINDEX activate to specify that the horizontal grid should … … 121 139 ; using this keyword forces key_onearth=0 122 140 ; 123 ; @keyword XMINMESH {default=0L} 124 ; @keyword YMINMESH {default=0L} 125 ; @keyword ZMINMESH {default=0L} 126 ; to define the common variables i[xyz]minmesh 127 ; used to define the grid only in a zoomed part of the original 128 ; grid. max value is [XYZ]MAXMESH 129 ; 130 ; @keyword XMAXMESH {default=jpiglo-1} 131 ; @keyword YMAXMESH {default=jpjglo-1} 132 ; @keyword ZMAXMESH {default=jpkglo-1} 133 ; to define the common variables i[xyz]maxmesh 134 ; used to define the grid only in a zoomed part of the original 135 ; grid. max value is jp[ijk]glo-1. 136 ; if [XYZ]MAXMESH is negative, then we define i[xyz]maxmesh as 137 ; jp[ijk]glo - 1 + [XYZ]MAXMESH instead of [XYZ]MAXMESH 141 ; @keyword XMINMESH {default=0L}{type=scalar} 142 ; Define common (cm_4mesh) variables ixminmesh used to define the localization 143 ; of the first point of the grid along the x direction in a zoom of the original grid 144 ; 145 ; @keyword YMINMESH {default=0L}{type=scalar} 146 ; Define common (cm_4mesh) variables iyminmesh used to define the localization 147 ; of the first point of the grid along the y direction in a zoom of the original grid 148 ; 149 ; @keyword ZMINMESH {default=0L}{type=scalar} 150 ; Define common (cm_4mesh) variables izminmesh used to define the localization 151 ; of the first point of the grid along the z direction in a zoom of the original grid 152 ; 153 ; @keyword XMAXMESH {default=jpiglo-1}{type=scalar} 154 ; Define common (cm_4mesh) variables ixmaxmesh used to define the localization 155 ; of the last point of the grid along the x direction in a zoom of the original grid 156 ; 157 ; @keyword YMAXMESH {default=jpjglo-1}{type=scalar} 158 ; Define common (cm_4mesh) variables iymaxmesh used to define the localization 159 ; of the last point of the grid along the y direction in a zoom of the original grid 160 ; 161 ; @keyword ZMAXMESH {default=jpkglo-1}{type=scalar} 162 ; Define common (cm_4mesh) variables izmaxmesh used to define the localization 163 ; of the last point of the grid along the z direction in a zoom of the original grid 138 164 ; 139 165 ; @keyword FBASE2TBASE 140 ; 141 ; @keyword STRCALLING 142 ; 143 ; @keyword ZAXIS to specify the vertical axis with a 1 dimension 144 ; array. Must be sorted in the increasing or deceasing order 145 ; 146 ; @keyword _EXTRA used to pass your keywords to the created function. 166 ; Activate when the model is a C grid based on a F point 167 ; (with a F point at the bottom-left corner and a T point at the 168 ; upper-right corner). In this case, we ignore 169 ; - the first line of F and U points 170 ; - the first column of F and V points 171 ; - the last line of T and U points 172 ; - the last column of T and V points. 173 ; => we are back to a C grid based on T point as for OPA model. 174 ; 175 ; @keyword ROMSH {type=2D array} 176 ; This array is the final bathymetry at RHO-points. It is stored in the common 177 ; variable (cm_4mesh) romszinfos.h 178 ; Used when the model is a ROMS C-grid with one more point 179 ; in longitude for T and V grid and one more point in latitude 180 ; for T and U grid. In this case, we ignore 181 ; - the last line of T and U points 182 ; - the last column of T and V points. 183 ; => we are back to a C grid based on T point as for OPA model. 184 ; Note that activate ROMSH forces FULLCGRID=1 185 ; 186 ; @keyword STRCALLING {type=scalar string} 187 ; Used by xxx... 188 ; 189 ; @keyword ZAXIS {type=1D} 190 ; Specify the vertical axis. Must be sorted in the increasing or deceasing order 191 ; 192 ; @keyword _EXTRA 193 ; (not used in the present case...) 147 194 ; 148 195 ; @uses cm_4mesh cm_4data cm_4cal … … 156 203 ; to use cell_fill = 1). 157 204 ; 158 ; @restrictions FUV points definition ...205 ; @restrictions FUV points definition is not exact if the grid is irregular 159 206 ; 160 207 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) … … 179 226 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 180 227 , FBASE2TBASE = fbase2tbase, STRCALLING = strcalling $ 181 , _extra = ex228 , ROMSH = romsh, _extra = ex 182 229 ;--------------------------------------------------------- 183 230 ; … … 276 323 jpjglo = long(ny) 277 324 jpkglo = long(nz) 325 IF keyword_set(romsh) THEN BEGIN 326 jpiglo = jpiglo - 1 327 jpjglo = jpjglo - 1 328 fullcgrid = 1 329 ENDIF 278 330 ; 279 331 ; impact of plain keyword: … … 484 536 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 485 537 , FBASE2TBASE = fbase2tbase, STRCALLING = strcalling $ 486 , _extra = ex538 , ROMSH = romsh, _extra = ex 487 539 return 488 540 ENDIF … … 910 962 gdepw = gdept 911 963 ENDELSE 964 IF keyword_set(romsh) THEN gdepw = gdept 912 965 ; 913 966 ;==================================================== … … 926 979 ; 927 980 ; default mask eq 1 928 if NOT keyword_set(mask) then mask = -1 929 ; 930 if mask[0] NE -1 then BEGIN 931 tmask = byte(mask[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh, izminmesh:izmaxmesh]) 981 if NOT keyword_set(mask) then tmask = -1 ELSE tmask = mask 982 IF keyword_set(romsh) AND tmask[0] NE -1 THEN tmask = tmask[0:jpiglo-1, 0:jpjglo-1] 983 IF array_equal(size(tmask, /dimensions), [jpiglo, jpjglo]) EQ 1 AND jpkglo GT 1 THEN BEGIN 984 tmask = tmask[*]#replicate(1, jpkglo) 985 tmask = reform(tmask, jpiglo, jpjglo, jpkglo, /overwrite) 986 ENDIF 987 ; 988 if tmask[0] NE -1 then BEGIN 989 tmask = byte(tmask[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh, izminmesh:izmaxmesh]) 932 990 tmask = reform(tmask, jpi, jpj, jpk, /over) 933 991 if key_shift NE 0 then tmask = shift(tmask, key_shift, 0, 0) … … 976 1034 , FULLCGRID = fullcgrid, XYINDEX = xyindex $ 977 1035 , FBASE2TBASE = fbase2tbase, STRCALLING = strcalling $ 978 , _extra = ex1036 , ROMSH = romsh, _extra = ex 979 1037 return 980 1038 ENDIF … … 1131 1189 gphiinfo = gphit 1132 1190 ENDELSE 1191 IF keyword_set(romsh) THEN $ 1192 romszinfos = {h:romsh[ixminmesh:ixmaxmesh, iyminmesh:iymaxmesh], zeta:replicate(0., jpi, jpj), theta_s:-1, theta_b:-1, hc:-1} $ 1193 ELSE romszinfos = {h:-1, zeta:-1, theta_s:-1, theta_b:-1, hc:-1} 1194 1133 1195 ccmeshparameters = {filename:strcalling $ 1134 1196 , glaminfo:float(string(glaminfo, format = '(E11.4)')) $
Note: See TracChangeset
for help on using the changeset viewer.