Skip to content

Commit 9bc27cc

Browse files
authored
Merge branch 'main' into dataset_from_numpy
2 parents 5361b0b + c93b2eb commit 9bc27cc

File tree

3 files changed

+1
-382
lines changed

3 files changed

+1
-382
lines changed

mikeio/_interpolation.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,27 +160,6 @@ def _interp_itemstep(
160160
elem_ids: np.ndarray,
161161
weights: np.ndarray | None = None,
162162
) -> np.ndarray:
163-
"""Interpolate a single item and time step.
164-
165-
Parameters
166-
----------
167-
data : ndarray
168-
data to interpolate
169-
elem_ids : ndarray(int)
170-
n sized array of 1 or more element ids used for interpolation
171-
weights : ndarray(float), optional
172-
weights with same size as elem_ids used for interpolation
173-
174-
Returns
175-
-------
176-
ndarray
177-
spatially interpolated data
178-
179-
Notes
180-
-----
181-
This function is used internally by interp2d
182-
183-
"""
184163
if weights is None:
185164
return data[elem_ids]
186165
else:

mikeio/generic.py

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -56,35 +56,6 @@
5656

5757
@dataclass
5858
class _ChunkInfo:
59-
"""Class for keeping track of an chunked processing.
60-
61-
Parameters
62-
----------
63-
n_data : int
64-
number of data points
65-
n_chunks : int
66-
number of chunks
67-
68-
Attributes
69-
----------
70-
n_data : int
71-
number of data points
72-
n_chunks : int
73-
number of chunks
74-
chunk_size : int
75-
number of data points per chunk
76-
77-
Methods
78-
-------
79-
stop(start)
80-
Return the stop index for a chunk
81-
chunk_end(start)
82-
Return the end index for a chunk
83-
from_dfs(dfs, item_numbers, buffer_size)
84-
Calculate chunk info based on # of elements in dfs file and selected buffer size
85-
86-
"""
87-
8859
def __init__(self, n_data: int, n_chunks: int):
8960
self.n_data = n_data
9061
self.n_chunks = n_chunks
@@ -94,15 +65,12 @@ def __repr__(self) -> str:
9465

9566
@property
9667
def chunk_size(self) -> int:
97-
"""number of data points per chunk."""
9868
return math.ceil(self.n_data / self.n_chunks)
9969

10070
def stop(self, start: int) -> int:
101-
"""Return the stop index for a chunk."""
10271
return min(start + self.chunk_size, self.n_data)
10372

10473
def chunk_end(self, start: int) -> int:
105-
"""Return the end index for a chunk."""
10674
e2 = self.stop(start)
10775
return self.chunk_size - ((start + self.chunk_size) - e2)
10876

@@ -127,29 +95,6 @@ def _clone(
12795
timestep: float | None = None,
12896
items: Sequence[int | DfsDynamicItemInfo] | None = None,
12997
) -> DfsFile:
130-
"""Clone a dfs file.
131-
132-
Parameters
133-
----------
134-
infilename : str | pathlib.Path
135-
input filename
136-
outfilename : str | pathlib.Path
137-
output filename
138-
start_time : datetime, optional
139-
new start time for the new file, by default None
140-
timestep : float, optional
141-
new timestep (in seconds) for the new file, by default None
142-
items : list(int,eum.ItemInfo), optional
143-
list of items for new file, either as a list of
144-
ItemInfo or a list of str/int referring to original file,
145-
default: all items from original file
146-
147-
Returns
148-
-------
149-
DfsFile
150-
MIKE generic dfs file object
151-
152-
"""
15398
source = DfsFileFactory.DfsGenericOpen(str(infilename))
15499
fi = source.FileInfo
155100

@@ -943,23 +888,6 @@ def quantile(
943888

944889

945890
def _read_item(dfs: DfsFile, item: int, timestep: int) -> np.ndarray:
946-
"""Read item data from dfs file.
947-
948-
Parameters
949-
----------
950-
dfs : DfsFile
951-
dfs file
952-
item : int
953-
item number
954-
timestep : int
955-
timestep number
956-
957-
Returns
958-
-------
959-
np.ndarray
960-
item data
961-
962-
"""
963891
indatatime = dfs.ReadItemTimeStep(item + 1, timestepIndex=timestep)
964892
indata = indatatime.Data
965893
has_value = indata != dfs.FileInfo.DeleteValueFloat
@@ -971,21 +899,6 @@ def _read_item(dfs: DfsFile, item: int, timestep: int) -> np.ndarray:
971899
def _get_repeated_items(
972900
items_in: list[DfsDynamicItemInfo], prefixes: list[str]
973901
) -> list[ItemInfo]:
974-
"""Create new items by repeating the items in items_in with the prefixes.
975-
976-
Parameters
977-
----------
978-
items_in : list[DfsDynamicItemInfo]
979-
List of items to be repeated
980-
prefixes : list[str]
981-
List of prefixes to be added to the items
982-
983-
Returns
984-
-------
985-
list[ItemInfo]
986-
List of new items
987-
988-
"""
989902
item_numbers = _valid_item_numbers(items_in)
990903
items_in = _get_item_info(items_in)
991904

0 commit comments

Comments
 (0)