surfacetopography 0.91.2__py3.6-linux-x86_64.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. EGG-INFO/PKG-INFO +11 -0
  2. EGG-INFO/SOURCES.txt +96 -0
  3. EGG-INFO/dependency_links.txt +1 -0
  4. EGG-INFO/native_libs.txt +1 -0
  5. EGG-INFO/not-zip-safe +1 -0
  6. EGG-INFO/requires.txt +6 -0
  7. EGG-INFO/top_level.txt +3 -0
  8. SurfaceTopography/ChangeLog.md +358 -0
  9. SurfaceTopography/Converters.py +197 -0
  10. SurfaceTopography/Generation.py +440 -0
  11. SurfaceTopography/HeightContainer.py +315 -0
  12. SurfaceTopography/IO/DI.py +261 -0
  13. SurfaceTopography/IO/FromFile.py +802 -0
  14. SurfaceTopography/IO/H5.py +79 -0
  15. SurfaceTopography/IO/IBW.py +176 -0
  16. SurfaceTopography/IO/MI.py +307 -0
  17. SurfaceTopography/IO/Matlab.py +106 -0
  18. SurfaceTopography/IO/NC.py +228 -0
  19. SurfaceTopography/IO/NPY.py +139 -0
  20. SurfaceTopography/IO/OPDx.py +885 -0
  21. SurfaceTopography/IO/Reader.py +389 -0
  22. SurfaceTopography/IO/__init__.py +241 -0
  23. SurfaceTopography/IO/__pycache__/DI.cpython-36.pyc +0 -0
  24. SurfaceTopography/IO/__pycache__/FromFile.cpython-36.pyc +0 -0
  25. SurfaceTopography/IO/__pycache__/H5.cpython-36.pyc +0 -0
  26. SurfaceTopography/IO/__pycache__/IBW.cpython-36.pyc +0 -0
  27. SurfaceTopography/IO/__pycache__/MI.cpython-36.pyc +0 -0
  28. SurfaceTopography/IO/__pycache__/Matlab.cpython-36.pyc +0 -0
  29. SurfaceTopography/IO/__pycache__/NC.cpython-36.pyc +0 -0
  30. SurfaceTopography/IO/__pycache__/NPY.cpython-36.pyc +0 -0
  31. SurfaceTopography/IO/__pycache__/OPDx.cpython-36.pyc +0 -0
  32. SurfaceTopography/IO/__pycache__/Reader.cpython-36.pyc +0 -0
  33. SurfaceTopography/IO/__pycache__/__init__.cpython-36.pyc +0 -0
  34. SurfaceTopography/Interpolation.py +30 -0
  35. SurfaceTopography/Nonuniform/Autocorrelation.py +161 -0
  36. SurfaceTopography/Nonuniform/Detrending.py +87 -0
  37. SurfaceTopography/Nonuniform/PowerSpectrum.py +178 -0
  38. SurfaceTopography/Nonuniform/ScalarParameters.py +140 -0
  39. SurfaceTopography/Nonuniform/VariableBandwidth.py +155 -0
  40. SurfaceTopography/Nonuniform/__init__.py +28 -0
  41. SurfaceTopography/Nonuniform/__pycache__/Autocorrelation.cpython-36.pyc +0 -0
  42. SurfaceTopography/Nonuniform/__pycache__/Detrending.cpython-36.pyc +0 -0
  43. SurfaceTopography/Nonuniform/__pycache__/PowerSpectrum.cpython-36.pyc +0 -0
  44. SurfaceTopography/Nonuniform/__pycache__/ScalarParameters.cpython-36.pyc +0 -0
  45. SurfaceTopography/Nonuniform/__pycache__/VariableBandwidth.cpython-36.pyc +0 -0
  46. SurfaceTopography/Nonuniform/__pycache__/__init__.cpython-36.pyc +0 -0
  47. SurfaceTopography/Nonuniform/__pycache__/common.cpython-36.pyc +0 -0
  48. SurfaceTopography/Nonuniform/common.py +95 -0
  49. SurfaceTopography/NonuniformLineScan.py +310 -0
  50. SurfaceTopography/Special.py +225 -0
  51. SurfaceTopography/Tools/__init__.py +28 -0
  52. SurfaceTopography/Tools/__pycache__/__init__.cpython-36.pyc +0 -0
  53. SurfaceTopography/Tools/__pycache__/common.cpython-36.pyc +0 -0
  54. SurfaceTopography/Tools/common.py +75 -0
  55. SurfaceTopography/Uniform/Autocorrelation.py +211 -0
  56. SurfaceTopography/Uniform/Detrending.py +155 -0
  57. SurfaceTopography/Uniform/Filtering.py +226 -0
  58. SurfaceTopography/Uniform/Interpolation.py +159 -0
  59. SurfaceTopography/Uniform/PowerSpectrum.py +197 -0
  60. SurfaceTopography/Uniform/ScalarParameters.py +173 -0
  61. SurfaceTopography/Uniform/VariableBandwidth.py +169 -0
  62. SurfaceTopography/Uniform/__init__.py +28 -0
  63. SurfaceTopography/Uniform/__pycache__/Autocorrelation.cpython-36.pyc +0 -0
  64. SurfaceTopography/Uniform/__pycache__/Detrending.cpython-36.pyc +0 -0
  65. SurfaceTopography/Uniform/__pycache__/Filtering.cpython-36.pyc +0 -0
  66. SurfaceTopography/Uniform/__pycache__/Interpolation.cpython-36.pyc +0 -0
  67. SurfaceTopography/Uniform/__pycache__/PowerSpectrum.cpython-36.pyc +0 -0
  68. SurfaceTopography/Uniform/__pycache__/ScalarParameters.cpython-36.pyc +0 -0
  69. SurfaceTopography/Uniform/__pycache__/VariableBandwidth.cpython-36.pyc +0 -0
  70. SurfaceTopography/Uniform/__pycache__/__init__.cpython-36.pyc +0 -0
  71. SurfaceTopography/Uniform/__pycache__/common.cpython-36.pyc +0 -0
  72. SurfaceTopography/Uniform/common.py +260 -0
  73. SurfaceTopography/UniformLineScanAndTopography.py +887 -0
  74. SurfaceTopography/__init__.py +62 -0
  75. SurfaceTopography/__pycache__/Converters.cpython-36.pyc +0 -0
  76. SurfaceTopography/__pycache__/Generation.cpython-36.pyc +0 -0
  77. SurfaceTopography/__pycache__/HeightContainer.cpython-36.pyc +0 -0
  78. SurfaceTopography/__pycache__/Interpolation.cpython-36.pyc +0 -0
  79. SurfaceTopography/__pycache__/NonuniformLineScan.cpython-36.pyc +0 -0
  80. SurfaceTopography/__pycache__/Special.cpython-36.pyc +0 -0
  81. SurfaceTopography/__pycache__/UniformLineScanAndTopography.cpython-36.pyc +0 -0
  82. SurfaceTopography/__pycache__/__init__.cpython-36.pyc +0 -0
  83. SurfaceTopography/__pycache__/common.cpython-36.pyc +0 -0
  84. SurfaceTopography/common.py +111 -0
  85. _SurfaceTopography.cpython-36m-x86_64-linux-gnu.so +0 -0
  86. _SurfaceTopography.py +8 -0
  87. __pycache__/_SurfaceTopography.cpython-36.pyc +0 -0
  88. test/IO/__init__.py +28 -0
  89. test/IO/__pycache__/__init__.cpython-36.pyc +0 -0
  90. test/IO/__pycache__/test_ibw.cpython-36.pyc +0 -0
  91. test/IO/__pycache__/test_io.cpython-36.pyc +0 -0
  92. test/IO/__pycache__/test_mi.cpython-36.pyc +0 -0
  93. test/IO/__pycache__/test_netcdf.cpython-36.pyc +0 -0
  94. test/IO/__pycache__/test_npy.cpython-36.pyc +0 -0
  95. test/IO/__pycache__/test_opdx.cpython-36.pyc +0 -0
  96. test/IO/test_ibw.py +178 -0
  97. test/IO/test_io.py +401 -0
  98. test/IO/test_mi.py +103 -0
  99. test/IO/test_netcdf.py +134 -0
  100. test/IO/test_npy.py +135 -0
  101. test/IO/test_opdx.py +441 -0
  102. test/__init__.py +26 -0
  103. test/__pycache__/__init__.cpython-36.pyc +0 -0
  104. test/__pycache__/compare-orientation-with-gwyddion.cpython-36.pyc +0 -0
  105. test/__pycache__/conftest.cpython-36.pyc +0 -0
  106. test/__pycache__/test_autocorrelation.cpython-36.pyc +0 -0
  107. test/__pycache__/test_bicubic.cpython-36.pyc +0 -0
  108. test/__pycache__/test_filtering.cpython-36.pyc +0 -0
  109. test/__pycache__/test_generation.cpython-36.pyc +0 -0
  110. test/__pycache__/test_import.cpython-36.pyc +0 -0
  111. test/__pycache__/test_make_sphere.cpython-36.pyc +0 -0
  112. test/__pycache__/test_power_spectrum.cpython-36.pyc +0 -0
  113. test/__pycache__/test_scalar_parameters.cpython-36.pyc +0 -0
  114. test/__pycache__/test_topography1.cpython-36.pyc +0 -0
  115. test/__pycache__/test_topography2.cpython-36.pyc +0 -0
  116. test/__pycache__/test_variable_bandwidth.cpython-36.pyc +0 -0
  117. test/compare-orientation-with-gwyddion.py +102 -0
  118. test/conftest.py +80 -0
  119. test/test_autocorrelation.py +311 -0
  120. test/test_bicubic.py +190 -0
  121. test/test_filtering.py +69 -0
  122. test/test_generation.py +259 -0
  123. test/test_import.py +54 -0
  124. test/test_make_sphere.py +108 -0
  125. test/test_power_spectrum.py +259 -0
  126. test/test_scalar_parameters.py +176 -0
  127. test/test_topography1.py +1287 -0
  128. test/test_topography2.py +328 -0
  129. test/test_variable_bandwidth.py +107 -0
