diff --git a/examples/tsunami/bowl-radial/maketopo.py b/examples/tsunami/bowl-radial/maketopo.py index d1d618a09..f1ccdcf74 100644 --- a/examples/tsunami/bowl-radial/maketopo.py +++ b/examples/tsunami/bowl-radial/maketopo.py @@ -3,7 +3,7 @@ Module to create topo and qinit data files for this example. """ -from clawpack.geoclaw import topotools +from clawpack.geoclaw.topotools import Topography from numpy import * def maketopo(): @@ -17,7 +17,11 @@ def maketopo(): yupper = 100.e0 ylower = -100.e0 outfile= "bowl.topotype2" - topotools.topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints) + + topography = Topography(topo_func=topo) + topography.x = linspace(xlower,xupper,nxpoints) + topography.y = linspace(ylower,yupper,nypoints) + topography.write(outfile, topo_type=2, Z_format="%22.15e") def makeqinit(): """ @@ -30,7 +34,11 @@ def makeqinit(): yupper = 50.e0 ylower = -50.e0 outfile= "hump.xyz" - topotools.topo1writer(outfile,qinit,xlower,xupper,ylower,yupper,nxpoints,nypoints) + + topography = Topography(topo_func=qinit) + topography.x = linspace(xlower,xupper,nxpoints) + topography.y = linspace(ylower,yupper,nypoints) + topography.write(outfile, topo_type=1) def topo(x,y): """ diff --git a/examples/tsunami/bowl-slosh/maketopo.py b/examples/tsunami/bowl-slosh/maketopo.py index 4bf655450..afe8deb9d 100644 --- a/examples/tsunami/bowl-slosh/maketopo.py +++ b/examples/tsunami/bowl-slosh/maketopo.py @@ -3,7 +3,7 @@ Module to create topo and qinit data files for this example. """ -from clawpack.geoclaw.topotools import topo1writer, topo2writer +from clawpack.geoclaw.topotools import Topography from numpy import * #from pyclaw.data import Data @@ -26,7 +26,12 @@ def maketopo(): xlower = -2.e0 ylower = -2.e0 outfile= "bowl.topotype2" - topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints) + + topography = Topography(topo_func=topo) + topography.x = linspace(xlower,xupper,nxpoints) + topography.y = linspace(ylower,yupper,nypoints) + topography.write(outfile, topo_type=2, Z_format="%22.15e") + def topo(x,y): """ diff --git a/src/python/geoclaw/etopotools.py b/src/python/geoclaw/etopotools.py index 16d4e2817..a3111a170 100644 --- a/src/python/geoclaw/etopotools.py +++ b/src/python/geoclaw/etopotools.py @@ -59,7 +59,7 @@ def etopo1_download(xlimits, ylimits, dx=0.0166666666667, dy=None, \ y1,y2 = ylimits if file_name is None: - file_name = 'etopo1_%i_%i_%i_%i_%imin.tt3' \ + file_name = 'etopo1_%i_%i_%i_%i_%imin.asc' \ % (int(round(x1)),int(round(x2)),int(round(y1)),int(round(y2)),\ int(round(60*dx))) diff --git a/src/python/geoclaw/topotools.py b/src/python/geoclaw/topotools.py index c54baddc9..580a13207 100644 --- a/src/python/geoclaw/topotools.py +++ b/src/python/geoclaw/topotools.py @@ -788,8 +788,8 @@ def read_header(self): return num_cells - def write(self, path, no_data_value=None, topo_type=None, masked=True, - header_style='geoclaw'): + def write(self, path, topo_type=None, no_data_value=None, masked=True, + header_style='geoclaw', Z_format="%15.7e"): r"""Write out a topography file to path of type *topo_type*. Writes out a topography file of topo type specified with *topo_type* or @@ -799,13 +799,25 @@ def write(self, path, no_data_value=None, topo_type=None, masked=True, :Input: - *path* (str) - file to write - - *no_data_value* - values used to indicate missing data - *topo_type* (int) - GeoClaw format topo_type + **Note:** this is second positional argument, agreeing with + the read function in this class. It was the third argument in + GeoClaw version 5.3.1 and earlier. + - *no_data_value* - values used to indicate missing data - *masked* (bool) - unused?? - *header_style* (str) - indicates format of header lines 'geoclaw' or 'default' ==> write value then label 'arcgis' or 'asc' ==> write label then value (needed for .asc files in ArcGIS) + - *Z_format* (str) - string format to use for Z values + The default format "%15.7e" gives at least millimeter precision + for topography with abs(Z) < 10000 and results in + smaller files than the previous default of "%22.15e" used in + GeoClaw version 5.3.1 and earlier. A shorter format can be used + if the user knows there are fewer significant digits, e.g. + etopo1 data is integers and so has a resolution of 1 meter. + In this case a cropped or coarsened version might be written + with `Z_format = "%7i"`, for example. """ @@ -883,23 +895,25 @@ def write(self, path, no_data_value=None, topo_type=None, masked=True, # Write out topography data if topo_type == 2: + Z_format = Z_format + "\n" if masked_Z: Z_filled = numpy.flipud(self.Z.filled()) else: Z_filled = numpy.flipud(self.Z) for i in xrange(self.Z.shape[0]): for j in xrange(self.Z.shape[1]): - outfile.write("%22.15e\n" % Z_filled[i,j]) + outfile.write(Z_format % Z_filled[i,j]) if masked_Z: del Z_filled elif topo_type == 3: + Z_format = Z_format + " " if masked_Z: Z_flipped = numpy.flipud(self.Z.filled()) else: Z_flipped = numpy.flipud(self.Z) for i in xrange(self.Z.shape[0]): for j in xrange(self.Z.shape[1]): - outfile.write("%22.15e " % (Z_flipped[i,j])) + outfile.write(Z_format % (Z_flipped[i,j])) outfile.write("\n") if masked_Z: del Z_flipped @@ -1414,7 +1428,7 @@ def smooth_data(self, indices, r=1): self.Z[index[0], index[1]] = summation / num_points - def crop(self, filter_region): + def crop(self, filter_region=None, coarsen=1): r"""Crop region to *filter_region* Create a new Topography object that is identical to this one but cropped @@ -1429,6 +1443,10 @@ def crop(self, filter_region): if self.unstructured: raise NotImplemented("*** Cannot currently crop unstructured topo") + if filter_region is None: + # only want to coarsen, so this is entire region: + filter_region = [self.x[0],self.x[-1],self.y[0],self.y[-1]] + # Find indices of region region_index = [None, None, None, None] region_index[0] = (self.x >= filter_region[0]).nonzero()[0][0] @@ -1437,8 +1455,8 @@ def crop(self, filter_region): region_index[3] = (self.y <= filter_region[3]).nonzero()[0][-1] + 1 newtopo = Topography() - newtopo._x = self._x[region_index[0]:region_index[1]] - newtopo._y = self._y[region_index[2]:region_index[3]] + newtopo._x = self._x[region_index[0]:region_index[1]:coarsen] + newtopo._y = self._y[region_index[2]:region_index[3]:coarsen] # Force regeneration of 2d coordinate arrays and extent if needed newtopo._X = None @@ -1446,8 +1464,8 @@ def crop(self, filter_region): newtopo._extent = None # Modify Z array as well - newtopo._Z = self._Z[region_index[2]:region_index[3], - region_index[0]:region_index[1]] + newtopo._Z = self._Z[region_index[2]:region_index[3]:coarsen, + region_index[0]:region_index[1]:coarsen] newtopo.unstructured = self.unstructured newtopo.topo_type = self.topo_type diff --git a/tests/bowl_slosh/maketopo.py b/tests/bowl_slosh/maketopo.py index 4bf655450..855b6df03 100644 --- a/tests/bowl_slosh/maketopo.py +++ b/tests/bowl_slosh/maketopo.py @@ -3,7 +3,8 @@ Module to create topo and qinit data files for this example. """ -from clawpack.geoclaw.topotools import topo1writer, topo2writer +from clawpack.geoclaw.topotools import Topography + from numpy import * #from pyclaw.data import Data @@ -26,7 +27,10 @@ def maketopo(): xlower = -2.e0 ylower = -2.e0 outfile= "bowl.topotype2" - topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints) + topography = Topography(topo_func=topo) + topography.x = linspace(xlower,xupper,nxpoints) + topography.y = linspace(ylower,yupper,nypoints) + topography.write(outfile, topo_type=2, Z_format="%22.15e") def topo(x,y): """ diff --git a/tests/bowl_slosh/regression_data/regression_data.txt b/tests/bowl_slosh/regression_data/regression_data.txt deleted file mode 100644 index 6d3cad183..000000000 --- a/tests/bowl_slosh/regression_data/regression_data.txt +++ /dev/null @@ -1,55 +0,0 @@ -1.000000000000000000e+00 2.000000000000000000e+00 0.000000000000000000e+00 7.497748999999999386e-02 0.000000000000000000e+00 5.251100999999999686e-02 2.500000000000000139e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.000000000000000048e-04 7.498449000000000086e-02 -7.355607999999999727e-06 5.251590999999999898e-02 2.500700000000000145e-02 -1.000000000000000000e+00 2.000000000000000000e+00 8.759849999999999581e-03 7.558763999999999761e-02 -6.468796999999999655e-04 5.293693000000000010e-02 2.561015000000000166e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.741969999999999977e-02 7.618316999999999450e-02 -1.296505000000000097e-03 5.334458000000000255e-02 2.620569000000000023e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.607954999999999995e-02 7.677103999999999873e-02 -1.955928000000000007e-03 5.373867999999999701e-02 2.679354999999999931e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.473939999999999667e-02 7.735119999999999496e-02 -2.624843999999999875e-03 5.411904000000000020e-02 2.737370999999999902e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.339925000000000033e-02 7.792356000000000282e-02 -3.302943999999999932e-03 5.448544000000000304e-02 2.794606999999999994e-02 -1.000000000000000000e+00 2.000000000000000000e+00 5.205909999999999704e-02 7.848800000000000221e-02 -3.989916999999999943e-03 5.483758999999999856e-02 2.851050999999999933e-02 -1.000000000000000000e+00 2.000000000000000000e+00 6.071895000000000070e-02 7.904440999999999551e-02 -4.685446000000000229e-03 5.517522999999999872e-02 2.906691999999999956e-02 -1.000000000000000000e+00 2.000000000000000000e+00 6.937880000000000436e-02 7.959270000000000234e-02 -5.389208000000000366e-03 5.549814000000000136e-02 2.961522000000000113e-02 -1.000000000000000000e+00 2.000000000000000000e+00 7.803865000000000107e-02 8.013281999999999350e-02 -6.100880999999999839e-03 5.580617999999999690e-02 3.015533999999999923e-02 -1.000000000000000000e+00 2.000000000000000000e+00 8.669849999999999779e-02 8.066473000000000393e-02 -6.820139000000000236e-03 5.609920000000000184e-02 3.068724000000000104e-02 -1.000000000000000000e+00 2.000000000000000000e+00 9.753441999999999668e-02 8.131881000000000526e-02 -7.729625000000000384e-03 5.644533999999999663e-02 3.134133000000000058e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.083703000000000027e-01 8.195979999999999932e-02 -8.649841000000000127e-03 5.676740000000000258e-02 3.198230999999999991e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.192061999999999983e-01 8.258749999999999425e-02 -9.580108999999999847e-03 5.706503000000000270e-02 3.261002000000000345e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.300421999999999967e-01 8.320175999999999961e-02 -1.051973999999999965e-02 5.733786999999999912e-02 3.322427000000000019e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.387317999999999885e-01 8.368441999999999548e-02 -1.128005999999999974e-02 5.753794999999999743e-02 3.370693000000000300e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.474215000000000109e-01 8.415831000000000006e-02 -1.204559000000000012e-02 5.772184000000000342e-02 3.418082000000000065e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.561111000000000026e-01 8.462339000000000666e-02 -1.281596999999999945e-02 5.788945000000000202e-02 3.464590000000000031e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.648007999999999973e-01 8.507961999999999470e-02 -1.359081999999999998e-02 5.804070000000000062e-02 3.510213000000000222e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.734903999999999891e-01 8.552693999999999575e-02 -1.436978000000000040e-02 5.817549000000000331e-02 3.554945999999999801e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.822098000000000051e-01 8.596678000000000652e-02 -1.515514999999999918e-02 5.829411000000000315e-02 3.598929000000000017e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.909290999999999905e-01 8.639752000000000542e-02 -1.594390000000000043e-02 5.839595999999999676e-02 3.642002999999999907e-02 -1.000000000000000000e+00 2.000000000000000000e+00 1.996485000000000065e-01 8.681909000000000154e-02 -1.673565000000000122e-02 5.848091999999999874e-02 3.684160000000000212e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.083678999999999948e-01 8.723132000000000108e-02 -1.753000999999999865e-02 5.854876999999999998e-02 3.725383000000000167e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.170872000000000079e-01 8.763403000000000165e-02 -1.832657000000000036e-02 5.859924999999999856e-02 3.765654999999999697e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.280465000000000131e-01 8.812699000000000227e-02 -1.932984999999999912e-02 5.863907000000000147e-02 3.814950999999999759e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.390057999999999905e-01 8.860601999999999367e-02 -2.033555999999999905e-02 5.865345999999999754e-02 3.862854000000000287e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.499649999999999928e-01 8.907258999999999316e-02 -2.134331999999999896e-02 5.864495000000000124e-02 3.909511000000000236e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.609242999999999979e-01 8.952632000000000645e-02 -2.235236000000000167e-02 5.861314000000000107e-02 3.954884000000000177e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.697571000000000274e-01 8.987794999999999812e-02 -2.316531999999999966e-02 5.856302000000000035e-02 3.990047000000000038e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.785899000000000014e-01 9.020685000000000509e-02 -2.397459000000000048e-02 5.847532999999999898e-02 4.022935999999999873e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.874226999999999754e-01 9.052620999999999585e-02 -2.478293999999999983e-02 5.837122000000000144e-02 4.054872000000000337e-02 -1.000000000000000000e+00 2.000000000000000000e+00 2.962555000000000049e-01 9.084293000000000229e-02 -2.559182999999999944e-02 5.826194999999999985e-02 4.086544000000000287e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.050882999999999790e-01 9.115492000000000039e-02 -2.640042999999999904e-02 5.814455000000000318e-02 4.117743000000000098e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.139928000000000163e-01 9.146008999999999389e-02 -2.721368999999999871e-02 5.801093999999999695e-02 4.148260000000000142e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.228974000000000011e-01 9.175339999999999885e-02 -2.802390000000000089e-02 5.785835999999999757e-02 4.177590999999999943e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.318019999999999858e-01 9.203429999999999944e-02 -2.883039999999999908e-02 5.768619999999999998e-02 4.205681000000000003e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.407065000000000232e-01 9.230254000000000236e-02 -2.963259000000000032e-02 5.749419000000000057e-02 4.232505000000000295e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.496111000000000080e-01 9.255850000000000188e-02 -3.043008999999999992e-02 5.728293000000000273e-02 4.258101000000000247e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.608576000000000006e-01 9.286561000000000121e-02 -3.143006000000000272e-02 5.699024999999999924e-02 4.288812000000000180e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.721040999999999932e-01 9.315616999999999648e-02 -3.242214000000000207e-02 5.666957000000000244e-02 4.317868999999999874e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.833504999999999829e-01 9.343234999999999735e-02 -3.340664000000000133e-02 5.632153000000000159e-02 4.345486999999999961e-02 -1.000000000000000000e+00 2.000000000000000000e+00 3.945969999999999756e-01 9.369655999999999818e-02 -3.438466999999999912e-02 5.594571999999999740e-02 4.371906999999999877e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.037089999999999845e-01 9.390344000000000468e-02 -3.517321000000000336e-02 5.561984999999999846e-02 4.392594999999999833e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.128209999999999935e-01 9.410562000000000094e-02 -3.595939000000000080e-02 5.527446999999999916e-02 4.412814000000000320e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.219330000000000025e-01 9.430418999999999607e-02 -3.674418000000000128e-02 5.490948999999999830e-02 4.432669999999999666e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.310450000000000115e-01 9.449987999999999444e-02 -3.752768000000000076e-02 5.452506000000000019e-02 4.452239999999999670e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.401570000000000205e-01 9.469297000000000131e-02 -3.830929000000000278e-02 5.412113999999999814e-02 4.471548000000000189e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.493903000000000203e-01 9.488580000000000625e-02 -3.909949000000000063e-02 5.369142999999999832e-02 4.490830999999999990e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.586237000000000230e-01 9.507496999999999476e-02 -3.988735000000000197e-02 5.324144000000000099e-02 4.509748000000000229e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.678570000000000229e-01 9.525773999999999353e-02 -4.067109000000000002e-02 5.277248999999999829e-02 4.528026000000000273e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.770904000000000256e-01 9.543002999999999902e-02 -4.144714000000000037e-02 5.228635999999999701e-02 4.545255000000000128e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.863237000000000254e-01 9.558595000000000286e-02 -4.220904000000000322e-02 5.178409999999999958e-02 4.560846999999999818e-02 -1.000000000000000000e+00 2.000000000000000000e+00 4.931618999999999864e-01 9.568722000000000338e-02 -4.276104000000000016e-02 5.140154000000000251e-02 4.570973999999999871e-02 diff --git a/tests/bowl_slosh/regression_tests.py b/tests/bowl_slosh/regression_tests.py index 940799625..a4ceb542c 100644 --- a/tests/bowl_slosh/regression_tests.py +++ b/tests/bowl_slosh/regression_tests.py @@ -33,7 +33,8 @@ def setUp(self): topo.topo_type = 2 topo.x = numpy.linspace(-2.0, 2.0, 200) topo.y = numpy.linspace(-2.0, 2.0, 200) - topo.write(os.path.join(self.temp_path, "bowl.topotype2")) + topo.write(os.path.join(self.temp_path, "bowl.topotype2"), \ + topo_type=2, Z_format="%22.15e") from make_fgmax_grid import make_fgmax_grid1 make_fgmax_grid1(self.temp_path) diff --git a/tests/dtopo1/maketopo.py b/tests/dtopo1/maketopo.py index 7a5a29d6f..a5488d1fe 100644 --- a/tests/dtopo1/maketopo.py +++ b/tests/dtopo1/maketopo.py @@ -3,7 +3,8 @@ Module to create topo and qinit data files for this example. """ -from clawpack.geoclaw.topotools import topo1writer, topo2writer +from clawpack.geoclaw.topotools import Topography + from clawpack.geoclaw import dtopotools import numpy import matplotlib.pyplot as plt @@ -21,7 +22,10 @@ def maketopo(): ylower = -10e0 yupper= 10e0 outfile= "topo1.topotype2" - topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints) + topography = Topography(topo_func=topo) + topography.x = numpy.linspace(xlower,xupper,nxpoints) + topography.y = numpy.linspace(ylower,yupper,nypoints) + topography.write(outfile, topo_type=2, Z_format="%22.15e") dx = (xupper-xlower)/(nxpoints-1) dy = (yupper-ylower)/(nypoints-1) print "==> topo1 has dx = %g, dy = %g" % (dx,dy) @@ -37,7 +41,10 @@ def maketopo2(): ylower = -0.1 yupper= 0.4 outfile= "topo2.topotype2" - topo2writer(outfile,topo2,xlower,xupper,ylower,yupper,nxpoints,nypoints) + topography = Topography(topo_func=topo2) + topography.x = numpy.linspace(xlower,xupper,nxpoints) + topography.y = numpy.linspace(ylower,yupper,nypoints) + topography.write(outfile, topo_type=2, Z_format="%22.15e") dx = (xupper-xlower)/(nxpoints-1) dy = (yupper-ylower)/(nypoints-1) print "==> topo2 has dx = %g, dy = %g" % (dx,dy) diff --git a/tests/dtopo1/regression_data/gauge00001.txt b/tests/dtopo1/regression_data/gauge00001.txt index dc19c1d4d..0e45cf0cb 100644 --- a/tests/dtopo1/regression_data/gauge00001.txt +++ b/tests/dtopo1/regression_data/gauge00001.txt @@ -1,53 +1,53 @@ # gauge_id= 1 location=( -0.45 0.05 ) num_eqn= 4 # Columns: level time q(1 ... num_eqn) -4607182418800017408 0.0 1670.354 0.0 0.0 0.0 -4607182418800017408 0.0001 1670.354 -2.095048e-17 2.259404e-17 0.0 -4607182418800017408 0.0201 1670.354 -4.254983e-15 -8.172831e-15 0.0008 -4607182418800017408 0.0401 1670.354 5.819504e-15 -1.212058e-14 0.1608 -4607182418800017408 0.0601 1670.354 -4.012299e-14 -7.646864e-15 0.3208 -4607182418800017408 0.0801 1670.354 -1.406211e-13 -3.199637e-15 0.4808 -4607182418800017408 0.1001 1670.354 -3.559817e-13 3.460132e-14 0.6408 -4607182418800017408 0.1201 1670.354 -7.687797e-13 3.331292e-15 0.8008 -4607182418800017408 0.1401 1670.354 -1.661697e-12 4.434144e-15 0.9608 -4607182418800017408 0.1601 1670.354 -3.135409e-12 3.358414e-15 1.1208 -4607182418800017408 0.1801 1670.354 -5.476332e-12 1.614664e-14 1.2808 -4607182418800017408 0.2001 1670.354 -8.939487e-12 4.108562e-14 1.4408 -4607182418800017408 0.2201 1670.354 -1.38962e-11 4.354217e-14 1.6008 -4607182418800017408 0.2401 1670.354 -2.072384e-11 -1.22292e-14 1.7608 -4607182418800017408 0.2601 1670.354 -2.98276e-11 -4.305891e-14 1.9208 -4607182418800017408 0.2801 1670.354 -4.164306e-11 -8.479047e-14 1.9192 -4607182418800017408 0.3001 1670.354 -5.66928e-11 -1.387227e-13 1.7592 -4607182418800017408 0.3201 1670.354 -7.550907e-11 -2.233382e-13 1.5992 -4607182418800017408 0.3401 1670.354 -9.850911e-11 -2.740684e-13 1.4392 -4607182418800017408 0.3601 1670.354 -1.26101e-10 -4.230222e-13 1.2792 -4607182418800017408 0.3801 1670.354 -1.587222e-10 -5.199631e-13 1.1192 -4607182418800017408 0.4001 1670.354 -1.967043e-10 -6.957309e-13 0.9592 -4607182418800017408 0.4201 1670.354 -2.403526e-10 -8.937129e-13 0.7992 -4607182418800017408 0.4401 1670.354 -2.899325e-10 -1.063955e-12 0.6392 -4607182418800017408 0.4601 1670.354 -3.456806e-10 -1.308005e-12 0.4792 -4607182418800017408 0.4801 1670.354 -4.077496e-10 -1.590064e-12 0.3192 -4607182418800017408 0.5001 1670.354 -4.763515e-10 -1.903784e-12 0.1592 -4607182418800017408 0.5201 1670.354 0.07013447 0.01938294 1.759766 -4607182418800017408 0.5401 1670.354 0.1456844 0.04027292 1.896394 -4607182418800017408 0.5601 1670.354 0.2264722 0.06262068 2.028536 -4607182418800017408 0.5801 1670.354 0.3123216 0.0863774 2.15623 -4607182418800017408 0.6001 1670.354 0.4029363 0.1114608 2.276441 -4607182418800017408 0.6201 1670.354 0.4981114 0.137814 2.39148 -4607182418800017408 0.6401 1670.354 0.5976709 0.1653882 2.502072 -4607182418800017408 0.6601 1670.354 0.7013452 0.1941087 2.605865 -4607182418800017408 0.6801 1670.354 0.8089024 0.2239109 2.703802 -4611686018427387904 0.7001 1670.354 0.9201664 0.2547462 2.88466 -4611686018427387904 0.7201 1670.354 1.034283 0.2864247 2.884683 -4611686018427387904 0.7401 1670.354 1.15157 0.3189926 2.965533 -4613937818241073152 0.7601 1670.329 1.271853 0.3518861 3.112886 -4613937818241073152 0.7801 1670.329 1.370447 0.3760791 3.112885 -4613937818241073152 0.8001 1670.329 1.471689 0.4010228 3.176775 -4613937818241073152 0.8201 1670.329 1.575404 0.4266645 3.290882 -4613937818241073152 0.8401 1670.329 1.681405 0.4529531 3.290882 -4613937818241073152 0.8601 1670.329 1.789379 0.4798042 3.337627 -4613937818241073152 0.8801 1670.329 1.899149 0.507167 3.417743 -4613937818241073152 0.9001 1670.329 2.010542 0.5349928 3.417744 -4613937818241073152 0.9201 1670.329 2.123247 0.5631976 3.447727 -4613937818241073152 0.9401 1670.329 2.237075 0.5917271 3.493551 -4613937818241073152 0.9601 1670.329 2.351851 0.6205329 3.493553 -4613937818241073152 0.9801 1670.329 2.467293 0.6495374 3.507077 +01 +0.000000000000000e+00 +1.670354000000000e+03 +0.000000000000000e+00 +0.000000000000000e+00 +0.000000000000000e+00 +01 +1.000000000000000e-04 +1.670354000000000e+03 -2.095048000000000e-17 +2.259404000000000e-17 +0.000000000000000e+00 +01 +2.010000000000000e-02 +1.670354000000000e+03 -4.254983000000000e-15 -8.172831000000000e-15 +8.000000000000000e-04 +01 +4.010000000000000e-02 +1.670354000000000e+03 +5.819504000000000e-15 -1.212058000000000e-14 +1.608000000000000e-01 +01 +6.010000000000000e-02 +1.670354000000000e+03 -4.012299000000000e-14 -7.646864000000001e-15 +3.208000000000000e-01 +01 +8.010000000000000e-02 +1.670354000000000e+03 -1.406211000000000e-13 -3.199637000000000e-15 +4.808000000000000e-01 +01 +1.001000000000000e-01 +1.670354000000000e+03 -3.559817000000000e-13 +3.460132000000000e-14 +6.408000000000000e-01 +01 +1.201000000000000e-01 +1.670354000000000e+03 -7.687797000000000e-13 +3.331292000000000e-15 +8.008000000000000e-01 +01 +1.401000000000000e-01 +1.670354000000000e+03 -1.661697000000000e-12 +4.434144000000000e-15 +9.608000000000000e-01 +01 +1.601000000000000e-01 +1.670354000000000e+03 -3.135409000000000e-12 +3.358414000000000e-15 +1.120800000000000e+00 +01 +1.801000000000000e-01 +1.670354000000000e+03 -5.476332000000000e-12 +1.614664000000000e-14 +1.280800000000000e+00 +01 +2.001000000000000e-01 +1.670354000000000e+03 -8.939487000000000e-12 +4.108562000000000e-14 +1.440800000000000e+00 +01 +2.201000000000000e-01 +1.670354000000000e+03 -1.389620000000000e-11 +4.354217000000000e-14 +1.600800000000000e+00 +01 +2.401000000000000e-01 +1.670354000000000e+03 -2.072384000000000e-11 -1.222920000000000e-14 +1.760800000000000e+00 +01 +2.601000000000000e-01 +1.670354000000000e+03 -2.982760000000000e-11 -4.305891000000000e-14 +1.920800000000000e+00 +01 +2.801000000000000e-01 +1.670354000000000e+03 -4.164306000000000e-11 -8.479047000000000e-14 +1.919200000000000e+00 +01 +3.001000000000000e-01 +1.670354000000000e+03 -5.669280000000000e-11 -1.387227000000000e-13 +1.759200000000000e+00 +01 +3.201000000000000e-01 +1.670354000000000e+03 -7.550907000000000e-11 -2.233382000000000e-13 +1.599200000000000e+00 +01 +3.401000000000000e-01 +1.670354000000000e+03 -9.850910999999999e-11 -2.740684000000000e-13 +1.439200000000000e+00 +01 +3.601000000000000e-01 +1.670354000000000e+03 -1.261010000000000e-10 -4.230222000000000e-13 +1.279200000000000e+00 +01 +3.801000000000000e-01 +1.670354000000000e+03 -1.587222000000000e-10 -5.199631000000000e-13 +1.119200000000000e+00 +01 +4.001000000000000e-01 +1.670354000000000e+03 -1.967043000000000e-10 -6.957309000000000e-13 +9.592000000000001e-01 +01 +4.201000000000000e-01 +1.670354000000000e+03 -2.403526000000000e-10 -8.937129000000000e-13 +7.992000000000000e-01 +01 +4.401000000000000e-01 +1.670354000000000e+03 -2.899325000000000e-10 -1.063955000000000e-12 +6.392000000000000e-01 +01 +4.601000000000000e-01 +1.670354000000000e+03 -3.456806000000000e-10 -1.308005000000000e-12 +4.792000000000000e-01 +01 +4.801000000000000e-01 +1.670354000000000e+03 -4.077496000000000e-10 -1.590064000000000e-12 +3.192000000000000e-01 +01 +5.001000000000000e-01 +1.670354000000000e+03 -4.763515000000000e-10 -1.903784000000000e-12 +1.592000000000000e-01 +01 +5.201000000000000e-01 +1.670354000000000e+03 +7.013447000000000e-02 +1.938294000000000e-02 +1.759766000000000e+00 +01 +5.401000000000000e-01 +1.670354000000000e+03 +1.456844000000000e-01 +4.027292000000000e-02 +1.896394000000000e+00 +01 +5.601000000000000e-01 +1.670354000000000e+03 +2.264722000000000e-01 +6.262068000000000e-02 +2.028536000000000e+00 +01 +5.800999999999999e-01 +1.670354000000000e+03 +3.123216000000000e-01 +8.637739999999999e-02 +2.156230000000000e+00 +01 +6.001000000000000e-01 +1.670354000000000e+03 +4.029363000000000e-01 +1.114608000000000e-01 +2.276441000000000e+00 +01 +6.201000000000000e-01 +1.670354000000000e+03 +4.981114000000000e-01 +1.378140000000000e-01 +2.391480000000000e+00 +01 +6.401000000000000e-01 +1.670354000000000e+03 +5.976709000000000e-01 +1.653882000000000e-01 +2.502072000000000e+00 +01 +6.601000000000000e-01 +1.670354000000000e+03 +7.013452000000000e-01 +1.941087000000000e-01 +2.605865000000000e+00 +01 +6.801000000000000e-01 +1.670354000000000e+03 +8.089024000000000e-01 +2.239109000000000e-01 +2.703802000000000e+00 +02 +7.000999999999999e-01 +1.670354000000000e+03 +9.201664000000001e-01 +2.547462000000000e-01 +2.884660000000000e+00 +02 +7.201000000000000e-01 +1.670354000000000e+03 +1.034283000000000e+00 +2.864247000000000e-01 +2.884683000000000e+00 +02 +7.401000000000000e-01 +1.670354000000000e+03 +1.151570000000000e+00 +3.189926000000000e-01 +2.965533000000000e+00 +03 +7.601000000000000e-01 +1.670329000000000e+03 +1.271853000000000e+00 +3.518861000000000e-01 +3.112886000000000e+00 +03 +7.801000000000000e-01 +1.670329000000000e+03 +1.370447000000000e+00 +3.760791000000000e-01 +3.112885000000000e+00 +03 +8.001000000000000e-01 +1.670329000000000e+03 +1.471689000000000e+00 +4.010228000000000e-01 +3.176775000000000e+00 +03 +8.201000000000001e-01 +1.670329000000000e+03 +1.575404000000000e+00 +4.266645000000000e-01 +3.290882000000000e+00 +03 +8.401000000000000e-01 +1.670329000000000e+03 +1.681405000000000e+00 +4.529531000000000e-01 +3.290882000000000e+00 +03 +8.601000000000000e-01 +1.670329000000000e+03 +1.789379000000000e+00 +4.798042000000000e-01 +3.337627000000000e+00 +03 +8.801000000000000e-01 +1.670329000000000e+03 +1.899149000000000e+00 +5.071670000000000e-01 +3.417743000000000e+00 +03 +9.001000000000000e-01 +1.670329000000000e+03 +2.010542000000000e+00 +5.349928000000000e-01 +3.417744000000000e+00 +03 +9.201000000000000e-01 +1.670329000000000e+03 +2.123247000000000e+00 +5.631976000000000e-01 +3.447727000000000e+00 +03 +9.401000000000000e-01 +1.670329000000000e+03 +2.237075000000000e+00 +5.917271000000000e-01 +3.493551000000000e+00 +03 +9.601000000000000e-01 +1.670329000000000e+03 +2.351851000000000e+00 +6.205329000000001e-01 +3.493553000000000e+00 +03 +9.801000000000000e-01 +1.670329000000000e+03 +2.467293000000000e+00 +6.495374000000000e-01 +3.507077000000000e+00 diff --git a/tests/dtopo1/regression_data/regression_data.txt b/tests/dtopo1/regression_data/regression_data.txt deleted file mode 100644 index e293eed3e..000000000 --- a/tests/dtopo1/regression_data/regression_data.txt +++ /dev/null @@ -1,51 +0,0 @@ -1.000000000000000000e+00 1.000000000000000000e+00 0.000000000000000000e+00 1.670354000000000042e+03 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 -1.000000000000000000e+00 1.000000000000000000e+00 1.000000000000000048e-04 1.670354000000000042e+03 -2.095048000000000009e-17 2.259404000000000061e-17 0.000000000000000000e+00 -1.000000000000000000e+00 1.000000000000000000e+00 2.009999999999999981e-02 1.670354000000000042e+03 -4.254982999999999824e-15 -8.172830999999999742e-15 8.000000000000000383e-04 -1.000000000000000000e+00 1.000000000000000000e+00 4.009999999999999676e-02 1.670354000000000042e+03 5.819504000000000067e-15 -1.212057999999999943e-14 1.607999999999999985e-01 -1.000000000000000000e+00 1.000000000000000000e+00 6.010000000000000064e-02 1.670354000000000042e+03 -4.012299000000000158e-14 -7.646864000000000636e-15 3.207999999999999741e-01 -1.000000000000000000e+00 1.000000000000000000e+00 8.010000000000000453e-02 1.670354000000000042e+03 -1.406210999999999894e-13 -3.199636999999999813e-15 4.808000000000000052e-01 -1.000000000000000000e+00 1.000000000000000000e+00 1.000999999999999945e-01 1.670354000000000042e+03 -3.559816999999999855e-13 3.460132000000000114e-14 6.408000000000000362e-01 -1.000000000000000000e+00 1.000000000000000000e+00 1.200999999999999984e-01 1.670354000000000042e+03 -7.687797000000000104e-13 3.331292000000000174e-15 8.007999999999999563e-01 -1.000000000000000000e+00 1.000000000000000000e+00 1.401000000000000023e-01 1.670354000000000042e+03 -1.661696999999999962e-12 4.434143999999999975e-15 9.607999999999999874e-01 -1.000000000000000000e+00 1.000000000000000000e+00 1.600999999999999923e-01 1.670354000000000042e+03 -3.135409000000000095e-12 3.358414000000000144e-15 1.120800000000000018e+00 -1.000000000000000000e+00 1.000000000000000000e+00 1.801000000000000101e-01 1.670354000000000042e+03 -5.476331999999999894e-12 1.614663999999999844e-14 1.280799999999999939e+00 -1.000000000000000000e+00 1.000000000000000000e+00 2.001000000000000001e-01 1.670354000000000042e+03 -8.939486999999999792e-12 4.108561999999999806e-14 1.440800000000000081e+00 -1.000000000000000000e+00 1.000000000000000000e+00 2.200999999999999901e-01 1.670354000000000042e+03 -1.389620000000000050e-11 4.354216999999999732e-14 1.600800000000000001e+00 -1.000000000000000000e+00 1.000000000000000000e+00 2.401000000000000079e-01 1.670354000000000042e+03 -2.072384000000000068e-11 -1.222919999999999921e-14 1.760799999999999921e+00 -1.000000000000000000e+00 1.000000000000000000e+00 2.600999999999999979e-01 1.670354000000000042e+03 -2.982759999999999944e-11 -4.305891000000000216e-14 1.920800000000000063e+00 -1.000000000000000000e+00 1.000000000000000000e+00 2.801000000000000156e-01 1.670354000000000042e+03 -4.164306000000000007e-11 -8.479047000000000140e-14 1.919200000000000017e+00 -1.000000000000000000e+00 1.000000000000000000e+00 3.000999999999999779e-01 1.670354000000000042e+03 -5.669280000000000093e-11 -1.387227000000000073e-13 1.759200000000000097e+00 -1.000000000000000000e+00 1.000000000000000000e+00 3.200999999999999956e-01 1.670354000000000042e+03 -7.550906999999999907e-11 -2.233382000000000065e-13 1.599199999999999955e+00 -1.000000000000000000e+00 1.000000000000000000e+00 3.401000000000000134e-01 1.670354000000000042e+03 -9.850910999999999443e-11 -2.740683999999999977e-13 1.439200000000000035e+00 -1.000000000000000000e+00 1.000000000000000000e+00 3.600999999999999757e-01 1.670354000000000042e+03 -1.261009999999999919e-10 -4.230222000000000067e-13 1.279199999999999893e+00 -1.000000000000000000e+00 1.000000000000000000e+00 3.800999999999999934e-01 1.670354000000000042e+03 -1.587221999999999991e-10 -5.199631000000000102e-13 1.119199999999999973e+00 -1.000000000000000000e+00 1.000000000000000000e+00 4.001000000000000112e-01 1.670354000000000042e+03 -1.967043000000000039e-10 -6.957309000000000198e-13 9.592000000000000526e-01 -1.000000000000000000e+00 1.000000000000000000e+00 4.200999999999999734e-01 1.670354000000000042e+03 -2.403526000000000040e-10 -8.937128999999999935e-13 7.992000000000000215e-01 -1.000000000000000000e+00 1.000000000000000000e+00 4.400999999999999912e-01 1.670354000000000042e+03 -2.899325000000000222e-10 -1.063954999999999984e-12 6.391999999999999904e-01 -1.000000000000000000e+00 1.000000000000000000e+00 4.601000000000000090e-01 1.670354000000000042e+03 -3.456806000000000253e-10 -1.308004999999999938e-12 4.792000000000000148e-01 -1.000000000000000000e+00 1.000000000000000000e+00 4.801000000000000267e-01 1.670354000000000042e+03 -4.077495999999999895e-10 -1.590064000000000080e-12 3.191999999999999837e-01 -1.000000000000000000e+00 1.000000000000000000e+00 5.000999999999999890e-01 1.670354000000000042e+03 -4.763514999999999758e-10 -1.903784000000000080e-12 1.592000000000000082e-01 -1.000000000000000000e+00 1.000000000000000000e+00 5.201000000000000068e-01 1.670354000000000042e+03 7.013447000000000431e-02 1.938294000000000128e-02 1.759765999999999941e+00 -1.000000000000000000e+00 1.000000000000000000e+00 5.401000000000000245e-01 1.670354000000000042e+03 1.456843999999999917e-01 4.027291999999999678e-02 1.896393999999999913e+00 -1.000000000000000000e+00 1.000000000000000000e+00 5.601000000000000423e-01 1.670354000000000042e+03 2.264722000000000124e-01 6.262067999999999801e-02 2.028535999999999895e+00 -1.000000000000000000e+00 1.000000000000000000e+00 5.800999999999999490e-01 1.670354000000000042e+03 3.123215999999999770e-01 8.637739999999999307e-02 2.156229999999999869e+00 -1.000000000000000000e+00 1.000000000000000000e+00 6.000999999999999668e-01 1.670354000000000042e+03 4.029363000000000250e-01 1.114607999999999988e-01 2.276441000000000159e+00 -1.000000000000000000e+00 1.000000000000000000e+00 6.200999999999999845e-01 1.670354000000000042e+03 4.981113999999999820e-01 1.378139999999999921e-01 2.391480000000000050e+00 -1.000000000000000000e+00 1.000000000000000000e+00 6.401000000000000023e-01 1.670354000000000042e+03 5.976709000000000049e-01 1.653882000000000130e-01 2.502072000000000074e+00 -1.000000000000000000e+00 1.000000000000000000e+00 6.601000000000000201e-01 1.670354000000000042e+03 7.013452000000000019e-01 1.941086999999999951e-01 2.605865000000000098e+00 -1.000000000000000000e+00 1.000000000000000000e+00 6.801000000000000378e-01 1.670354000000000042e+03 8.089024000000000214e-01 2.239108999999999960e-01 2.703802000000000039e+00 -1.000000000000000000e+00 2.000000000000000000e+00 7.000999999999999446e-01 1.670354000000000042e+03 9.201664000000000510e-01 2.547461999999999782e-01 2.884659999999999780e+00 -1.000000000000000000e+00 2.000000000000000000e+00 7.200999999999999623e-01 1.670354000000000042e+03 1.034283000000000063e+00 2.864246999999999765e-01 2.884682999999999886e+00 -1.000000000000000000e+00 2.000000000000000000e+00 7.400999999999999801e-01 1.670354000000000042e+03 1.151569999999999983e+00 3.189926000000000150e-01 2.965533000000000197e+00 -1.000000000000000000e+00 3.000000000000000000e+00 7.600999999999999979e-01 1.670328999999999951e+03 1.271852999999999900e+00 3.518860999999999795e-01 3.112886000000000042e+00 -1.000000000000000000e+00 3.000000000000000000e+00 7.801000000000000156e-01 1.670328999999999951e+03 1.370446999999999971e+00 3.760790999999999995e-01 3.112884999999999902e+00 -1.000000000000000000e+00 3.000000000000000000e+00 8.001000000000000334e-01 1.670328999999999951e+03 1.471689000000000025e+00 4.010228000000000126e-01 3.176775000000000126e+00 -1.000000000000000000e+00 3.000000000000000000e+00 8.201000000000000512e-01 1.670328999999999951e+03 1.575404000000000027e+00 4.266645000000000021e-01 3.290881999999999863e+00 -1.000000000000000000e+00 3.000000000000000000e+00 8.400999999999999579e-01 1.670328999999999951e+03 1.681405000000000038e+00 4.529530999999999974e-01 3.290881999999999863e+00 -1.000000000000000000e+00 3.000000000000000000e+00 8.600999999999999757e-01 1.670328999999999951e+03 1.789379000000000053e+00 4.798042000000000140e-01 3.337626999999999899e+00 -1.000000000000000000e+00 3.000000000000000000e+00 8.800999999999999934e-01 1.670328999999999951e+03 1.899148999999999976e+00 5.071670000000000345e-01 3.417743000000000198e+00 -1.000000000000000000e+00 3.000000000000000000e+00 9.001000000000000112e-01 1.670328999999999951e+03 2.010542000000000051e+00 5.349928000000000461e-01 3.417743999999999893e+00 -1.000000000000000000e+00 3.000000000000000000e+00 9.201000000000000290e-01 1.670328999999999951e+03 2.123247000000000106e+00 5.631975999999999649e-01 3.447726999999999986e+00 -1.000000000000000000e+00 3.000000000000000000e+00 9.401000000000000467e-01 1.670328999999999951e+03 2.237074999999999925e+00 5.917270999999999503e-01 3.493551000000000073e+00 -1.000000000000000000e+00 3.000000000000000000e+00 9.600999999999999535e-01 1.670328999999999951e+03 2.351850999999999914e+00 6.205329000000000539e-01 3.493552999999999908e+00 -1.000000000000000000e+00 3.000000000000000000e+00 9.800999999999999712e-01 1.670328999999999951e+03 2.467293000000000180e+00 6.495374000000000425e-01 3.507077000000000222e+00 diff --git a/tests/dtopo1/regression_data/regression_data_test2.txt b/tests/dtopo1/regression_data/regression_data_test2.txt deleted file mode 100644 index f116e4c9b..000000000 --- a/tests/dtopo1/regression_data/regression_data_test2.txt +++ /dev/null @@ -1,2 +0,0 @@ -2.450499999999999901e+01 -8.518780199999996694e+04 diff --git a/tests/dtopo1/regression_tests.py b/tests/dtopo1/regression_tests.py index ac4da46f2..eba923e37 100644 --- a/tests/dtopo1/regression_tests.py +++ b/tests/dtopo1/regression_tests.py @@ -31,7 +31,8 @@ def setUp(self): topo.topo_type = 2 topo.x = numpy.linspace(-10.0, 10.0, 201) topo.y = numpy.linspace(-10.0, 10.0, 201) - topo.write(os.path.join(self.temp_path, "topo1.topotype2")) + topo.write(os.path.join(self.temp_path, "topo1.topotype2"), \ + topo_type=2, Z_format="%22.15e") h0 = 1000.0 topo_func = lambda x,y: -h0*(1. + numpy.exp(x+y)) @@ -39,7 +40,8 @@ def setUp(self): topo.topo_type = 2 topo.x = numpy.linspace(-0.5, -0.3, 21) topo.y = numpy.linspace(-0.1, 0.4, 51) - topo.write(os.path.join(self.temp_path, "topo2.topotype2")) + topo.write(os.path.join(self.temp_path, "topo2.topotype2"), \ + topo_type=2, Z_format="%22.15e") # Make dtopography subfault_path = os.path.join(self.test_path, "dtopo1.csv") diff --git a/tests/dtopo1/setplot.py b/tests/dtopo1/setplot.py index be5a16cd8..ef78dc95f 100644 --- a/tests/dtopo1/setplot.py +++ b/tests/dtopo1/setplot.py @@ -135,10 +135,10 @@ def add_dtopo_plot(current_data): if len(itlist) > 0: it = max(find(dtopo.times <= t)) #print "+++ t, it, dtopo.times[it]: ",t, it, dtopo.times[it] - dz = dtopo.dz_list[it] + dz = dtopo.dZ[it,:,:] dzj = dz[j,:] if it < len(dtopo.times)-1: - dz1 = dtopo.dz_list[it+1] + dz1 = dtopo.dZ[it+1,:,:] dz1j = dz1[j,:] alpha = (t - dtopo.times[it])/(dtopo.times[it+1] - dtopo.times[it]) #print "+++ alpha = ",alpha diff --git a/tests/storm_surge/regression_tests.py b/tests/storm_surge/regression_tests.py index 0baae264f..b97d59a31 100644 --- a/tests/storm_surge/regression_tests.py +++ b/tests/storm_surge/regression_tests.py @@ -47,7 +47,8 @@ def setUp(self): topo.x = numpy.linspace(-100, -69, 125) topo.y = numpy.linspace(7.0, 33.0, 105) topo.Z = 25.0 * ((topo.X + 84.5)**2 + (topo.Y - 20.0)**2) - 4000.0 - topo.write(os.path.join(self.temp_path, 'gulf_caribbean.tt3')) + topo.write(os.path.join(self.temp_path, 'gulf_caribbean.tt3'), \ + topo_type=2, Z_format="%22.15e") def runTest(self, save=False, indices=(2, 3)): diff --git a/tests/test_topotools.py b/tests/test_topotools.py index 0f2824b55..e1d30074b 100644 --- a/tests/test_topotools.py +++ b/tests/test_topotools.py @@ -63,7 +63,7 @@ def test_read_write_topo_bowl(): try: for topo_type in xrange(1, 4): path = os.path.join(temp_path, 'bowl.tt%s' % topo_type) - topo.write(path, topo_type=topo_type) + topo.write(path, topo_type=topo_type,Z_format="%22.15e") topo_in = topotools.Topography(path) assert numpy.allclose(topo.Z, topo_in.Z), \ @@ -172,7 +172,7 @@ def test_read_write_topo_bowl_hill(): for topo_type in xrange(1,4): file_path = os.path.join(temp_path, 'bowl_hill.tt%s' % topo_type) - topo.write(file_path, topo_type=topo_type) + topo.write(file_path, topo_type=topo_type,Z_format="%22.15e") topo_in = topotools.Topography(path=file_path, topo_type=topo_type) assert numpy.allclose(topo.Z, topo_in.Z), \ "Written file of topo_type=%s does not equal read in" + \ @@ -207,7 +207,7 @@ def test_netcdf(): # Write out NetCDF version of file ascii_topo = topotools.Topography(path=local_path) ascii_topo.read() - ascii_topo.write(nc_path, topo_type=4) + ascii_topo.write(nc_path, topo_type=4,Z_format="%22.15e") # Read back in NetCDF file nc_topo = topotools.Topography(path=nc_path) @@ -313,7 +313,7 @@ def func(x, y): # Load (and save) test data and make the comparison test_data_path = os.path.join(testdir, "data", "unstructured_test_data.tt3") if save: - topo.write(test_data_path) + topo.write(test_data_path,Z_format="%22.15e") compare_data = topotools.Topography(path=test_data_path)