sectionate 0.3.0__py3-none-any.whl
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.
- sectionate/__init__.py +6 -0
- sectionate/catalog/Atlantic_transport_arrays.json +348 -0
- sectionate/gridutils.py +95 -0
- sectionate/section.py +786 -0
- sectionate/tests/test_convergent_transport.py +120 -0
- sectionate/tests/test_section.py +92 -0
- sectionate/tests/test_section_class.py +59 -0
- sectionate/tests/test_section_cornercases.py +63 -0
- sectionate/tests/test_utils.py +4 -0
- sectionate/tracers.py +76 -0
- sectionate/transports.py +505 -0
- sectionate/utils.py +173 -0
- sectionate/version.py +3 -0
- sectionate-0.3.0.dist-info/METADATA +44 -0
- sectionate-0.3.0.dist-info/RECORD +17 -0
- sectionate-0.3.0.dist-info/WHEEL +4 -0
- sectionate-0.3.0.dist-info/licenses/LICENSE +674 -0
sectionate/__init__.py
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Western Europe": {
|
|
3
|
+
"lon": [
|
|
4
|
+
9.0,
|
|
5
|
+
15.0,
|
|
6
|
+
22.0,
|
|
7
|
+
35.0
|
|
8
|
+
],
|
|
9
|
+
"lat": [
|
|
10
|
+
48.0,
|
|
11
|
+
51.0,
|
|
12
|
+
49.0,
|
|
13
|
+
60.0
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"Bering Strait": {
|
|
17
|
+
"lon": [
|
|
18
|
+
55.0,
|
|
19
|
+
-290.0,
|
|
20
|
+
-225.0,
|
|
21
|
+
-190.0,
|
|
22
|
+
-185.0,
|
|
23
|
+
-180.0,
|
|
24
|
+
-175.0,
|
|
25
|
+
-170.0,
|
|
26
|
+
-165.0,
|
|
27
|
+
-150.0,
|
|
28
|
+
-130.0,
|
|
29
|
+
-100.0,
|
|
30
|
+
-90.0
|
|
31
|
+
],
|
|
32
|
+
"lat": [
|
|
33
|
+
55.0,
|
|
34
|
+
55.0,
|
|
35
|
+
65.0,
|
|
36
|
+
65.5,
|
|
37
|
+
67.0,
|
|
38
|
+
67.5,
|
|
39
|
+
66.0,
|
|
40
|
+
66.0,
|
|
41
|
+
65.5,
|
|
42
|
+
65.5,
|
|
43
|
+
65.5,
|
|
44
|
+
50.0,
|
|
45
|
+
45.0
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"Fram Strait": {
|
|
49
|
+
"lon": [
|
|
50
|
+
-44.0,
|
|
51
|
+
-30.0,
|
|
52
|
+
-22.0,
|
|
53
|
+
14.3,
|
|
54
|
+
28.5,
|
|
55
|
+
29.5,
|
|
56
|
+
35.0
|
|
57
|
+
],
|
|
58
|
+
"lat": [
|
|
59
|
+
69.0,
|
|
60
|
+
78.0,
|
|
61
|
+
79.0,
|
|
62
|
+
79.0,
|
|
63
|
+
70.0,
|
|
64
|
+
66.0,
|
|
65
|
+
60.0
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"Davis Strait": {
|
|
69
|
+
"lon": [
|
|
70
|
+
-65.0,
|
|
71
|
+
-65.0,
|
|
72
|
+
-62.0,
|
|
73
|
+
-50.0,
|
|
74
|
+
-47.5,
|
|
75
|
+
-44.0
|
|
76
|
+
],
|
|
77
|
+
"lat": [
|
|
78
|
+
53.0,
|
|
79
|
+
57.5,
|
|
80
|
+
66.5,
|
|
81
|
+
66.5,
|
|
82
|
+
66.5,
|
|
83
|
+
69.0
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"Denmark Strait": {
|
|
87
|
+
"lon": [
|
|
88
|
+
-44.0,
|
|
89
|
+
-35.0,
|
|
90
|
+
-25.0,
|
|
91
|
+
-20.0
|
|
92
|
+
],
|
|
93
|
+
"lat": [
|
|
94
|
+
69.0,
|
|
95
|
+
69.0,
|
|
96
|
+
65.0,
|
|
97
|
+
65.0
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"Faroe Current": {
|
|
101
|
+
"lon": [
|
|
102
|
+
-14.0,
|
|
103
|
+
-6.25
|
|
104
|
+
],
|
|
105
|
+
"lat": [
|
|
106
|
+
65.0,
|
|
107
|
+
62.25
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"Faroe Bank": {
|
|
111
|
+
"lon": [
|
|
112
|
+
-6.25,
|
|
113
|
+
-6.25,
|
|
114
|
+
-5.0,
|
|
115
|
+
-5.0
|
|
116
|
+
],
|
|
117
|
+
"lat": [
|
|
118
|
+
62.25,
|
|
119
|
+
61.0,
|
|
120
|
+
58.5,
|
|
121
|
+
56.75
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"OSNAP West": {
|
|
125
|
+
"lon": [
|
|
126
|
+
-58.0,
|
|
127
|
+
-51.0,
|
|
128
|
+
-49.0,
|
|
129
|
+
-48.0,
|
|
130
|
+
-45.0,
|
|
131
|
+
-44.0
|
|
132
|
+
],
|
|
133
|
+
"lat": [
|
|
134
|
+
52.0,
|
|
135
|
+
52.5,
|
|
136
|
+
54.0,
|
|
137
|
+
58.5,
|
|
138
|
+
60.5,
|
|
139
|
+
64.0
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"OSNAP East": {
|
|
143
|
+
"lon": [
|
|
144
|
+
-44.0,
|
|
145
|
+
-42.0,
|
|
146
|
+
-31.0,
|
|
147
|
+
-28.0,
|
|
148
|
+
-15.0,
|
|
149
|
+
-12.5,
|
|
150
|
+
-9.5,
|
|
151
|
+
-5.0
|
|
152
|
+
],
|
|
153
|
+
"lat": [
|
|
154
|
+
64.0,
|
|
155
|
+
60.5,
|
|
156
|
+
59.0,
|
|
157
|
+
58.25,
|
|
158
|
+
58.0,
|
|
159
|
+
57.5,
|
|
160
|
+
57.25,
|
|
161
|
+
56.75
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"English Channel": {
|
|
165
|
+
"lon": [
|
|
166
|
+
-5.0,
|
|
167
|
+
0.0,
|
|
168
|
+
0.0,
|
|
169
|
+
2.5,
|
|
170
|
+
2.5
|
|
171
|
+
],
|
|
172
|
+
"lat": [
|
|
173
|
+
56.75,
|
|
174
|
+
51.0,
|
|
175
|
+
49.0,
|
|
176
|
+
49.0,
|
|
177
|
+
47.5
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"NOAC 47N": {
|
|
181
|
+
"lon": [
|
|
182
|
+
-58.0,
|
|
183
|
+
-56.5,
|
|
184
|
+
-50.0,
|
|
185
|
+
-12.0,
|
|
186
|
+
2.5
|
|
187
|
+
],
|
|
188
|
+
"lat": [
|
|
189
|
+
52.0,
|
|
190
|
+
48.25,
|
|
191
|
+
47.0,
|
|
192
|
+
47.5,
|
|
193
|
+
47.5
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"Strait of Gibraltar": {
|
|
197
|
+
"lon": [
|
|
198
|
+
-4.0,
|
|
199
|
+
-5.75,
|
|
200
|
+
-5.75,
|
|
201
|
+
-4.0
|
|
202
|
+
],
|
|
203
|
+
"lat": [
|
|
204
|
+
38.0,
|
|
205
|
+
36.5,
|
|
206
|
+
35.5,
|
|
207
|
+
34.0
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
"RAPID 26N": {
|
|
211
|
+
"lon": [
|
|
212
|
+
-90.0,
|
|
213
|
+
-80.0,
|
|
214
|
+
-80.0,
|
|
215
|
+
-72.0,
|
|
216
|
+
-49.0,
|
|
217
|
+
-41.0,
|
|
218
|
+
-24.0,
|
|
219
|
+
-21.5,
|
|
220
|
+
-16.5,
|
|
221
|
+
-10.0,
|
|
222
|
+
-5.0,
|
|
223
|
+
-4.0
|
|
224
|
+
],
|
|
225
|
+
"lat": [
|
|
226
|
+
40.0,
|
|
227
|
+
34.0,
|
|
228
|
+
26.0,
|
|
229
|
+
26.0,
|
|
230
|
+
25.0,
|
|
231
|
+
24.75,
|
|
232
|
+
24.5,
|
|
233
|
+
25.5,
|
|
234
|
+
27.0,
|
|
235
|
+
28.5,
|
|
236
|
+
28.5,
|
|
237
|
+
28.5
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"Quebec": {
|
|
241
|
+
"lon": [
|
|
242
|
+
-80.0,
|
|
243
|
+
-75.0,
|
|
244
|
+
-70.0,
|
|
245
|
+
-65.0
|
|
246
|
+
],
|
|
247
|
+
"lat": [
|
|
248
|
+
47.5,
|
|
249
|
+
50.0,
|
|
250
|
+
53.0,
|
|
251
|
+
53.0
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
"MOVE 16N": {
|
|
255
|
+
"lon": [
|
|
256
|
+
-61.5,
|
|
257
|
+
-61.5,
|
|
258
|
+
-61.5,
|
|
259
|
+
-51.5,
|
|
260
|
+
-12.0,
|
|
261
|
+
20.0
|
|
262
|
+
],
|
|
263
|
+
"lat": [
|
|
264
|
+
0.0,
|
|
265
|
+
8.0,
|
|
266
|
+
16.75,
|
|
267
|
+
16.0,
|
|
268
|
+
16.0,
|
|
269
|
+
16.0
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
"Isthmus of Panama": {
|
|
273
|
+
"lon": [
|
|
274
|
+
-105.0,
|
|
275
|
+
-105.0,
|
|
276
|
+
-98.0,
|
|
277
|
+
-95.0,
|
|
278
|
+
-92.0,
|
|
279
|
+
-91.0,
|
|
280
|
+
-90.0,
|
|
281
|
+
-87.0,
|
|
282
|
+
-85.0,
|
|
283
|
+
-84.8,
|
|
284
|
+
-83.8,
|
|
285
|
+
-83.0,
|
|
286
|
+
-82.0,
|
|
287
|
+
-81.0,
|
|
288
|
+
-80.0,
|
|
289
|
+
-79.4,
|
|
290
|
+
-78.8,
|
|
291
|
+
-78.0,
|
|
292
|
+
-77.0,
|
|
293
|
+
-71.0
|
|
294
|
+
],
|
|
295
|
+
"lat": [
|
|
296
|
+
40.0,
|
|
297
|
+
22.0,
|
|
298
|
+
19.0,
|
|
299
|
+
17.3,
|
|
300
|
+
17.3,
|
|
301
|
+
16.5,
|
|
302
|
+
15.0,
|
|
303
|
+
14.5,
|
|
304
|
+
12.5,
|
|
305
|
+
11.0,
|
|
306
|
+
10.0,
|
|
307
|
+
9.2,
|
|
308
|
+
8.7,
|
|
309
|
+
8.3,
|
|
310
|
+
9.0,
|
|
311
|
+
9.3,
|
|
312
|
+
9.2,
|
|
313
|
+
8.8,
|
|
314
|
+
7.0,
|
|
315
|
+
0.0
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
"11S": {
|
|
319
|
+
"lon": [
|
|
320
|
+
-55.0,
|
|
321
|
+
-37.0,
|
|
322
|
+
-34.0,
|
|
323
|
+
15.0,
|
|
324
|
+
25.0
|
|
325
|
+
],
|
|
326
|
+
"lat": [
|
|
327
|
+
-9.0,
|
|
328
|
+
-9.0,
|
|
329
|
+
-11.0,
|
|
330
|
+
-11.0,
|
|
331
|
+
-11.0
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
"SAMBA": {
|
|
335
|
+
"lon": [
|
|
336
|
+
-55.0,
|
|
337
|
+
-55.0,
|
|
338
|
+
19.5,
|
|
339
|
+
25.0
|
|
340
|
+
],
|
|
341
|
+
"lat": [
|
|
342
|
+
-20.0,
|
|
343
|
+
-34.5,
|
|
344
|
+
-34.5,
|
|
345
|
+
-20.0
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
}
|
sectionate/gridutils.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
def get_geo_corners(grid):
|
|
2
|
+
"""
|
|
3
|
+
Find longitude and latitude coordinates from grid dataset, assuming the coordinate
|
|
4
|
+
names contain the sub-strings "lon" and "lat", respectively.
|
|
5
|
+
|
|
6
|
+
Parameters
|
|
7
|
+
----------
|
|
8
|
+
grid: xgcm.Grid
|
|
9
|
+
Contains information about ocean model grid discretization, e.g. coordinates and metrics.
|
|
10
|
+
|
|
11
|
+
Returns
|
|
12
|
+
-------
|
|
13
|
+
dict
|
|
14
|
+
Dictionary containing names of longitude and latitude coordinates.
|
|
15
|
+
"""
|
|
16
|
+
dims = {}
|
|
17
|
+
for axis in ["X", "Y"]:
|
|
18
|
+
if "outer" in grid.axes[axis].coords:
|
|
19
|
+
dims[axis] = grid.axes[axis].coords["outer"]
|
|
20
|
+
elif "right" in grid.axes[axis].coords:
|
|
21
|
+
dims[axis] = grid.axes[axis].coords["right"]
|
|
22
|
+
else:
|
|
23
|
+
raise ValueError("Only 'symmetric' and 'non-symmetric' grids\
|
|
24
|
+
are currently supported. They require C-grid topology, i.e. with\
|
|
25
|
+
vorticity coordinates at 'outer' and 'right' positions, respectively.")
|
|
26
|
+
|
|
27
|
+
coords = grid._ds.coords
|
|
28
|
+
return {
|
|
29
|
+
axis: [
|
|
30
|
+
coords[c] for c in coords
|
|
31
|
+
if (
|
|
32
|
+
(geoc in c) and
|
|
33
|
+
(dims["X"] in coords[c].dims) and
|
|
34
|
+
(dims["Y"] in coords[c].dims)
|
|
35
|
+
)
|
|
36
|
+
][0]
|
|
37
|
+
for axis, geoc in zip(["X", "Y"], ["lon", "lat"])
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def coord_dict(grid):
|
|
41
|
+
"""
|
|
42
|
+
Find names of "X" and "Y" dimension variables from grid dataset.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
grid: xgcm.Grid
|
|
47
|
+
Contains information about ocean model grid discretization, e.g. coordinates and metrics.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
dict
|
|
52
|
+
Dictionary containing names of "X" and "Y" dimension variables, at both cell 'center' position
|
|
53
|
+
and either 'outer' or 'right' position. ('left' position not yet supported.)
|
|
54
|
+
"""
|
|
55
|
+
if check_symmetric(grid):
|
|
56
|
+
corner_pos = "outer"
|
|
57
|
+
else:
|
|
58
|
+
corner_pos = "right"
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
"X": {
|
|
62
|
+
"center": grid.axes["X"].coords["center"],
|
|
63
|
+
"corner": grid.axes["X"].coords[corner_pos]},
|
|
64
|
+
"Y": {
|
|
65
|
+
"center": grid.axes["Y"].coords["center"],
|
|
66
|
+
"corner": grid.axes["Y"].coords[corner_pos]},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
def check_symmetric(grid):
|
|
70
|
+
"""
|
|
71
|
+
Check whether the horizontal ocean model grid is symmetric or not, according to MOM6 conventions.
|
|
72
|
+
Symmetric C-grids have tracers on (M,N) 'center' positions and vorticity on (M+1, N+1) 'outer' positions.
|
|
73
|
+
Non-symmetric C-grids instead have vorticity on (M,N) 'right' positions.
|
|
74
|
+
|
|
75
|
+
Parameters
|
|
76
|
+
----------
|
|
77
|
+
grid: xgcm.Grid
|
|
78
|
+
Contains information about ocean model grid discretization, e.g. coordinates and metrics.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
symmetric : bool
|
|
83
|
+
True if symmetric; False if non-symmetric.
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
pos_dict = {
|
|
87
|
+
p : ((p in grid.axes["X"].coords) and (p in grid.axes["Y"].coords))
|
|
88
|
+
for p in ["outer", "right"]
|
|
89
|
+
}
|
|
90
|
+
if pos_dict["outer"]:
|
|
91
|
+
return True
|
|
92
|
+
elif pos_dict["right"]:
|
|
93
|
+
return False
|
|
94
|
+
else:
|
|
95
|
+
raise ValueError("Horizontal grid axes ('X', 'Y') must be either both symmetric or both non-symmetric (by MOM6 conventions).")
|