Changeset 7770 for trunk/anuga_core/source/anuga/file_conversion/urs2sww.py
- Timestamp:
- Jun 2, 2010, 5:17:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/file_conversion/urs2sww.py
r7758 r7770 1 import numpy as num 2 from Scientific.IO.NetCDF import NetCDFFile 3 4 from anuga.file.urs import Read_urs 5 6 from anuga.coordinate_transforms.redfearn import redfearn, \ 7 convert_from_latlon_to_utm 8 9 from anuga.geospatial_data.geospatial_data import ensure_absolute, \ 10 Geospatial_data 11 12 from mux import WAVEHEIGHT_MUX_LABEL, EAST_VELOCITY_LABEL, \ 13 NORTH_VELOCITY_LABEL 14 15 from anuga.utilities.numerical_tools import ensure_numeric 16 17 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a, \ 18 netcdf_float 19 20 from sww_file import Read_sww, Write_sww 21 22 1 23 ################################################################################ 2 24 # CONVERTING UNGRIDDED URS DATA TO AN SWW FILE 3 25 ################################################################################ 4 5 WAVEHEIGHT_MUX_LABEL = '-z-mux'6 EAST_VELOCITY_LABEL = '-e-mux'7 NORTH_VELOCITY_LABEL = '-n-mux'8 26 9 27 ## … … 95 113 mux = {} 96 114 for quantity, file in map(None, quantities, files_in): 97 mux[quantity] = Urs_points(file)115 mux[quantity] = Read_urs(file) 98 116 99 117 # Could check that the depth is the same. (hashing) … … 143 161 for i in range(a_mux.time_step_count): 144 162 mux_times.append(a_mux.time_step * i) 145 (mux_times_start_i, mux_times_fin_i) = mux2sww_time(mux_times, mint, maxt)163 (mux_times_start_i, mux_times_fin_i) = read_time_from_mux(mux_times, mint, maxt) 146 164 times = mux_times[mux_times_start_i:mux_times_fin_i] 147 165 … … 209 227 210 228 # Do some conversions while writing the sww file 229 230 231 def read_time_from_mux(mux_times, mint, maxt): 232 """ 233 Read a list of mux times. 234 Return start and finish times which lie within the passed time period. 235 """ 236 237 if mint == None: 238 mux_times_start_i = 0 239 else: 240 mux_times_start_i = num.searchsorted(mux_times, mint) 241 242 if maxt == None: 243 mux_times_fin_i = len(mux_times) 244 else: 245 maxt += 0.5 # so if you specify a time where there is 246 # data that time will be included 247 mux_times_fin_i = num.searchsorted(mux_times, maxt) 248 249 return mux_times_start_i, mux_times_fin_i 250
Note: See TracChangeset
for help on using the changeset viewer.