flopy 3.2.1__zip → 3.2.2__zip
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.
- {flopy-3.2.1 → flopy-3.2.2}/PKG-INFO +47 -11
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mbase.py +307 -17
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mf.py +8 -6
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfbcf.py +2 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfchd.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfde4.py +2 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfdis.py +11 -94
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfdrn.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfevt.py +3 -3
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfghb.py +2 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfgmg.py +60 -19
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfhfb.py +7 -7
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mflpf.py +13 -10
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmlt.py +3 -3
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfnwt.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfoc.py +26 -20
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfoc88.py +9 -9
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpar.py +15 -9
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfparbc.py +7 -7
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpcg.py +2 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpcgn.py +3 -3
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpks.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfrch.py +4 -4
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfriv.py +6 -4
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfsip.py +2 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfsor.py +3 -3
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfswi2.py +34 -34
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfswr1.py +4 -4
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfupw.py +4 -4
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfuzf1.py +5 -5
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfwel.py +1 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfzon.py +2 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/mp.py +7 -5
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/mpbas.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/mpsim.py +18 -16
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mt.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtbtn.py +3 -3
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtssm.py +7 -6
- {flopy-3.2.1 → flopy-3.2.2}/flopy/plot/__init__.py +1 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/plot/crosssection.py +73 -103
- flopy-3.2.2/flopy/plot/map.py +647 -0
- flopy-3.2.2/flopy/plot/plotutil.py +1205 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/__init__.py +3 -1
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/binaryfile.py +91 -364
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/binaryhydmodfile.py +3 -3
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/binaryswrfile.py +21 -21
- flopy-3.2.2/flopy/utils/datafile.py +476 -0
- flopy-3.2.2/flopy/utils/flopy_io.py +128 -0
- flopy-3.2.2/flopy/utils/formattedfile.py +366 -0
- flopy-3.2.2/flopy/utils/modpathfile.py +421 -0
- flopy-3.2.2/flopy/utils/reference.py +386 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/util_array.py +512 -83
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/util_list.py +234 -13
- flopy-3.2.2/flopy/version.py +4 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/PKG-INFO +47 -11
- {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/SOURCES.txt +5 -0
- {flopy-3.2.1 → flopy-3.2.2}/setup.py +2 -6
- flopy-3.2.1/flopy/plot/map.py +0 -592
- flopy-3.2.1/flopy/plot/plotutil.py +0 -512
- flopy-3.2.1/flopy/version.py +0 -4
- flopy-3.2.1/requirements.txt +0 -2
- {flopy-3.2.1 → flopy-3.2.2}/flopy/__init__.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/__init__.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfaddoutsidefile.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfbas.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfbct.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mflmt.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmnw1.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmnw2.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfmnwi.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpbc.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfpval.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfsms.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modflow/mfswi.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/modpath/__init__.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/__init__.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtadv.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtdsp.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtgcg.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtphc.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mtrct.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/mt3d/mttob.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/seawat/__init__.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/seawat/swt.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/seawat/swtvdf.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy/utils/mfreadnam.py +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/dependency_links.txt +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/requires.txt +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/flopy.egg-info/top_level.txt +0 -0
- {flopy-3.2.1 → flopy-3.2.2}/setup.cfg +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module spatial and temporal referencing for flopy model objects
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
import numpy as np
|
|
8
|
+
#import pandas as pd
|
|
9
|
+
#from flopy.utils.util_array import util_2d
|
|
10
|
+
|
|
11
|
+
# def temporalreference_from_binary_headers(recordarray, verbose=False):
|
|
12
|
+
#
|
|
13
|
+
# ukper = np.unique(recordarray['kper'])
|
|
14
|
+
# totim = []
|
|
15
|
+
# nstp = []
|
|
16
|
+
# tsmult = []
|
|
17
|
+
# for uk in ukper:
|
|
18
|
+
# uk_recarray = recordarray[recordarray['kper'] == uk]
|
|
19
|
+
# # what is tsmult used for?? Is it necessary for anything??
|
|
20
|
+
# # no pertim in ucn file
|
|
21
|
+
# tm = 1.0
|
|
22
|
+
# try:
|
|
23
|
+
# us = np.unique(uk_recarray['pertim'])
|
|
24
|
+
# if us.shape[0] > 1:
|
|
25
|
+
# tm = (us[1] / us[0]) - 1.0
|
|
26
|
+
# except:
|
|
27
|
+
# pass
|
|
28
|
+
# t = uk_recarray['totim'].max()
|
|
29
|
+
# n = uk_recarray['kstp'].max()
|
|
30
|
+
# totim.append(t)
|
|
31
|
+
# nstp.append(n)
|
|
32
|
+
# tsmult.append(tm)
|
|
33
|
+
# totim = np.array(totim, dtype=np.float32)
|
|
34
|
+
# nstp = np.array(nstp, dtype=np.int)
|
|
35
|
+
# tsmults = np.array(tsmult, dtype=np.float32)
|
|
36
|
+
# perlen = [totim[0]]
|
|
37
|
+
# perlen.extend(list(totim[1:] - totim[:-1]))
|
|
38
|
+
# perlen = np.array(perlen, dtype=np.float32)
|
|
39
|
+
# if verbose:
|
|
40
|
+
# print('LayerFile._build_tr(): assuming time units of days...')
|
|
41
|
+
# #should this be tsmults instead of tsmult??
|
|
42
|
+
# tr = TemporalReference(np.array(perlen), np.zeros_like(nstp),
|
|
43
|
+
# nstp, tsmult, 4)
|
|
44
|
+
# return tr
|
|
45
|
+
|
|
46
|
+
def spatialreference_from_gridspc_file(filename, lenuni=0):
|
|
47
|
+
f = open(filename,'r')
|
|
48
|
+
lines = f.readlines()
|
|
49
|
+
raw = f.readline().strip().split()
|
|
50
|
+
nrow = int(raw[0])
|
|
51
|
+
ncol = int(raw[1])
|
|
52
|
+
raw = f.readline().strip().split()
|
|
53
|
+
xul, yul, rot = float(raw[0]), float(raw[1]), float(raw[2])
|
|
54
|
+
delr = []
|
|
55
|
+
j = 0
|
|
56
|
+
while j < ncol:
|
|
57
|
+
raw = f.readline().strip().split()
|
|
58
|
+
for r in raw:
|
|
59
|
+
if '*' in r:
|
|
60
|
+
rraw = r.split('*')
|
|
61
|
+
for n in range(int(rraw[0])):
|
|
62
|
+
delr.append(int(rraw[1]))
|
|
63
|
+
j += 1
|
|
64
|
+
else:
|
|
65
|
+
delr.append(int(r))
|
|
66
|
+
j += 1
|
|
67
|
+
|
|
68
|
+
delc = []
|
|
69
|
+
i = 0
|
|
70
|
+
while i < nrow:
|
|
71
|
+
raw = f.readline().strip().split()
|
|
72
|
+
for r in raw:
|
|
73
|
+
if '*' in r:
|
|
74
|
+
rraw = r.split('*')
|
|
75
|
+
for n in range(int(rraw[0])):
|
|
76
|
+
delc.append(int(rraw[1]))
|
|
77
|
+
i += 1
|
|
78
|
+
else:
|
|
79
|
+
delc.append(int(r))
|
|
80
|
+
i += 1
|
|
81
|
+
|
|
82
|
+
f.close()
|
|
83
|
+
return SpatialReference(np.array(delr), np.array(delc),
|
|
84
|
+
lenuni, xul=xul, yul=yul, rotation=rot)
|
|
85
|
+
|
|
86
|
+
class SpatialReference(object):
|
|
87
|
+
|
|
88
|
+
def __init__(self, delr, delc, lenuni, xul=None, yul=None, rotation=0.0):
|
|
89
|
+
"""
|
|
90
|
+
delr: delr array
|
|
91
|
+
delc: delc array
|
|
92
|
+
lenuni: lenght unit code
|
|
93
|
+
xul: x coord of upper left corner of grid
|
|
94
|
+
yul: y coord of upper left corner of grid
|
|
95
|
+
rotation_degrees: grid rotation
|
|
96
|
+
"""
|
|
97
|
+
self.delc = delc
|
|
98
|
+
self.delr = delr
|
|
99
|
+
|
|
100
|
+
self.nrow = self.delc.shape[0]
|
|
101
|
+
self.ncol = self.delr.shape[0]
|
|
102
|
+
|
|
103
|
+
self.lenuni = lenuni
|
|
104
|
+
# Set origin and rotation
|
|
105
|
+
if xul is None:
|
|
106
|
+
self.xul = 0.
|
|
107
|
+
else:
|
|
108
|
+
self.xul = xul
|
|
109
|
+
if yul is None:
|
|
110
|
+
self.yul = np.add.reduce(self.delc)
|
|
111
|
+
else:
|
|
112
|
+
self.yul = yul
|
|
113
|
+
self.rotation = rotation
|
|
114
|
+
|
|
115
|
+
self._xgrid = None
|
|
116
|
+
self._ygrid = None
|
|
117
|
+
self._ycentergrid = None
|
|
118
|
+
self._xcentergrid = None
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def __repr__(self):
|
|
122
|
+
s = "spatialReference:xul:{0:<G}, yul:{1:<G},rotation:{2:<G}\n".\
|
|
123
|
+
format(self.xul,self.yul,self.rotation)
|
|
124
|
+
s += "delr:" + str(self.delr) + "\n"
|
|
125
|
+
s += "delc:" + str(self.delc) + "\n"
|
|
126
|
+
return s
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def xedge(self):
|
|
131
|
+
return self.get_xedge_array()
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def yedge(self):
|
|
135
|
+
return self.get_yedge_array()
|
|
136
|
+
|
|
137
|
+
@property
|
|
138
|
+
def xgrid(self):
|
|
139
|
+
self._set_xygrid()
|
|
140
|
+
return self._xgrid
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def ygrid(self):
|
|
144
|
+
self._set_xygrid()
|
|
145
|
+
return self._ygrid
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def xcenter(self):
|
|
149
|
+
return self.get_xcenter_array()
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def ycenter(self):
|
|
153
|
+
return self.get_ycenter_array()
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def ycentergrid(self):
|
|
157
|
+
self._set_xycentergrid()
|
|
158
|
+
return self._ycentergrid
|
|
159
|
+
|
|
160
|
+
@property
|
|
161
|
+
def xcentergrid(self):
|
|
162
|
+
self._set_xycentergrid()
|
|
163
|
+
return self._xcentergrid
|
|
164
|
+
|
|
165
|
+
def _set_xycentergrid(self):
|
|
166
|
+
self._xcentergrid, self._ycentergrid = np.meshgrid(self.xcenter,
|
|
167
|
+
self.ycenter)
|
|
168
|
+
self._xcentergrid, self._ycentergrid = self.rotate(self._xcentergrid,
|
|
169
|
+
self._ycentergrid,
|
|
170
|
+
self.rotation,
|
|
171
|
+
0, self.yedge[0])
|
|
172
|
+
self._xcentergrid += self.xul
|
|
173
|
+
self._ycentergrid += self.yul - self.yedge[0]
|
|
174
|
+
|
|
175
|
+
def _set_xygrid(self):
|
|
176
|
+
self._xgrid, self._ygrid = np.meshgrid(self.xedge, self.yedge)
|
|
177
|
+
self._xgrid, self._ygrid = self.rotate(self._xgrid, self._ygrid, self.rotation,
|
|
178
|
+
0, self.yedge[0])
|
|
179
|
+
self._xgrid += self.xul
|
|
180
|
+
self._ygrid += self.yul - self.yedge[0]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@staticmethod
|
|
184
|
+
def rotate(x, y, theta, xorigin=0., yorigin=0.):
|
|
185
|
+
"""
|
|
186
|
+
Given x and y array-like values calculate the rotation about an
|
|
187
|
+
arbitrary origin and then return the rotated coordinates. theta is in
|
|
188
|
+
degrees.
|
|
189
|
+
|
|
190
|
+
"""
|
|
191
|
+
theta = -theta * np.pi / 180.
|
|
192
|
+
xrot = xorigin + np.cos(theta) * (x - xorigin) - np.sin(theta) * \
|
|
193
|
+
(y - yorigin)
|
|
194
|
+
yrot = yorigin + np.sin(theta) * (x - xorigin) + np.cos(theta) * \
|
|
195
|
+
(y - yorigin)
|
|
196
|
+
return xrot, yrot
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def get_extent(self):
|
|
200
|
+
"""
|
|
201
|
+
Get the extent of the rotated and offset grid
|
|
202
|
+
|
|
203
|
+
Return (xmin, xmax, ymin, ymax)
|
|
204
|
+
|
|
205
|
+
"""
|
|
206
|
+
x0 = self.xedge[0]
|
|
207
|
+
x1 = self.xedge[-1]
|
|
208
|
+
y0 = self.yedge[0]
|
|
209
|
+
y1 = self.yedge[-1]
|
|
210
|
+
|
|
211
|
+
# upper left point
|
|
212
|
+
x0r, y0r = self.rotate(x0, y0, self.rotation, 0, self.yedge[0])
|
|
213
|
+
x0r += self.xul
|
|
214
|
+
y0r += self.yul - self.yedge[0]
|
|
215
|
+
|
|
216
|
+
# upper right point
|
|
217
|
+
x1r, y1r = self.rotate(x1, y0, self.rotation, 0, self.yedge[0])
|
|
218
|
+
x1r += self.xul
|
|
219
|
+
y1r += self.yul - self.yedge[0]
|
|
220
|
+
|
|
221
|
+
# lower right point
|
|
222
|
+
x2r, y2r = self.rotate(x1, y1, self.rotation, 0, self.yedge[0])
|
|
223
|
+
x2r += self.xul
|
|
224
|
+
y2r += self.yul - self.yedge[0]
|
|
225
|
+
|
|
226
|
+
# lower left point
|
|
227
|
+
x3r, y3r = self.rotate(x0, y1, self.rotation, 0, self.yedge[0])
|
|
228
|
+
x3r += self.xul
|
|
229
|
+
y3r += self.yul - self.yedge[0]
|
|
230
|
+
|
|
231
|
+
xmin = min(x0r, x1r, x2r, x3r)
|
|
232
|
+
xmax = max(x0r, x1r, x2r, x3r)
|
|
233
|
+
ymin = min(y0r, y1r, y2r, y3r)
|
|
234
|
+
ymax = max(y0r, y1r, y2r, y3r)
|
|
235
|
+
|
|
236
|
+
return (xmin, xmax, ymin, ymax)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def get_xcenter_array(self):
|
|
240
|
+
"""
|
|
241
|
+
Return a numpy one-dimensional float array that has the cell center x
|
|
242
|
+
coordinate for every column in the grid.
|
|
243
|
+
|
|
244
|
+
"""
|
|
245
|
+
x = np.add.accumulate(self.delr) - 0.5 * self.delr
|
|
246
|
+
return x
|
|
247
|
+
|
|
248
|
+
def get_ycenter_array(self):
|
|
249
|
+
"""
|
|
250
|
+
Return a numpy one-dimensional float array that has the cell center x
|
|
251
|
+
coordinate for every row in the grid.
|
|
252
|
+
|
|
253
|
+
"""
|
|
254
|
+
Ly = np.add.reduce(self.delc)
|
|
255
|
+
y = Ly - (np.add.accumulate(self.delc) - 0.5 *
|
|
256
|
+
self.delc)
|
|
257
|
+
return y
|
|
258
|
+
|
|
259
|
+
def get_xedge_array(self):
|
|
260
|
+
"""
|
|
261
|
+
Return a numpy one-dimensional float array that has the cell edge x
|
|
262
|
+
coordinates for every column in the grid. Array is of size (ncol + 1)
|
|
263
|
+
|
|
264
|
+
"""
|
|
265
|
+
xedge = np.concatenate(([0.], np.add.accumulate(self.delr)))
|
|
266
|
+
return xedge
|
|
267
|
+
|
|
268
|
+
def get_yedge_array(self):
|
|
269
|
+
"""
|
|
270
|
+
Return a numpy one-dimensional float array that has the cell edge y
|
|
271
|
+
coordinates for every row in the grid. Array is of size (nrow + 1)
|
|
272
|
+
|
|
273
|
+
"""
|
|
274
|
+
length_y = np.add.reduce(self.delc)
|
|
275
|
+
yedge = np.concatenate(([length_y], length_y -
|
|
276
|
+
np.add.accumulate(self.delc)))
|
|
277
|
+
return yedge
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def write_gridSpec(self, filename):
|
|
281
|
+
f = open(filename,'w')
|
|
282
|
+
f.write("{0:10d} {1:10d}\n".format(self.delc.shape[0], self.delr.shape[0]))
|
|
283
|
+
f.write("{0:15.6E} {1:15.6E} {2:15.6E}\n".format(self.xul,self.yul,self.rotation))
|
|
284
|
+
for c in self.delc:
|
|
285
|
+
f.write("{0:15.6E} ".format(c))
|
|
286
|
+
f.write('\n')
|
|
287
|
+
for r in self.delr:
|
|
288
|
+
f.write("{0:15.6E} ".format(c))
|
|
289
|
+
f.write('\n')
|
|
290
|
+
return
|
|
291
|
+
|
|
292
|
+
def get_vertices(self, i, j):
|
|
293
|
+
pts = []
|
|
294
|
+
xgrid, ygrid = self.xgrid, self.ygrid
|
|
295
|
+
pts.append([xgrid[i, j], ygrid[i, j]])
|
|
296
|
+
pts.append([xgrid[i, j], ygrid[i+1, j]])
|
|
297
|
+
pts.append([xgrid[i, j+1], ygrid[i+1, j]])
|
|
298
|
+
pts.append([xgrid[i, j+1], ygrid[i, j]])
|
|
299
|
+
pts.append([xgrid[i, j], ygrid[i, j]])
|
|
300
|
+
return pts
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
# class TemporalReference(object):
|
|
304
|
+
#
|
|
305
|
+
# def __init__(self, perlen, steady, nstp, tsmult, itmuni, start_datetime=None):
|
|
306
|
+
# """
|
|
307
|
+
# :param perlen: stress period length array
|
|
308
|
+
# :param steady: array-like boolean steady-state flag array
|
|
309
|
+
# :param nstp: array of number of time steps per stress period
|
|
310
|
+
# :param tsmult: array of time step length multiplier per stress period
|
|
311
|
+
# :param itmuni: time unit
|
|
312
|
+
# :param start_datetime: datetime instance
|
|
313
|
+
# :return: none
|
|
314
|
+
#
|
|
315
|
+
# stressperiod_start: date_range for start of stress periods
|
|
316
|
+
# stressperiod_end: date_range for end of stress periods
|
|
317
|
+
# stressperiod_deltas: timeoffset range for stress periods
|
|
318
|
+
#
|
|
319
|
+
# timestep_start: date_range for start of time steps
|
|
320
|
+
# timestep_end: date_range for end of time steps
|
|
321
|
+
# timestep_delta: timeoffset range for time steps
|
|
322
|
+
#
|
|
323
|
+
# kperkstp_loc: dict keyed on (kper,kstp) stores the index pos in the timestep ranges
|
|
324
|
+
#
|
|
325
|
+
# """
|
|
326
|
+
# self.itmuni_daterange = {1: 's', 2: 'm', 3: 'h', 4: 'd', 5: 'y'}
|
|
327
|
+
# if start_datetime is None:
|
|
328
|
+
# self.start = datetime(1970, 1, 1)
|
|
329
|
+
# self.assumed = True
|
|
330
|
+
# else:
|
|
331
|
+
# assert isinstance(start_datetime, datetime)
|
|
332
|
+
# self.start = start_datetime
|
|
333
|
+
# self.assumed = False
|
|
334
|
+
# if itmuni == 0:
|
|
335
|
+
# print("temporalReference warning: time units (itmuni) undefined, assuming days")
|
|
336
|
+
# self.unit = self.itmuni_daterange[itmuni]
|
|
337
|
+
# # work out stress period lengths,starts and ends
|
|
338
|
+
# self.stressperiod_deltas = pd.to_timedelta(perlen, unit=self.unit)
|
|
339
|
+
# self.stressperiod_end = self.start + np.cumsum(self.stressperiod_deltas)
|
|
340
|
+
# self.stressperiod_start = self.stressperiod_end - self.stressperiod_deltas
|
|
341
|
+
#
|
|
342
|
+
# # work out time step lengths - not very elegant
|
|
343
|
+
# offsets = []
|
|
344
|
+
# idt = 0
|
|
345
|
+
# self.kperkstp_loc = {}
|
|
346
|
+
# for kper, (plen, nts, tmult) in enumerate(zip(perlen, nstp, tsmult)):
|
|
347
|
+
# if tmult != 1.0:
|
|
348
|
+
# dt1 = plen * ((tmult - 1.)/((tmult**nts) - 1.))
|
|
349
|
+
# else:
|
|
350
|
+
# dt1 = float(plen) / float(nts)
|
|
351
|
+
# offsets.append(dt1)
|
|
352
|
+
# self.kperkstp_loc[(kper, 0)] = idt
|
|
353
|
+
# idt += 1
|
|
354
|
+
# for its in range(nts-1):
|
|
355
|
+
# offsets.append(offsets[-1] * tmult)
|
|
356
|
+
# self.kperkstp_loc[(kper, its + 1)] = idt
|
|
357
|
+
# idt += 1
|
|
358
|
+
# self.timestep_deltas = pd.to_timedelta(offsets, unit=self.unit)
|
|
359
|
+
# self.timestep_end = self.start + np.cumsum(self.timestep_deltas)
|
|
360
|
+
# self.timestep_start = self.timestep_end - self.timestep_deltas
|
|
361
|
+
#
|
|
362
|
+
# self.perlen = perlen
|
|
363
|
+
# self.steady = steady
|
|
364
|
+
# self.nstp = nstp
|
|
365
|
+
# self.tsmult = tsmult
|
|
366
|
+
#
|
|
367
|
+
# if True in steady:
|
|
368
|
+
# #raise NotImplementedError("temporalReference: not dealing with steady state yet")
|
|
369
|
+
# print("temporalReference warning: not dealing with steady state yet")
|
|
370
|
+
# return
|
|
371
|
+
#
|
|
372
|
+
#
|
|
373
|
+
# def totim_to_datetime(self,totim):
|
|
374
|
+
# return self.start + pd.to_timedelta(totim,unit=self.unit)
|
|
375
|
+
# def __repr__(self):
|
|
376
|
+
# s = "TemporalReference:start_datetime:" + str(self.start)
|
|
377
|
+
# s += ", nper:{0:G}\n".format(self.perlen.shape[0])
|
|
378
|
+
# s += "perlen:" + str(self.perlen) + '\n'
|
|
379
|
+
# s += "nstp:" + str(self.nstp) + '\n'
|
|
380
|
+
# s += "steady:" + str(self.steady) + '\n'
|
|
381
|
+
# s += "tsmult:" + str(self.tsmult) + '\n'
|
|
382
|
+
#
|
|
383
|
+
# return s
|
|
384
|
+
#
|
|
385
|
+
# def get_datetimes_from_oc(self,oc):
|
|
386
|
+
# raise NotImplementedError()
|