pyissm 0.0.1.dev1__tar.gz
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.
- pyissm-0.0.1.dev1/LICENSE +201 -0
- pyissm-0.0.1.dev1/PKG-INFO +34 -0
- pyissm-0.0.1.dev1/README.md +8 -0
- pyissm-0.0.1.dev1/pyproject.toml +38 -0
- pyissm-0.0.1.dev1/setup.cfg +4 -0
- pyissm-0.0.1.dev1/src/pyissm/__init__.py +1 -0
- pyissm-0.0.1.dev1/src/pyissm/analysis/__init__.py +1 -0
- pyissm-0.0.1.dev1/src/pyissm/analysis/ismip.py +103 -0
- pyissm-0.0.1.dev1/src/pyissm/data/__init__.py +1 -0
- pyissm-0.0.1.dev1/src/pyissm/data/interp.py +256 -0
- pyissm-0.0.1.dev1/src/pyissm/learn/__init__.py +1 -0
- pyissm-0.0.1.dev1/src/pyissm/learn/tutorials.py +3 -0
- pyissm-0.0.1.dev1/src/pyissm/model/Model.py +586 -0
- pyissm-0.0.1.dev1/src/pyissm/model/__init__.py +2 -0
- pyissm-0.0.1.dev1/src/pyissm/model/bc.py +167 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/__init__.py +52 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/amr.py +189 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/autodiff.py +303 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/balancethickness.py +120 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/basalforcings.py +1246 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/calving.py +752 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/class_registry.py +388 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/class_utils.py +824 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/cluster.py +904 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/constants.py +109 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/damage.py +247 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/debris.py +205 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/debug.py +94 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/dependent.py +121 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/dsl.py +228 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/esa.py +175 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/flowequation.py +232 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/friction.py +1484 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/frontalforcings.py +633 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/geometry.py +136 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/groundingline.py +168 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/hydrology.py +1573 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/independent.py +105 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/initialization.py +286 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/inversion.py +742 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/issmsettings.py +135 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/levelset.py +126 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/love.py +518 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/lovenumbers.py +179 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/mask.py +100 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/massfluxatgate.py +130 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/masstransport.py +179 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/materials.py +996 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/mesh.py +909 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/miscellaneous.py +94 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/misfit.py +148 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/nodalvalue.py +110 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/offlinesolidearthsolution.py +129 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/organizer.py +0 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/outputdefinition.py +106 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/private.py +74 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/qmu.py +124 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/radaroverlay.py +72 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/regionaloutput.py +140 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/results.py +331 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/rifts.py +153 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/rotational.py +100 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/sampling.py +190 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/smb.py +3266 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/solidearth.py +828 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/steadystate.py +157 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/stochasticforcing.py +364 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/stressbalance.py +311 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/surfaceload.py +118 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/thermal.py +228 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/timestepping.py +309 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/toolkits.py +168 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/transient.py +262 -0
- pyissm-0.0.1.dev1/src/pyissm/model/classes/verbose.py +172 -0
- pyissm-0.0.1.dev1/src/pyissm/model/execute.py +1920 -0
- pyissm-0.0.1.dev1/src/pyissm/model/io.py +1241 -0
- pyissm-0.0.1.dev1/src/pyissm/model/mesh.py +2503 -0
- pyissm-0.0.1.dev1/src/pyissm/model/param.py +669 -0
- pyissm-0.0.1.dev1/src/pyissm/plot.py +883 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/__init__.py +1 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/config.py +312 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/exp.py +271 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/general.py +541 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/geometry.py +76 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/interp.py +150 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/materials.py +173 -0
- pyissm-0.0.1.dev1/src/pyissm/tools/wrappers.py +965 -0
- pyissm-0.0.1.dev1/src/pyissm.egg-info/PKG-INFO +34 -0
- pyissm-0.0.1.dev1/src/pyissm.egg-info/SOURCES.txt +91 -0
- pyissm-0.0.1.dev1/src/pyissm.egg-info/dependency_links.txt +1 -0
- pyissm-0.0.1.dev1/src/pyissm.egg-info/requires.txt +8 -0
- pyissm-0.0.1.dev1/src/pyissm.egg-info/top_level.txt +1 -0
- pyissm-0.0.1.dev1/test/test_marshall_class.py +170 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyissm
|
|
3
|
+
Version: 0.0.1.dev1
|
|
4
|
+
Summary: Python API for the Ice-sheet and Sea-level System Model (ISSM), managed by ACCESS-NRI
|
|
5
|
+
Author: ACCESS-NRI
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/ACCESS-NRI/pyISSM
|
|
8
|
+
Project-URL: Repository, https://github.com/ACCESS-NRI/pyISSM
|
|
9
|
+
Project-URL: Issues, https://github.com/ACCESS-NRI/pyISSM/issues
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: xarray
|
|
18
|
+
Requires-Dist: numpy
|
|
19
|
+
Requires-Dist: scipy
|
|
20
|
+
Requires-Dist: netCDF4
|
|
21
|
+
Requires-Dist: pandas
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: attrs
|
|
24
|
+
Requires-Dist: PyYAML
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# pyISSM - ISSM Python API
|
|
28
|
+
|
|
29
|
+
Python API containing collection of data processing, analysis and visualisation functionality to support the open source **Ice-sheet and Sea-level System Model (ISSM)** [[website](https://issm.jpl.nasa.gov/)] [[github](https://github.com/ISSMteam/ISSM)] and its application within the ACCESS suite of Earth system models.
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
© 2022 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details.
|
|
33
|
+
SPDX-License-Identifier: Apache-2.0
|
|
34
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# pyISSM - ISSM Python API
|
|
2
|
+
|
|
3
|
+
Python API containing collection of data processing, analysis and visualisation functionality to support the open source **Ice-sheet and Sea-level System Model (ISSM)** [[website](https://issm.jpl.nasa.gov/)] [[github](https://github.com/ISSMteam/ISSM)] and its application within the ACCESS suite of Earth system models.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
© 2022 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details.
|
|
7
|
+
SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyissm"
|
|
7
|
+
version = "0.0.1.dev1"
|
|
8
|
+
description = "Python API for the Ice-sheet and Sea-level System Model (ISSM), managed by ACCESS-NRI"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "ACCESS-NRI" },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
dependencies = [
|
|
25
|
+
"xarray",
|
|
26
|
+
"numpy",
|
|
27
|
+
"scipy",
|
|
28
|
+
"netCDF4",
|
|
29
|
+
"pandas",
|
|
30
|
+
"matplotlib",
|
|
31
|
+
"attrs",
|
|
32
|
+
"PyYAML"
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/ACCESS-NRI/pyISSM"
|
|
37
|
+
Repository = "https://github.com/ACCESS-NRI/pyISSM"
|
|
38
|
+
Issues = "https://github.com/ACCESS-NRI/pyISSM/issues"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import analysis, data, learn, plot, model, tools
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import ismip
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ISMIP-related functions for ISSM
|
|
3
|
+
|
|
4
|
+
This module contains functions for handling ISMIP-related data and operations.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pyissm import tools
|
|
8
|
+
|
|
9
|
+
def calc_perc_ice_cover(total_ice_area, ice_area):
|
|
10
|
+
"""
|
|
11
|
+
Calculate the percentage ice cover, relative to the of total ice area.
|
|
12
|
+
|
|
13
|
+
This function computes the fraction of the ice area that is grounded (i.e.,
|
|
14
|
+
not floating). The result is returned as a percentage.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
total_ice_area : ndarray
|
|
19
|
+
Array representing the total ice area.
|
|
20
|
+
|
|
21
|
+
ice_area : ndarray
|
|
22
|
+
Array representing the ice area for percentage coverage to be computed.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
ice_area_perc : ndarray
|
|
27
|
+
Array with the same shape as `ice_area`, where each
|
|
28
|
+
element represents the percentage of the total_ice_area that is covered by the ice_area.
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
## Calculate ice area fraction
|
|
33
|
+
ice_area_perc = (ice_area / total_ice_area) * 100
|
|
34
|
+
|
|
35
|
+
return ice_area_perc
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def get_ismip_variable(md, ismip_variable_name):
|
|
39
|
+
"""
|
|
40
|
+
Retrieve a specific ISMIP variable from a model object.
|
|
41
|
+
|
|
42
|
+
This function extracts and calculates a requested ISMIP (Ice Sheet Model Intercomparison Project)
|
|
43
|
+
variable from a given model object, if the necessary data is available. It supports area-based
|
|
44
|
+
variables calculated from grounded and floating ice components stored in the model's
|
|
45
|
+
transient solution.
|
|
46
|
+
|
|
47
|
+
Parameters
|
|
48
|
+
----------
|
|
49
|
+
md : object
|
|
50
|
+
The model object containing transient solution results, typically with
|
|
51
|
+
attributes like `md.results.TransientSolution.GroundedArea` and `FloatingArea`.
|
|
52
|
+
|
|
53
|
+
ismip_variable_name : str
|
|
54
|
+
Name of the ISMIP variable to compute. Must be one of:
|
|
55
|
+
- 'land_ice_area_fraction' (assumes all ice in ISSM is land ice and returns 100 %)
|
|
56
|
+
- 'floating_ice_shelf_area_fraction'
|
|
57
|
+
- 'grounded_ice_sheet_area_fraction'
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
variable : array-like or None
|
|
62
|
+
The computed variable as a percentage, or `None` if the required data is
|
|
63
|
+
not available in the model object.
|
|
64
|
+
|
|
65
|
+
Raises
|
|
66
|
+
------
|
|
67
|
+
None explicitly, but prints a warning if the requested variable cannot be computed.
|
|
68
|
+
|
|
69
|
+
Notes
|
|
70
|
+
-----
|
|
71
|
+
- 'land_ice_area_fraction' assumes all ice is land ice (returns 100% where data is available).
|
|
72
|
+
- 'floating_ice_shelf_area_fraction' computes the fraction of total ice that is floating.
|
|
73
|
+
- 'grounded_ice_sheet_area_fraction' computes the fraction of total ice that is grounded.
|
|
74
|
+
- Missing required attributes in `md` will result in the variable being skipped.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
variable = None
|
|
78
|
+
|
|
79
|
+
if ismip_variable_name == 'land_ice_area_fraction':
|
|
80
|
+
if tools.general.has_nested_attr(md, 'results', 'TransientSolution', 'GroundedArea') and tools.general.has_nested_attr(md, 'results', 'TransientSolution', 'FloatingArea'):
|
|
81
|
+
total_area = md.results.TransientSolution.GroundedArea + md.results.TransientSolution.FloatingArea
|
|
82
|
+
variable = calc_perc_ice_cover(total_area, total_area)
|
|
83
|
+
else:
|
|
84
|
+
print("\033[1mland_ice_area_fraction\033[0m cannot be computed and will be skipped.")
|
|
85
|
+
|
|
86
|
+
elif ismip_variable_name == 'floating_ice_shelf_area_fraction':
|
|
87
|
+
if tools.general.has_nested_attr(md, 'results', 'TransientSolution', 'FloatingArea'):
|
|
88
|
+
total_area = md.results.TransientSolution.GroundedArea + md.results.TransientSolution.FloatingArea
|
|
89
|
+
variable = calc_perc_ice_cover(total_area, md.results.TransientSolution.FloatingArea)
|
|
90
|
+
else:
|
|
91
|
+
print("\033[1mfloating_ice_shelf_area_fraction\033[0m cannot be computed and will be skipped.")
|
|
92
|
+
|
|
93
|
+
elif ismip_variable_name == 'grounded_ice_sheet_area_fraction':
|
|
94
|
+
if tools.general.has_nested_attr(md, 'results', 'TransientSolution', 'GroundedArea'):
|
|
95
|
+
total_area = md.results.TransientSolution.GroundedArea + md.results.TransientSolution.FloatingArea
|
|
96
|
+
variable = calc_perc_ice_cover(total_area, md.results.TransientSolution.GroundedArea)
|
|
97
|
+
else:
|
|
98
|
+
print("\033[1mgrounded_ice_sheet_area_fraction\033[0m cannot be computed and will be skipped.")
|
|
99
|
+
|
|
100
|
+
else:
|
|
101
|
+
print(f"\033[1m{ismip_variable_name}\033[0m is not recognized and will be skipped.")
|
|
102
|
+
|
|
103
|
+
return variable
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import interp
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tools to interpolate data to/from ISSM model mesh.
|
|
3
|
+
|
|
4
|
+
This module contains various interpolation functions that can be used in conjunction with ISSM models.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import xarray as xr
|
|
8
|
+
import numpy as np
|
|
9
|
+
from scipy.interpolate import RegularGridInterpolator, griddata
|
|
10
|
+
from pyissm import tools
|
|
11
|
+
|
|
12
|
+
def xr_to_mesh(data,
|
|
13
|
+
var_name,
|
|
14
|
+
mesh_x,
|
|
15
|
+
mesh_y,
|
|
16
|
+
x_var = 'x',
|
|
17
|
+
y_var = 'y',
|
|
18
|
+
default_value = np.nan,
|
|
19
|
+
interpolation_type = 'bilinear',
|
|
20
|
+
issm_wrapper = True):
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
Interpolate a variable from an xarray dataset onto mesh nodes.
|
|
24
|
+
|
|
25
|
+
Assumes rectilinear (structured) grid in the xarray dataset.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
data : str or xr.Dataset
|
|
30
|
+
Path to a netCDF file or an xarray Dataset containing the gridded data.
|
|
31
|
+
var_name : str
|
|
32
|
+
Name of the variable to interpolate.
|
|
33
|
+
mesh_x : ndarray
|
|
34
|
+
X-coordinates of mesh nodes.
|
|
35
|
+
mesh_y : ndarray
|
|
36
|
+
Y-coordinates of mesh nodes.
|
|
37
|
+
x_var : str, optional
|
|
38
|
+
Name of the x-coordinate variable in the dataset. Default is 'x'.
|
|
39
|
+
y_var : str, optional
|
|
40
|
+
Name of the y-coordinate variable in the dataset. Default is 'y'.
|
|
41
|
+
default_value : float, optional
|
|
42
|
+
Value to assign to points outside the grid domain. Default is np.nan.
|
|
43
|
+
interpolation_type : str, optional
|
|
44
|
+
Type of interpolation method. For ISSM wrapper: 'bilinear', 'nearest', etc.
|
|
45
|
+
For scipy: 'linear', 'nearest', 'slinear', 'cubic', 'quintic', 'pchip'.
|
|
46
|
+
Default is 'bilinear'.
|
|
47
|
+
issm_wrapper : bool, optional
|
|
48
|
+
If True, use ISSM wrapper functions for interpolation. If False, use scipy.
|
|
49
|
+
Default is True.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
ndarray
|
|
54
|
+
Interpolated variable values at mesh nodes.
|
|
55
|
+
|
|
56
|
+
Raises
|
|
57
|
+
------
|
|
58
|
+
TypeError
|
|
59
|
+
If data is neither a file path nor an xarray Dataset.
|
|
60
|
+
ValueError
|
|
61
|
+
If variable is not 2D, coordinates are inconsistent, or grid is not rectilinear.
|
|
62
|
+
ImportError
|
|
63
|
+
If issm_wrapper is True but ISSM wrappers are not installed.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
# Load xarray dataset if a filepath was given
|
|
67
|
+
if isinstance(data, str):
|
|
68
|
+
data = xr.open_dataset(data)
|
|
69
|
+
close = True
|
|
70
|
+
elif isinstance(data, xr.Dataset):
|
|
71
|
+
close = False
|
|
72
|
+
else:
|
|
73
|
+
raise TypeError("pyissm.data.interp.xr_to_mesh: data must be a file path or an xarray Dataset")
|
|
74
|
+
|
|
75
|
+
# Extract and squeeze arrays
|
|
76
|
+
x = np.asarray(data[x_var].values).squeeze()
|
|
77
|
+
y = np.asarray(data[y_var].values).squeeze()
|
|
78
|
+
var_data = np.asarray(data[var_name].values).squeeze()
|
|
79
|
+
|
|
80
|
+
if close:
|
|
81
|
+
data.close()
|
|
82
|
+
|
|
83
|
+
# Convert everything to float64 (but keep shapes)
|
|
84
|
+
x = x.astype(np.float64, copy = False)
|
|
85
|
+
y = y.astype(np.float64, copy = False)
|
|
86
|
+
var_data = var_data.astype(np.float64, copy = False)
|
|
87
|
+
mesh_x = mesh_x.astype(np.float64, copy = False)
|
|
88
|
+
mesh_y = mesh_y.astype(np.float64, copy = False)
|
|
89
|
+
|
|
90
|
+
# Check for rectilinear grid
|
|
91
|
+
if var_data.ndim != 2:
|
|
92
|
+
raise ValueError(f"pyissm.data.interp.xr_to_mesh: variable '{var_name}' must be 2D on a rectilinear grid")
|
|
93
|
+
|
|
94
|
+
# If coordinates are 1D arrays, check shapes
|
|
95
|
+
if x.ndim == 1 and y.ndim == 1:
|
|
96
|
+
if var_data.shape != (y.size, x.size):
|
|
97
|
+
raise ValueError(f"pyissm.data.interp.xr_to_mesh: variable '{var_name}' has shape {var_data.shape}, "
|
|
98
|
+
f"expected ({y.size}, {x.size})")
|
|
99
|
+
|
|
100
|
+
# If coordinates are 2D arrays, check shapes and rectilinearity
|
|
101
|
+
# If 2D, they should be repeated 1D arrays
|
|
102
|
+
elif x.ndim == 2 and y.ndim == 2:
|
|
103
|
+
if x.shape != var_data.shape or y.shape != var_data.shape:
|
|
104
|
+
raise ValueError("pyissm.data.interp.xr_to_mesh: x, y, and variable must have identical shapes "
|
|
105
|
+
"for 2D coordinate grids")
|
|
106
|
+
|
|
107
|
+
# Check rectilinearity
|
|
108
|
+
if not np.allclose(x, x[0, :][None, :]):
|
|
109
|
+
raise ValueError("pyissm.data.interp.xr_to_mesh: 2D x-coordinate is not rectilinear")
|
|
110
|
+
|
|
111
|
+
if not np.allclose(y, y[:, 0][:, None]):
|
|
112
|
+
raise ValueError("pyissm.data.interp.xr_to_mesh: 2D y-coordinate is not rectilinear")
|
|
113
|
+
|
|
114
|
+
# Reduce to 1D
|
|
115
|
+
x = x[0, :]
|
|
116
|
+
y = y[:, 0]
|
|
117
|
+
|
|
118
|
+
else:
|
|
119
|
+
raise ValueError(
|
|
120
|
+
"pyissm.data.interp.xr_to_mesh: x and y must both be 1D or both be 2D"
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# Ensure monotonic increasing coordinates
|
|
125
|
+
if np.any(np.diff(x) < 0):
|
|
126
|
+
x = x[::-1]
|
|
127
|
+
var_data = var_data[:, ::-1]
|
|
128
|
+
|
|
129
|
+
if np.any(np.diff(y) < 0):
|
|
130
|
+
y = y[::-1]
|
|
131
|
+
var_data = var_data[::-1, :]
|
|
132
|
+
|
|
133
|
+
# If use_wrapper is True, use ISSM wrappers for interpolation
|
|
134
|
+
if issm_wrapper:
|
|
135
|
+
|
|
136
|
+
# Check that wrappers are installed
|
|
137
|
+
if not tools.wrappers.check_wrappers_installed():
|
|
138
|
+
raise ImportError("pyissm.data.interp.xr_to_mesh: ISSM wrappers are not installed. Please install them or set issm_wrapper = False to use scipy interpolation.")
|
|
139
|
+
|
|
140
|
+
# Interpolate using ISSM wrapper
|
|
141
|
+
var_on_mesh = tools.wrappers.InterpFromGridToMesh(
|
|
142
|
+
x,
|
|
143
|
+
y,
|
|
144
|
+
var_data,
|
|
145
|
+
mesh_x,
|
|
146
|
+
mesh_y,
|
|
147
|
+
default_value,
|
|
148
|
+
interpolation_type
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# Otherwise, use scipy for interpolation
|
|
152
|
+
else:
|
|
153
|
+
|
|
154
|
+
scipy_method_list = ['linear', 'nearest', 'slinear', 'cubic', 'quintic', 'pchip']
|
|
155
|
+
if interpolation_type not in scipy_method_list:
|
|
156
|
+
raise ValueError(f"pyissm.data.interp.xr_to_mesh: interpolation_type '{interpolation_type}' is not supported by scipy. Choose from {scipy_method_list}.")
|
|
157
|
+
|
|
158
|
+
interp = RegularGridInterpolator(
|
|
159
|
+
(y, x),
|
|
160
|
+
var_data,
|
|
161
|
+
method = interpolation_type,
|
|
162
|
+
bounds_error = False,
|
|
163
|
+
fill_value = default_value,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
# scipy expects points as (y, x)
|
|
167
|
+
mesh_points = np.column_stack((mesh_y, mesh_x))
|
|
168
|
+
|
|
169
|
+
# Extract variable on mesh
|
|
170
|
+
var_on_mesh = interp(mesh_points)
|
|
171
|
+
|
|
172
|
+
return var_on_mesh
|
|
173
|
+
|
|
174
|
+
def points_to_mesh(data_x,
|
|
175
|
+
data_y,
|
|
176
|
+
data_values,
|
|
177
|
+
mesh_x,
|
|
178
|
+
mesh_y,
|
|
179
|
+
default_value = np.nan,
|
|
180
|
+
interpolation_type = 'linear'):
|
|
181
|
+
"""
|
|
182
|
+
Interpolate scattered points onto mesh node coordinates using scipy.
|
|
183
|
+
|
|
184
|
+
Parameters
|
|
185
|
+
----------
|
|
186
|
+
data_x : array_like
|
|
187
|
+
X-coordinates of the scattered data points. Can be 1D or 2D; if 2D it will be flattened.
|
|
188
|
+
data_y : array_like
|
|
189
|
+
Y-coordinates of the scattered data points. Must have the same shape as `data_x`.
|
|
190
|
+
data_values : array_like
|
|
191
|
+
Values at the scattered data points. Must have the same shape as `data_x`.
|
|
192
|
+
mesh_x : array_like
|
|
193
|
+
X-coordinates of mesh nodes. 1D array.
|
|
194
|
+
mesh_y : array_like
|
|
195
|
+
Y-coordinates of mesh nodes. 1D array.
|
|
196
|
+
default_value : float, optional
|
|
197
|
+
Value used to fill points outside the convex hull of the input data. Default is `np.nan`.
|
|
198
|
+
interpolation_type : str, optional
|
|
199
|
+
Interpolation method passed to `scipy.interpolate.griddata`. Supported options: 'linear', 'nearest', 'cubic'.
|
|
200
|
+
Default is 'linear'.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
ndarray
|
|
205
|
+
1D array of interpolated values at the mesh nodes (shape equals `mesh_x`/`mesh_y`).
|
|
206
|
+
Points outside the convex hull of the input data are assigned `default_value`.
|
|
207
|
+
|
|
208
|
+
Raises
|
|
209
|
+
------
|
|
210
|
+
ValueError
|
|
211
|
+
If `interpolation_type` is not supported by scipy, if input shapes are inconsistent, or if no valid
|
|
212
|
+
data points remain after removing NaNs/Infs.
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
# Check interpolation type
|
|
216
|
+
scipy_method_list = ['linear', 'nearest', 'cubic']
|
|
217
|
+
if interpolation_type not in scipy_method_list:
|
|
218
|
+
raise ValueError(f"pyissm.data.interp.points_to_mesh: interpolation_type '{interpolation_type}' is not supported by scipy. Choose from {scipy_method_list}.")
|
|
219
|
+
|
|
220
|
+
# Validate input shapes
|
|
221
|
+
if data_x.shape != data_y.shape or data_x.shape != data_values.shape:
|
|
222
|
+
raise ValueError("pyissm.data.interp.points_to_mesh: data_x, data_y, and data_values must have the same shape.")
|
|
223
|
+
|
|
224
|
+
# Flatten if needed:
|
|
225
|
+
if data_values.ndim == 2:
|
|
226
|
+
data_x = data_x.flatten()
|
|
227
|
+
data_y = data_y.flatten()
|
|
228
|
+
data_values = data_values.flatten()
|
|
229
|
+
elif data_values.ndim == 1:
|
|
230
|
+
pass
|
|
231
|
+
else:
|
|
232
|
+
raise ValueError("pyissm.data.interp.points_to_mesh: data_values must be 1D or 2D array.")
|
|
233
|
+
|
|
234
|
+
# Remove NaNs/Inf from input data
|
|
235
|
+
mask = np.isfinite(data_x) & np.isfinite(data_y) & np.isfinite(data_values)
|
|
236
|
+
|
|
237
|
+
if not np.any(mask):
|
|
238
|
+
raise ValueError("pyissm.data.interp.points_to_mesh: no valid data points available for interpolation")
|
|
239
|
+
|
|
240
|
+
data_x = data_x[mask]
|
|
241
|
+
data_y = data_y[mask]
|
|
242
|
+
data_values = data_values[mask]
|
|
243
|
+
|
|
244
|
+
# Prepare points for interpolation
|
|
245
|
+
data_points = np.column_stack((data_y, data_x))
|
|
246
|
+
interp_points = np.column_stack((mesh_y, mesh_x))
|
|
247
|
+
|
|
248
|
+
# Perform interpolation
|
|
249
|
+
data_on_mesh = griddata(data_points,
|
|
250
|
+
data_values,
|
|
251
|
+
interp_points,
|
|
252
|
+
method = interpolation_type,
|
|
253
|
+
fill_value = default_value)
|
|
254
|
+
|
|
255
|
+
return data_on_mesh
|
|
256
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from . import tutorials
|