Changeset 2285 in lmdz_wrf for trunk/tools
- Timestamp:
- Jan 24, 2019, 3:01:33 PM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diagnostics.py
r2283 r2285 956 956 957 957 ncvar.insert_variable(ncobj, 'lon_bnds', cellbndsx, diagoutd, diagoutvd, newnc) 958 newnc.sync() 958 959 ncvar.insert_variable(ncobj, 'lat_bnds', cellbndsy, diagoutd, diagoutvd, newnc) 960 newnc.sync() 959 961 960 962 ovar = newnc.variables['XLONG'] 961 ovar.setncattr('bounds', 'lon_bnds ,lat_bnds')963 ovar.setncattr('bounds', 'lon_bnds lat_bnds') 962 964 ovar = newnc.variables['XLAT'] 963 ovar.setncattr('bounds', 'lon_bnds ,lat_bnds')965 ovar.setncattr('bounds', 'lon_bnds lat_bnds') 964 966 965 967 # mrso: total soil moisture SMOIS, DZS -
trunk/tools/module_ForDiagnostics.f90
r2278 r2285 1069 1069 INTEGER :: i,j,iv 1070 1070 INTEGER :: ix,ex,iy,ey 1071 REAL(r_k) :: tmpval1, tmpval2 1071 1072 CHARACTER(len=2), DIMENSION(4) :: Svertex 1072 1073 INTEGER, DIMENSION(4,2,2,2) :: indices … … 1115 1116 indices(3,2,2,2) = 1 1116 1117 ! SE 1117 indices(4,1,1,1) = 1 1118 indices(4,1,1,1) = 1 1118 1119 indices(4,1,1,2) = 1 1119 1120 indices(4,1,2,1) = -1 … … 1124 1125 indices(4,2,2,2) = -1 1125 1126 1126 DO i= 1,dx1127 DO i=2,dx-1 1127 1128 DO j=1,dy 1128 1129 DO iv=1,4 … … 1130 1131 ix = MAX(i+indices(iv,1,1,1),1) 1131 1132 !ex = MIN(i+indices(iv,1,1,2),dx) 1132 ex = i+indices(iv,1,1,2)1133 ex = MAX(i+indices(iv,1,1,2),1) 1133 1134 iy = MAX(j+indices(iv,1,2,1),1) 1134 1135 ey = MIN(j+indices(iv,1,2,2),dy) … … 1143 1144 iy = MAX(j+indices(iv,2,2,1),1) 1144 1145 !ey = MIN(i+indices(iv,2,2,2),dy) 1145 ey = j+indices(iv,2,2,2)1146 ey = MAX(j+indices(iv,2,2,2),1) 1146 1147 paral(1,1) = vlon(ix,iy) 1147 1148 paral(1,2) = vlat(ix,iy) … … 1151 1152 CALL intersection_2Dlines(merid, paral, intsct, ptintsct) 1152 1153 IF (.NOT.intsct) THEN 1153 msg = 'not inter ection found for ' // Svertex(iv) // ' vertex'1154 msg = 'not intersection found for ' // Svertex(iv) // ' vertex' 1154 1155 CALL ErrMsg(msg, fname, -1) 1155 1156 END IF 1156 1157 xbnds(i,j,iv) = ptintsct(1) 1157 1158 ybnds(i,j,iv) = ptintsct(2) 1158 END DO 1159 1160 END DO 1161 END DO 1162 END DO 1163 1164 ! Dealing with the boundary values 1165 i = 1 1166 DO j=1,dy 1167 DO iv=1,4 1168 1169 ix = MAX(i+indices(iv,1,1,1),1) 1170 !ex = MIN(i+indices(iv,1,1,2),dx) 1171 ex = MAX(i+indices(iv,1,1,2),1) 1172 iy = MAX(j+indices(iv,1,2,1),1) 1173 ey = MIN(j+indices(iv,1,2,2),dy) 1174 merid(1,1) = ulon(ix,iy) 1175 merid(1,2) = ulat(ix,iy) 1176 merid(2,1) = ulon(ex,ey) 1177 merid(2,2) = ulat(ex,ey) 1178 1179 ix = MAX(i+indices(iv,2,1,1),1) 1180 ex = MIN(i+indices(iv,2,1,2),dx) 1181 iy = MAX(j+indices(iv,2,2,1),1) 1182 !ey = MIN(i+indices(iv,2,2,2),dy) 1183 ey = MAX(j+indices(iv,2,2,2),1) 1184 IF (iv == 1 .OR. iv == 2) THEN 1185 ! Projecting values using dx from next grid point 1186 tmpval1 = vlon(2,iy) 1187 paral(2,1) = vlon(ex,ey) 1188 tmpval2 = tmpval1 - paral(2,1) 1189 paral(1,1) = paral(2,1) - tmpval2 1190 tmpval1 = vlat(2,iy) 1191 paral(2,2) = vlat(ex,ey) 1192 tmpval2 = tmpval1 - paral(2,2) 1193 paral(1,2) = paral(2,2) - tmpval2 1194 ELSE 1195 paral(1,1) = vlon(ix,iy) 1196 paral(1,2) = vlat(ix,iy) 1197 paral(2,1) = vlon(ex,ey) 1198 paral(2,2) = vlat(ex,ey) 1199 END IF 1200 1201 CALL intersection_2Dlines(merid, paral, intsct, ptintsct) 1202 IF (.NOT.intsct) THEN 1203 msg = 'not intersection found for ' // Svertex(iv) // ' vertex' 1204 CALL ErrMsg(msg, fname, -1) 1205 END IF 1206 xbnds(i,j,iv) = ptintsct(1) 1207 ybnds(i,j,iv) = ptintsct(2) 1208 1209 END DO 1210 END DO 1211 1212 i = dx 1213 DO j=1,dy 1214 DO iv=1,4 1215 1216 ix = MAX(i+indices(iv,1,1,1),1) 1217 !ex = MIN(i+indices(iv,1,1,2),dx) 1218 ex = MAX(i+indices(iv,1,1,2),1) 1219 iy = MAX(j+indices(iv,1,2,1),1) 1220 ey = MIN(j+indices(iv,1,2,2),dy) 1221 merid(1,1) = ulon(ix,iy) 1222 merid(1,2) = ulat(ix,iy) 1223 merid(2,1) = ulon(ex,ey) 1224 merid(2,2) = ulat(ex,ey) 1225 1226 ix = MAX(i+indices(iv,2,1,1),1) 1227 ex = MIN(i+indices(iv,2,1,2),dx) 1228 iy = MAX(j+indices(iv,2,2,1),1) 1229 !ey = MIN(i+indices(iv,2,2,2),dy) 1230 ey = MAX(j+indices(iv,2,2,2),1) 1231 IF (iv == 3 .OR. iv == 4) THEN 1232 ! Projecting values using dx from previous grid point 1233 tmpval1 = vlon(dx-1,iy) 1234 paral(2,1) = vlon(ex,ey) 1235 tmpval2 = tmpval1 - paral(2,1) 1236 paral(1,1) = paral(2,1) - tmpval2 1237 tmpval1 = vlat(dx-1,iy) 1238 paral(2,2) = vlat(ex,ey) 1239 tmpval2 = tmpval1 - paral(2,2) 1240 paral(1,2) = paral(2,2) - tmpval2 1241 ELSE 1242 paral(1,1) = vlon(ix,iy) 1243 paral(1,2) = vlat(ix,iy) 1244 paral(2,1) = vlon(ex,ey) 1245 paral(2,2) = vlat(ex,ey) 1246 END IF 1247 1248 CALL intersection_2Dlines(merid, paral, intsct, ptintsct) 1249 IF (.NOT.intsct) THEN 1250 msg = 'not intersection found for ' // Svertex(iv) // ' vertex' 1251 CALL ErrMsg(msg, fname, -1) 1252 END IF 1253 xbnds(i,j,iv) = ptintsct(1) 1254 ybnds(i,j,iv) = ptintsct(2) 1255 1159 1256 END DO 1160 1257 END DO
Note: See TracChangeset
for help on using the changeset viewer.