Changeset 5745
- Timestamp:
- Sep 8, 2008, 3:55:57 PM (16 years ago)
- Location:
- anuga_core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/anuga_user_manual.tex
r5744 r5745 3030 3030 \begin{itemize} 3031 3031 \item \code{x} and \code{y}: coordinates of the points, represented as Numeric arrays 3032 \item \code{permutation}: Original indices of the points as specified by 3033 the optional \code{ordering\_file} 3034 (see the function \code{urs2sts} in Section \ref{sec:basicfileconversions}). 3035 3032 3036 \item \code{elevation}, a Numeric array storing bed-elevations 3033 3037 % Refer here to the example to be provided in describing the simple example … … 3178 3182 Module: \module{shallow\_water.data\_manager} 3179 3183 3180 Takes urs data in (timeseries data in mux2 format) and converts it to STS format. 3184 Takes urs data in (timeseries data in mux2 format) and converts it to STS format. The optional filename \code{ordering\_filename} specifies the permutation of indices of points to select along with their longitudes and latitudes. This permutation will also be 3185 stored in the STS file. If absent, all points are taken and the permutation will be trivial, i.e. $0, 1, \ldots, N-1$, where $N$ is the total number of points stored. 3181 3186 \end{funcdesc} 3182 3187 -
anuga_core/source/anuga/shallow_water/data_manager.py
r5736 r5745 5207 5207 number_of_longitudes = longitudes.shape[0] # Number longitudes 5208 5208 5209 5210 # The permutation vector of contains original indices 5211 # as given in ordering file or None in which case points 5212 # are assigned the trivial indices enumerating them from 5213 # 0 to number_of_points-1 5214 if permutation is None: 5215 permutation = arange(number_of_points, typecode=Int) 5216 5217 5209 5218 # NetCDF file definition 5210 5219 outfile = NetCDFFile(stsname, 'w') … … 5254 5263 5255 5264 elevation = resize(elevation,outfile.variables['elevation'][:].shape) 5265 outfile.variables['permutation'][:] = permutation 5256 5266 outfile.variables['x'][:] = x - geo_ref.get_xllcorner() 5257 5267 outfile.variables['y'][:] = y - geo_ref.get_yllcorner() … … 5768 5778 5769 5779 # Variable definitions 5780 outfile.createVariable('permutation', Int, ('number_of_points',)) 5770 5781 outfile.createVariable('x', sts_precision, ('number_of_points',)) 5771 5782 outfile.createVariable('y', sts_precision, ('number_of_points',)) -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r5734 r5745 6822 6822 elevation = fid.variables['elevation'][:] 6823 6823 time=fid.variables['time'][:]+fid.starttime 6824 6825 6826 # Check that stored permutation is as per default 6827 permutation = range(len(x)) 6828 stored_permutation = fid.variables['permutation'][:] 6829 msg = 'Permutation was not stored correctly. I got ' 6830 msg += str(stored_permutation) 6831 assert allclose(stored_permutation, permutation), msg 6824 6832 6825 6833 # get quantity data from sts file … … 7020 7028 # Note, the sts info is not gridded. It is point data. 7021 7029 fid = NetCDFFile(sts_file) 7030 7031 # Check that original indices have been stored 7032 stored_permutation = fid.variables['permutation'][:] 7033 msg = 'Permutation was not stored correctly. I got ' 7034 msg += str(stored_permutation) 7035 assert allclose(stored_permutation, permutation), msg 7036 7022 7037 7023 7038 # Make x and y absolute … … 7359 7374 7360 7375 #------------------------------------------------------------ 7361 # Now read the mux files one by one with 7376 # Now read the mux files one by one without weights and test 7362 7377 7363 7378 # Call urs2sts with mux file #0 … … 7372 7387 fid = NetCDFFile(sts_file) 7373 7388 7389 # Check that original indices have been stored 7390 stored_permutation = fid.variables['permutation'][:] 7391 msg = 'Permutation was not stored correctly. I got ' 7392 msg += str(stored_permutation) 7393 assert allclose(stored_permutation, permutation), msg 7394 7395 7396 7397 7374 7398 # Make x and y absolute 7375 7399 x = fid.variables['x'][:] … … 7476 7500 sts_file = base_nameI + '.sts' 7477 7501 fid = NetCDFFile(sts_file) 7478 7502 7503 # Check that original indices have been stored 7504 stored_permutation = fid.variables['permutation'][:] 7505 msg = 'Permutation was not stored correctly. I got ' 7506 msg += str(stored_permutation) 7507 assert allclose(stored_permutation, permutation), msg 7508 7479 7509 # Make x and y absolute 7480 7510 x = fid.variables['x'][:]
Note: See TracChangeset
for help on using the changeset viewer.