@@ -0,0 +1,228 @@
1
+ #
2
+ # Copyright 2019-2020 Lars Pastewka
3
+ # 2019 Antoine Sanner
4
+ #
5
+ # ### MIT license
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ #
25
+
26
+ import numpy as np
27
+
28
+ from .. import Topography
29
+ from ..HeightContainer import UniformTopographyInterface
30
+
31
+ from .Reader import ReaderBase, ChannelInfo
32
+
33
+
34
+ class NCReader(ReaderBase):
35
+ _format = 'nc'
36
+ _name = 'Network Common Data Format (NetCDF)'
37
+
38
+ _description = '''
39
+ This reader reads topography data contained in a
40
+ [NetCDF](https://www.unidata.ucar.edu/software/netcdf/) container. The
41
+ reader looks for a variable named `heights` containing a two-dimensional
42
+ array that is interpreted as height information. The respective dimensions are
43
+ named `x` and `y`.
44
+
45
+ The reader additionally looks for two (optional) variables `x` and `y` that
46
+ contain the x- and y-coordinates of the first and second index of the height
47
+ arrays. The attribute `length` of `x` and `y` must contain the physical size
48
+ in the respective direction. The optional attribute `length_unit` of these
49
+ variables describes the physical unit. The optional additional attribute
50
+ `periodic` indicates whether the direction contains periodic data. If
51
+ `periodic` is missing, the reader interprets the data as non-periodic.
52
+
53
+ An example file layout (output of `ncdump -h`) containing a topography map
54
+ with 128 x 128 pixels looks like this:
55
+ ```
56
+ netcdf test_nc_file {
57
+ dimensions:
58
+ x = 128 ;
59
+ y = 128 ;
60
+ variables:
61
+ double x(x) ;
62
+ x:length = 3LL ;
63
+ x:periodic = 1LL ;
64
+ x:length_unit = "μm" ;
65
+ double y(y) ;
66
+ y:length = 3LL ;
67
+ y:periodic = 1LL ;
68
+ y:length_unit = "μm" ;
69
+ double heights(x, y) ;
70
+ }
71
+ ```
72
+ The following code snippets reads the file and displays the topography data as
73
+ a two-dimensional color map in Python:
74
+ ```python
75
+ import numpy as np
76
+ import matplotlib.pyplot as plt
77
+ from netCDF4 import Dataset
78
+
79
+ with Dataset('parallel_save_test.nc') as nc:
80
+ heights = np.array(nc.variables['heights'])
81
+ length_x = nc.variables['x'].length
82
+ length_y = nc.variables['y'].length
83
+ unit = nc.variables['x'].length_unit
84
+
85
+ plt.figure()
86
+ plt.subplot(aspect=1)
87
+
88
+ nx, ny = heights.shape
89
+ x = (np.arange(nx)+0.5)*length_x/nx
90
+ y = (np.arange(ny)+0.5)*length_y/ny
91
+ plt.pcolormesh(x, y, heights)
92
+
93
+ plt.show()
94
+ ```
95
+ '''
96
+
97
+ def __init__(self, fobj, communicator=None):
98
+ self._nc = None
99
+ from netCDF4 import Dataset
100
+ if communicator is not None and communicator.Get_size() > 1:
101
+ self._nc = Dataset(fobj, 'r', parallel=True, comm=communicator)
102
+ else:
103
+ self._nc = Dataset(fobj, 'r')
104
+ self._communicator = communicator
105
+ self._x_dim = self._nc.dimensions['x']
106
+ self._y_dim = self._nc.dimensions['y']
107
+ self._x_var = self._nc.variables[
108
+ 'x'] if 'x' in self._nc.variables else None
109
+ self._y_var = self._nc.variables[
110
+ 'y'] if 'y' in self._nc.variables else None
111
+ self._heights_var = self._nc.variables['heights']
112
+
113
+ # The following information may be missing from the NetCDF file
114
+ self._physical_sizes = None
115
+ self._periodic = False
116
+ self._info = {}
117
+ if self._x_var is not None:
118
+ if self._y_var is not None:
119
+ self._physical_sizes = (self._x_var.length, self._y_var.length)
120
+ try:
121
+ self._periodic = self._x_var.periodic != 0
122
+ except AttributeError:
123
+ pass
124
+ try:
125
+ self._info['unit'] = self._x_var.length_unit
126
+ except AttributeError:
127
+ pass
128
+
129
+ def __del__(self):
130
+ self.close()
131
+
132
+ def close(self):
133
+ if self._nc is not None:
134
+ self._nc.close()
135
+ self._nc = None
136
+
137
+ @property
138
+ def channels(self):
139
+ return [ChannelInfo(self, 0,
140
+ name='Default',
141
+ dim=2,
142
+ nb_grid_pts=(len(self._x_dim), len(self._y_dim)),
143
+ physical_sizes=self._physical_sizes,
144
+ periodic=self._periodic,
145
+ info=self._info)]
146
+
147
+ def topography(self, channel_index=None, physical_sizes=None,
148
+ height_scale_factor=None, info={},
149
+ periodic=None,
150
+ subdomain_locations=None, nb_subdomain_grid_pts=None):
151
+ if channel_index is None:
152
+ channel_index = self._default_channel_index
153
+
154
+ physical_sizes = self._check_physical_sizes(physical_sizes,
155
+ self._physical_sizes)
156
+ _info = self._info.copy()
157
+ _info.update(info)
158
+ if subdomain_locations is None and nb_subdomain_grid_pts is None:
159
+ return Topography(self._heights_var, physical_sizes,
160
+ periodic=self._periodic
161
+ if periodic is None else periodic,
162
+ info=_info)
163
+ else:
164
+ return Topography(self._heights_var, physical_sizes,
165
+ periodic=self._periodic
166
+ if periodic is None else periodic,
167
+ decomposition='domain',
168
+ subdomain_locations=subdomain_locations,
169
+ nb_subdomain_grid_pts=nb_subdomain_grid_pts,
170
+ communicator=self.communicator,
171
+ info=_info)
172
+
173
+ @property
174
+ def communicator(self):
175
+ return self._communicator
176
+
177
+ channels.__doc__ = ReaderBase.channels.__doc__
178
+ topography.__doc__ = ReaderBase.topography.__doc__
179
+
180
+
181
+ def write_nc(topography, filename, format='NETCDF3_64BIT_DATA'):
182
+ """
183
+ Write topography into a NetCDF file.
184
+
185
+ Parameters
186
+ ----------
187
+ topography : :obj:`SurfaceTopography`
188
+ The topography to write to disk.
189
+ filename : str
190
+ Name of the NetCDF file
191
+ format : str
192
+ NetCDF file format. Default is 'NETCDF4'.
193
+ """
194
+ from netCDF4 import Dataset
195
+ if not topography.is_domain_decomposed and \
196
+ topography.communicator.rank > 1:
197
+ return
198
+ with Dataset(filename, 'w', format=format,
199
+ parallel=topography.is_domain_decomposed,
200
+ comm=topography.communicator) as nc:
201
+ nx, ny = topography.nb_grid_pts
202
+ sx, sy = topography.physical_sizes
203
+
204
+ nc.createDimension('x', nx)
205
+ nc.createDimension('y', ny)
206
+
207
+ x_var = nc.createVariable('x', 'f8', ('x',))
208
+ y_var = nc.createVariable('y', 'f8', ('y',))
209
+ heights_var = nc.createVariable('heights', 'f8', ('x', 'y',))
210
+
211
+ x_var.length = sx
212
+ x_var.periodic = 1 if topography.is_periodic else 0
213
+ if 'unit' in topography.info:
214
+ x_var.length_unit = topography.info['unit']
215
+ x_var[...] = (np.arange(nx) + 0.5) * sx / nx
216
+ y_var.length = sy
217
+ y_var.periodic = 1 if topography.is_periodic else 0
218
+ if 'unit' in topography.info:
219
+ y_var.length_unit = topography.info['unit']
220
+ y_var[...] = (np.arange(ny) + 0.5) * sy / ny
221
+
222
+ if topography.is_domain_decomposed:
223
+ heights_var.set_collective(True)
224
+ heights_var[topography.subdomain_slices] = topography.heights()
225
+
226
+
227
+ # Register analysis functions from this module
228
+ UniformTopographyInterface.register_function('to_netcdf', write_nc)
@@ -0,0 +1,139 @@
1
+ #
2
+ # Copyright 2019-2020 Lars Pastewka
3
+ # 2019 Antoine Sanner
4
+ #
5
+ # ### MIT license
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ #
25
+
26
+ """
27
+ In MPI Parallelized programs:
28
+
29
+ - we have to use `MPI.File.Open` instead of `open` to allow several processors
30
+ to access the same file simultaneously
31
+ - make the file reading in 3 steps:
32
+ - read the nb_grid_pts only (Reader.__init__)
33
+ - make the domain decomposition according to the nb_grid_pts
34
+ - load the relevant subdomain on each processor in Reader.topography()
35
+ """
36
+
37
+ from .. import Topography
38
+ from .Reader import ReaderBase, FileFormatMismatch, ChannelInfo
39
+
40
+ from NuMPI import MPI
41
+ import NuMPI
42
+ import NuMPI.IO
43
+
44
+
45
+ class NPYReader(ReaderBase):
46
+ """
47
+ NPY is a file format made specially for numpy arrays. They contain no extra
48
+ metadata so we use directly the implementation from numpy and NuMPI.
49
+
50
+ For a description of the file format, see here:
51
+ https://docs.scipy.org/doc/numpy/reference/generated/numpy.lib.format.html
52
+ """
53
+
54
+ _format = 'npy'
55
+ _name = 'Numpy arrays (NPY)'
56
+ _description = '''
57
+ Load topography information stored as a numpy array. The numpy array format is
58
+ specified
59
+ [here](https://numpy.org/devdocs/reference/generated/numpy.lib.format.html).
60
+ The reader expects a two-dimensional array and interprets it as a map of
61
+ heights. Numpy arrays do not store units or physical sizes. These need to be
62
+ manually provided by the user.
63
+ '''
64
+
65
+ def __init__(self, fn, communicator=MPI.COMM_WORLD):
66
+ """
67
+ Open file in the NPY format.
68
+
69
+ Parameters
70
+ ----------
71
+ fn: str
72
+ Name of the file
73
+ communicator: mpi4py MPI communicator or NuMPI stub communicator
74
+ MPI communicator object for parallel loads.
75
+ """
76
+ super().__init__()
77
+
78
+ # if comm is None:
79
+ # raise ValueError("you should provide comm when running with MPI")
80
+ try:
81
+ self.mpi_file = NuMPI.IO.make_mpi_file_view(fn, communicator,
82
+ format="npy")
83
+ self.dtype = self.mpi_file.dtype
84
+ self._nb_grid_pts = self.mpi_file.nb_grid_pts
85
+ except NuMPI.IO.MPIFileTypeError:
86
+ raise FileFormatMismatch()
87
+
88
+ # TODO: maybe implement extras specific to SurfaceTopography, like
89
+ # loading the units and the physical_sizes
90
+
91
+ @property
92
+ def channels(self):
93
+ return [ChannelInfo(self, 0,
94
+ name='Default',
95
+ dim=len(self._nb_grid_pts),
96
+ nb_grid_pts=self._nb_grid_pts)]
97
+
98
+ def topography(self, channel_index=None, physical_sizes=None,
99
+ height_scale_factor=None, info={},
100
+ periodic=False,
101
+ subdomain_locations=None, nb_subdomain_grid_pts=None):
102
+ if channel_index is None:
103
+ channel_index = self._default_channel_index
104
+
105
+ physical_sizes = self._check_physical_sizes(physical_sizes)
106
+ if subdomain_locations is None and nb_subdomain_grid_pts is None:
107
+ if self.mpi_file.comm.size > 1:
108
+ raise ValueError("This is a parallel run, you should provide "
109
+ "subdomain location and number of grid "
110
+ "points")
111
+ return Topography(
112
+ self.mpi_file.read(
113
+ subdomain_locations=subdomain_locations,
114
+ nb_subdomain_grid_pts=nb_subdomain_grid_pts),
115
+ physical_sizes,
116
+ info=info
117
+ )
118
+
119
+ return Topography(
120
+ heights=self.mpi_file.read(
121
+ subdomain_locations=subdomain_locations,
122
+ nb_subdomain_grid_pts=nb_subdomain_grid_pts),
123
+ decomposition="subdomain",
124
+ subdomain_locations=subdomain_locations,
125
+ nb_grid_pts=self._nb_grid_pts,
126
+ communicator=self.mpi_file.comm,
127
+ physical_sizes=physical_sizes,
128
+ periodic=periodic,
129
+ info=info)
130
+
131
+ channels.__doc__ = ReaderBase.channels.__doc__
132
+ topography.__doc__ = ReaderBase.topography.__doc__
133
+
134
+
135
+ def save_npy(fn, topography):
136
+ NuMPI.IO.save_npy(fn=fn, data=topography.heights(),
137
+ subdomain_locations=topography.subdomain_locations,
138
+ nb_grid_pts=topography.nb_subdomain_grid_pts,
139
+ comm=topography.communicator)