1
1
from math import prod
2
- from os import sep
3
2
4
3
import cfdm
5
4
import numpy as np
14
13
from .functions import (
15
14
_DEPRECATION_ERROR_ARG ,
16
15
_DEPRECATION_ERROR_METHOD ,
17
- abspath ,
18
16
indices_shape ,
19
17
parse_indices ,
20
18
)
@@ -125,43 +123,6 @@ def size(self):
125
123
[domain_axis .get_size (0 ) for domain_axis in domain_axes .values ()]
126
124
)
127
125
128
- def add_file_location (
129
- self ,
130
- location ,
131
- ):
132
- """Add a new file location in-place.
133
-
134
- All data definitions that reference files are additionally
135
- referenced from the given location.
136
-
137
- .. versionadded:: 3.15.0
138
-
139
- .. seealso:: `del_file_location`, `file_locations`
140
-
141
- :Parameters:
142
-
143
- location: `str`
144
- The new location.
145
-
146
- :Returns:
147
-
148
- `str`
149
- The new location as an absolute path with no trailing
150
- path name component separator.
151
-
152
- **Examples**
153
-
154
- >>> f.add_file_location('/data/model/')
155
- '/data/model'
156
-
157
- """
158
- location = abspath (location ).rstrip (sep )
159
-
160
- for c in self .constructs .filter_by_data (todict = True ).values ():
161
- c .add_file_location (location )
162
-
163
- return location
164
-
165
126
def close (self ):
166
127
"""Close all files referenced by the domain construct.
167
128
@@ -188,43 +149,6 @@ def close(self):
188
149
removed_at = "5.0.0" ,
189
150
) # pragma: no cover
190
151
191
- def del_file_location (
192
- self ,
193
- location ,
194
- ):
195
- """Remove a file location in-place.
196
-
197
- All data definitions that reference files will have references
198
- to files in the given location removed from them.
199
-
200
- .. versionadded:: 3.15.0
201
-
202
- .. seealso:: `add_file_location`, `file_locations`
203
-
204
- :Parameters:
205
-
206
- location: `str`
207
- The file location to remove.
208
-
209
- :Returns:
210
-
211
- `str`
212
- The removed location as an absolute path with no
213
- trailing path name component separator.
214
-
215
- **Examples**
216
-
217
- >>> d.del_file_location('/data/model/')
218
- '/data/model'
219
-
220
- """
221
- location = abspath (location ).rstrip (sep )
222
-
223
- for c in self .constructs .filter_by_data (todict = True ).values ():
224
- c .del_file_location (location )
225
-
226
- return location
227
-
228
152
@classmethod
229
153
def create_regular (cls , x_args , y_args , bounds = True ):
230
154
"""
@@ -333,38 +257,6 @@ def create_regular(cls, x_args, y_args, bounds=True):
333
257
334
258
return domain
335
259
336
- def file_locations (
337
- self ,
338
- ):
339
- """The locations of files containing parts of the components data.
340
-
341
- Returns the locations of any files that may be required to
342
- deliver the computed data arrays of any of the component
343
- constructs (such as dimension coordinate constructs, cell
344
- measure constructs, etc.).
345
-
346
- .. versionadded:: 3.15.0
347
-
348
- .. seealso:: `add_file_location`, `del_file_location`
349
-
350
- :Returns:
351
-
352
- `set`
353
- The unique file locations as absolute paths with no
354
- trailing path name component separator.
355
-
356
- **Examples**
357
-
358
- >>> d.file_locations()
359
- {'/home/data1', 'file:///data2'}
360
-
361
- """
362
- out = set ()
363
- for c in self .constructs .filter_by_data (todict = True ).values ():
364
- out .update (c .file_locations ())
365
-
366
- return out
367
-
368
260
@_inplace_enabled (default = False )
369
261
def flip (self , axes = None , inplace = False ):
370
262
"""Flip (reverse the direction of) domain axes.
0 commit comments