Changeset 930 for inundation/ga/storm_surge/pyvolution/data_manager.py
- Timestamp:
- Feb 18, 2005, 6:12:32 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/data_manager.py
r928 r930 1096 1096 minlon = None, maxlon =None, 1097 1097 mint = None, maxt = None, mean_stage = 0, 1098 origin = (0,0,0,0,0)):1098 origin = None): 1099 1099 """Convert 'Ferret' NetCDF format for wave propagation to 1100 1100 sww format native to pyvolution. … … 1110 1110 To include a value min may equal it, while max must exceed it. 1111 1111 1112 origin is a 3-tuple with geo referenced 1113 UTM coordinates (zone, easting, northing) 1112 origin is a 5-tuple with geo referenced 1113 UTM coordinates (zone, easting, northing, false_easting, false_northing) 1114 1115 nc format has values organised as HA[TIME, LATITUDE, LONGITUDE] 1116 which means that longitude is the fastest 1117 varying dimension (row major order, so to speak) 1118 1119 ferret2sww uses grid points as vertices in a triangular grid 1120 counting vertices from lower left corner upwards, then right 1114 1121 """ 1115 1122 … … 1161 1168 else: 1162 1169 lmax = searchsorted(longitudes, maxlon) 1163 1170 1171 times = times[jmin:jmax] 1164 1172 latitudes = latitudes[kmin:kmax] 1165 1173 longitudes = longitudes[lmin:lmax] 1166 times = times[jmin:jmax] 1174 1167 1175 1168 1176 if verbose: print 'cropping' … … 1171 1179 yspeed = file_v.variables['VA'][jmin:jmax, kmin:kmax, lmin:lmax] 1172 1180 1181 number_of_times = times.shape[0] 1173 1182 number_of_latitudes = latitudes.shape[0] 1174 1183 number_of_longitudes = longitudes.shape[0] 1175 1184 1185 assert amplitudes.shape[0] == number_of_times 1186 assert amplitudes.shape[1] == number_of_latitudes 1187 assert amplitudes.shape[2] == number_of_longitudes 1176 1188 1177 1189 #print times … … 1254 1266 1255 1267 #Check zone boundaries 1256 refzone, _, _ = redfearn(latitudes[0],longitudes[0], 1257 false_easting=origin[3], 1258 false_northing=origin[4]) 1259 1268 if origin is None: 1269 refzone, _, _ = redfearn(latitudes[0],longitudes[0]) 1270 else: 1271 refzone, _, _ = redfearn(latitudes[0],longitudes[0], 1272 false_easting=origin[3], 1273 false_northing=origin[4]) 1274 1260 1275 1261 1276 1262 1277 vertices = {} 1263 for l, lon in enumerate(longitudes): 1264 for k, lat in enumerate(latitudes): 1278 for k, lat in enumerate(latitudes): 1279 for l, lon in enumerate(longitudes): 1280 1265 1281 vertices[l,k] = i 1266 1267 zone, easting, northing = redfearn(lat,lon, 1268 false_easting=origin[3], 1269 false_northing=origin[4]) 1282 1283 if origin is None: 1284 zone, easting, northing = redfearn(lat,lon) 1285 else: 1286 zone, easting, northing = redfearn(lat,lon, 1287 false_easting=origin[3], 1288 false_northing=origin[4]) 1270 1289 1271 1290 msg = 'Zone boundary crossed at longitude =', lon … … 1319 1338 for j in range(len(times)): 1320 1339 i = 0 1321 for l in range(number_of_longitudes):1322 for k in range(number_of_latitudes):1340 for k in range(number_of_latitudes): 1341 for l in range(number_of_longitudes): 1323 1342 h = amplitudes[j,k,l]/100 + mean_stage 1324 1343 stage[j,i] = h
Note: See TracChangeset
for help on using the changeset viewer.