anta-database 0.1.2__tar.gz → 0.1.4__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.
Files changed (37) hide show
  1. anta_database-0.1.4/.github/workflows/deploy.yml +43 -0
  2. anta_database-0.1.4/.github/workflows/release.yml +59 -0
  3. anta_database-0.1.4/.gitignore +8 -0
  4. anta_database-0.1.4/PKG-INFO +89 -0
  5. anta_database-0.1.4/README.md +65 -0
  6. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/compiling/compile.py +13 -6
  7. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/database/database.py +115 -66
  8. anta_database-0.1.4/anta_database/figures/AntA_38ka.png +0 -0
  9. anta_database-0.1.4/anta_database.egg-info/PKG-INFO +89 -0
  10. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database.egg-info/SOURCES.txt +17 -2
  11. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database.egg-info/top_level.txt +1 -0
  12. anta_database-0.1.4/book/_config.yml +32 -0
  13. anta_database-0.1.4/book/_toc.yml +8 -0
  14. anta_database-0.1.4/book/advanced.md +66 -0
  15. anta_database-0.1.4/book/figures/AntA_38ka.png +0 -0
  16. anta_database-0.1.4/book/figures/all_data.png +0 -0
  17. anta_database-0.1.4/book/intro.md +38 -0
  18. anta_database-0.1.4/book/logo.png +0 -0
  19. anta_database-0.1.4/book/quick_start.ipynb +366 -0
  20. anta_database-0.1.4/book/references.bib +3 -0
  21. anta_database-0.1.4/book/requirements.txt +2 -0
  22. anta_database-0.1.4/pyproject.toml +46 -0
  23. anta_database-0.1.2/PKG-INFO +0 -20
  24. anta_database-0.1.2/anta_database.egg-info/PKG-INFO +0 -20
  25. anta_database-0.1.2/setup.py +0 -22
  26. {anta_database-0.1.2 → anta_database-0.1.4}/LICENSE +0 -0
  27. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/__init__.py +0 -0
  28. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/anta_database.py +0 -0
  29. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/compiling/__init__.py +0 -0
  30. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/database/__init__.py +0 -0
  31. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/database/plotting/GL.pkl +0 -0
  32. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/database/plotting/__init__.py +0 -0
  33. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/indexing/__init__.py +0 -0
  34. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database/indexing/index_database.py +0 -0
  35. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database.egg-info/dependency_links.txt +0 -0
  36. {anta_database-0.1.2 → anta_database-0.1.4}/anta_database.egg-info/requires.txt +0 -0
  37. {anta_database-0.1.2 → anta_database-0.1.4}/setup.cfg +0 -0
@@ -0,0 +1,43 @@
1
+ name: Deploy Jupyter Book to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'book/**' # Only trigger if changes are in the book/ folder
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ pages: write
16
+ id-token: write
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: '3.11'
24
+ cache: pip
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ pip install jupyter-book ghp-import
29
+
30
+ - name: Build Jupyter Book
31
+ run: |
32
+ jupyter-book build book/
33
+
34
+ # Upload the book's HTML as an artifact
35
+ - name: Upload artifact
36
+ uses: actions/upload-pages-artifact@v3
37
+ with:
38
+ path: "book/_build/html"
39
+
40
+ # Deploy the book's HTML to GitHub Pages
41
+ - name: Deploy to GitHub Pages
42
+ id: deployment
43
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,59 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "[0-9]+.[0-9]+.[0-9]+"
7
+ - "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
8
+ - "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
9
+ - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distribution 📦
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ persist-credentials: false
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.x"
24
+
25
+ - name: Install pypa/build
26
+ run: >-
27
+ python3 -m
28
+ pip install
29
+ build
30
+ --user
31
+ - name: Build a binary wheel and a source tarball
32
+ run: python3 -m build
33
+ - name: Store the distribution packages
34
+ uses: actions/upload-artifact@v4
35
+ with:
36
+ name: python-package-distributions
37
+ path: dist/
38
+
39
+ publish-to-pypi:
40
+ name: >-
41
+ Publish Python 🐍 distribution 📦 to PyPI
42
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
43
+ needs:
44
+ - build
45
+ runs-on: ubuntu-latest
46
+ environment:
47
+ name: pypi
48
+ url: https://pypi.org/p/anta-database
49
+ permissions:
50
+ id-token: write # IMPORTANT: mandatory for trusted publishing
51
+
52
+ steps:
53
+ - name: Download all the dists
54
+ uses: actions/download-artifact@v4
55
+ with:
56
+ name: python-package-distributions
57
+ path: dist/
58
+ - name: Publish distribution 📦 to PyPI
59
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,8 @@
1
+ *__pycache__/
2
+ /anta_database.egg-info/
3
+ *build/
4
+ *.pyc
5
+ venv/
6
+ .env
7
+ dist/
8
+ archives/
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: anta_database
3
+ Version: 0.1.4
4
+ Summary: SQLite database for the AntArchitecture Community Data
5
+ Author: Antoine Hermant
6
+ Author-email: antoine.hermant@etik.com
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://antoinehermant.github.io/anta_database/intro
9
+ Project-URL: Documentation, https://antoinehermant.github.io/anta_database/quick_start
10
+ Project-URL: Repository, https://github.com/antoinehermant/anta_database.git
11
+ Project-URL: Issues, https://github.com/antoinehermant/anta_database/issues
12
+ Keywords: isochrones,database,IRH,radar
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Programming Language :: Python
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: pandas
20
+ Requires-Dist: pyproj
21
+ Requires-Dist: matplotlib
22
+ Requires-Dist: colormaps
23
+ Dynamic: license-file
24
+
25
+ <h1 align="center">
26
+ <img src="https://raw.githubusercontent.com/antoinehermant/anta_database/main/book/logo.png" width="200">
27
+ </h1><br>
28
+
29
+ [![PyPi](https://img.shields.io/pypi/v/anta_database)](https://pypi.org/project/anta_database/)
30
+ [![Downloads](https://img.shields.io/pypi/dm/anta_database)](https://pypi.org/project/anta_database)
31
+
32
+ [![GitHub issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/antoinehermant/anta_database/issues)
33
+ <!-- [![Contributing](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://matplotlib.org/stable/devel/index.html) -->
34
+
35
+ AntADatabase is an efficient SQLite database for browsing, visualizing and processing Internal Reflecting Horizons (isochrones) across Antarctica, curated by the AntArchitecture action group. It is specifically designed for ice dynamic modelers who need a fast, memory-efficient data structure to constrain their models.
36
+
37
+ Visit the [Home Page](https://antoinehermant.github.io/anta_database/intro) for more information.
38
+
39
+ # SQLite Database
40
+
41
+ The database uses SQLite for efficient indexing. Data is sourced from the associated DOIs and stored as binary DataFrame files for each layer (IRH) and trace ID. This structure enables:
42
+
43
+ - Browsing by author (region), layer age, or trace ID.
44
+ - Memory efficiency: Only relevant data is read when needed.
45
+ - Fast read performance: Lightweight and optimized for speed.
46
+
47
+ # Key Features
48
+
49
+ - Efficient SQLite indexing
50
+ - Quick visualization on Antarctica map
51
+ - Generate lazy data for later use
52
+
53
+ # Installation
54
+
55
+ The Python module can be directly installed from [PyPI](https://pypi.org/project/anta-database/) with:
56
+
57
+ pip install anta_database
58
+
59
+ Note that this module is new and under development, so that the [PyPI](https://pypi.org/project/anta-database/) package may not contain the latest features. For the latest version and development, see the instruction below.
60
+ To get started with the anta_database module, see the [Documentation](https://antoinehermant.github.io/anta_database).
61
+ Also, you need the actual data to use this module. It is currently not available on any public repository, so please contact me.
62
+
63
+ ## Advanced installation
64
+
65
+ One can install the latest commit from this GitHub directory with:
66
+
67
+ pip install git+https://github.com/antoinehermant/anta_database.git
68
+
69
+ Or for development, you should clone this repo and install the module in development mode:
70
+
71
+ git clone git@github:antoinehermant/anta_database.git
72
+ pip install -e anta_database/
73
+
74
+ # Support and contact
75
+
76
+ You can email me for downloading the database: antoine.hermant@unibe.ch
77
+
78
+ Feel free to raise an issue on the GitHub if you find any bug or if you would like a feature added.
79
+
80
+ # Contribution
81
+
82
+ If you like this database and wish to help me develop this module, do not hesitate to contact me. You should then fork the repo, build feature branches and pull request. That would be much appreciated!
83
+
84
+ # Acknowledgments
85
+
86
+ I am developing this tool as part of my PhD project, which is funded by the Swiss National Science Foundation (grant no. 211542, Project CHARIBDIS)
87
+ Any data used through this database should be cited at source. For this, use the DOI provided in the metadata.
88
+ If you used this tool for your work and this was useful, please cite this repo, so other people get to know that it exists.
89
+
@@ -0,0 +1,65 @@
1
+ <h1 align="center">
2
+ <img src="https://raw.githubusercontent.com/antoinehermant/anta_database/main/book/logo.png" width="200">
3
+ </h1><br>
4
+
5
+ [![PyPi](https://img.shields.io/pypi/v/anta_database)](https://pypi.org/project/anta_database/)
6
+ [![Downloads](https://img.shields.io/pypi/dm/anta_database)](https://pypi.org/project/anta_database)
7
+
8
+ [![GitHub issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/antoinehermant/anta_database/issues)
9
+ <!-- [![Contributing](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://matplotlib.org/stable/devel/index.html) -->
10
+
11
+ AntADatabase is an efficient SQLite database for browsing, visualizing and processing Internal Reflecting Horizons (isochrones) across Antarctica, curated by the AntArchitecture action group. It is specifically designed for ice dynamic modelers who need a fast, memory-efficient data structure to constrain their models.
12
+
13
+ Visit the [Home Page](https://antoinehermant.github.io/anta_database/intro) for more information.
14
+
15
+ # SQLite Database
16
+
17
+ The database uses SQLite for efficient indexing. Data is sourced from the associated DOIs and stored as binary DataFrame files for each layer (IRH) and trace ID. This structure enables:
18
+
19
+ - Browsing by author (region), layer age, or trace ID.
20
+ - Memory efficiency: Only relevant data is read when needed.
21
+ - Fast read performance: Lightweight and optimized for speed.
22
+
23
+ # Key Features
24
+
25
+ - Efficient SQLite indexing
26
+ - Quick visualization on Antarctica map
27
+ - Generate lazy data for later use
28
+
29
+ # Installation
30
+
31
+ The Python module can be directly installed from [PyPI](https://pypi.org/project/anta-database/) with:
32
+
33
+ pip install anta_database
34
+
35
+ Note that this module is new and under development, so that the [PyPI](https://pypi.org/project/anta-database/) package may not contain the latest features. For the latest version and development, see the instruction below.
36
+ To get started with the anta_database module, see the [Documentation](https://antoinehermant.github.io/anta_database).
37
+ Also, you need the actual data to use this module. It is currently not available on any public repository, so please contact me.
38
+
39
+ ## Advanced installation
40
+
41
+ One can install the latest commit from this GitHub directory with:
42
+
43
+ pip install git+https://github.com/antoinehermant/anta_database.git
44
+
45
+ Or for development, you should clone this repo and install the module in development mode:
46
+
47
+ git clone git@github:antoinehermant/anta_database.git
48
+ pip install -e anta_database/
49
+
50
+ # Support and contact
51
+
52
+ You can email me for downloading the database: antoine.hermant@unibe.ch
53
+
54
+ Feel free to raise an issue on the GitHub if you find any bug or if you would like a feature added.
55
+
56
+ # Contribution
57
+
58
+ If you like this database and wish to help me develop this module, do not hesitate to contact me. You should then fork the repo, build feature branches and pull request. That would be much appreciated!
59
+
60
+ # Acknowledgments
61
+
62
+ I am developing this tool as part of my PhD project, which is funded by the Swiss National Science Foundation (grant no. 211542, Project CHARIBDIS)
63
+ Any data used through this database should be cited at source. For this, use the DOI provided in the metadata.
64
+ If you used this tool for your work and this was useful, please cite this repo, so other people get to know that it exists.
65
+
@@ -49,8 +49,8 @@ class CompileDatabase:
49
49
  elif ext == '.csv':
50
50
  sep=','
51
51
  else:
52
- print('File type not supported, exiting ...')
53
- sys.exit()
52
+ print(f"{ext}: File type not supported...")
53
+ return
54
54
 
55
55
  for i, file in enumerate(raw_files):
56
56
  print('Processing', file, f'({i}/{len(raw_files)})')
@@ -96,8 +96,8 @@ class CompileDatabase:
96
96
  elif 'lon' in ds.columns and 'lat' in ds.columns and 'x' in ds.columns and 'y' in ds.columns:
97
97
  pass
98
98
  else:
99
- print('No coordinates found in the dataset, exiting ....')
100
- sys.exit()
99
+ print('No coordinates found in the dataset')
100
+ return
101
101
 
102
102
  if self.file_type == 'layer':
103
103
  age = str(ages[file_name_])
@@ -121,7 +121,11 @@ class CompileDatabase:
121
121
  cumulative_distance = np.concatenate([[0], np.cumsum(distances)])
122
122
  ds_trace['distance'] = cumulative_distance
123
123
 
124
- ds_trace_file = f'{dir_path}/pkl/{trace_id}/{file_name_}.pkl'
124
+ if age in ['IceThk', 'BedElev', 'SurfElev']:
125
+ ds_trace_file = f'{dir_path}/pkl/{trace_id}/{age}.pkl' # if var instead of age, call the file as var.pkl
126
+ else:
127
+ ds_trace_file = f'{dir_path}/pkl/{trace_id}/{file_name_}.pkl' # else use the same file name.pkl
128
+
125
129
  os.makedirs(f'{dir_path}/pkl/{trace_id}' , exist_ok=True)
126
130
  ds_trace.to_pickle(ds_trace_file)
127
131
  print(ds_trace_file)
@@ -186,7 +190,10 @@ class CompileDatabase:
186
190
  if var in ds.columns:
187
191
  ds_IRH[var] = ds[var]
188
192
 
189
- ds_trace_file = f'{dir_path}/pkl/{trace_id}/{IRH}.pkl'
193
+ if age in ['IceThk', 'BedElev', 'SurfElev']:
194
+ ds_trace_file = f'{dir_path}/pkl/{trace_id}/{age}.pkl' # if var instead of age, call the file as var.pkl
195
+ else:
196
+ ds_trace_file = f'{dir_path}/pkl/{trace_id}/{IRH}.pkl' # else use IRH.pkl
190
197
 
191
198
  ds_IRH.to_pickle(ds_trace_file)
192
199
  print(ds_trace_file)
@@ -5,6 +5,7 @@ import numpy as np
5
5
  import matplotlib.pyplot as plt
6
6
  from matplotlib.colors import LinearSegmentedColormap
7
7
  import colormaps as cmaps
8
+ from contextlib import contextmanager
8
9
  from typing import Union, List, Dict, Tuple
9
10
 
10
11
  class Database:
@@ -93,41 +94,6 @@ class Database:
93
94
  }
94
95
  return metadata
95
96
 
96
- def __repr__(self):
97
- """Return a pretty-printed string representation of the metadata."""
98
- md = self.md
99
- output = []
100
- output.append("Metadata from query:")
101
-
102
- output.append("\n - author:")
103
- for author in md['author']:
104
- output.append(f" {author}")
105
-
106
- output.append("\n - age:")
107
- ages = " ".join(md['age'])
108
- output.append(f" {ages}")
109
-
110
- output.append("\n - var:")
111
- for var in md['var']:
112
- output.append(f" {var}")
113
-
114
- output.append("\n - trace_id:")
115
- trace_ids = " ".join(md['trace_id'])
116
- output.append(f" {trace_ids}")
117
-
118
- output.append("\n - reference:")
119
- for ref in md['reference']:
120
- output.append(f" {ref}")
121
-
122
- output.append("\n - DOIs:")
123
- for doi in md['doi']:
124
- output.append(f" {doi}")
125
-
126
- output.append(f"\n - database: {md['database_path']}/{md['file_db']}")
127
- output.append(f" - query params: {md['_query_params']}")
128
-
129
- return "\n".join(output)
130
-
131
97
  def query(self, age: Union[None, str, List[str]]=None, var: Union[None, str, List[str]]=None,author: Union[None, str, List[str]]=None, trace_id: Union[None, str, List[str]]=None) -> 'MetadataResult':
132
98
  select_clause = 'a.name, a.citation, a.doi, d.age, d.var, d.trace_id'
133
99
  query, params = self._build_query_and_params(age, var, author, trace_id, select_clause)
@@ -189,7 +155,7 @@ class Database:
189
155
 
190
156
  return file_paths
191
157
 
192
- def data_generator(self, metadata: Union[None, Dict] = None, data_dir: Union[None, str] = None, downscale_factor: Union[None, int] = None, downsample_distance: Union[None, float, int] = None):
158
+ def data_generator(self, metadata: Union[None, Dict, 'MetadataResult'] = None, data_dir: Union[None, str] = None, downscale_factor: Union[None, int] = None, downsample_distance: Union[None, float, int] = None):
193
159
  """
194
160
  Generates DataFrames and their associated author names from the database based on the provided metadata.
195
161
 
@@ -205,7 +171,7 @@ class Database:
205
171
  md = self.md
206
172
  else:
207
173
  print('Please provide metadata of the files you want to generate the data from. Exiting ...')
208
- sys.exit()
174
+ return
209
175
 
210
176
  query_params = md['_query_params']
211
177
  age = query_params.get('age')
@@ -227,8 +193,8 @@ class Database:
227
193
  elif self.db_dir:
228
194
  data_dir = self.db_dir
229
195
  else:
230
- print('No data dir provided, do not know where to look for data, exiting ...')
231
- sys.exit()
196
+ print('No data dir provided, do not know where to look for data ...')
197
+ return
232
198
 
233
199
  for file_path, age in results:
234
200
  df = pd.read_pickle(os.path.join(data_dir, file_path))
@@ -256,9 +222,31 @@ class Database:
256
222
  )
257
223
  return custom_cmap
258
224
 
225
+ def is_notebook(self) -> bool:
226
+ from IPython import get_ipython
227
+ try:
228
+ shell = get_ipython().__class__.__name__
229
+ if shell == 'ZMQInteractiveShell':
230
+ return True # Jupyter notebook or qtconsole
231
+ elif shell == 'TerminalInteractiveShell':
232
+ return False # Terminal running IPython
233
+ else:
234
+ return False # Other type (?)
235
+ except NameError:
236
+ return False # Probably standard Python interpreter
237
+
238
+ @contextmanager
239
+ def plot_context(self, close=None):
240
+ if close is None:
241
+ close = not self.is_notebook()
242
+ try:
243
+ yield
244
+ finally:
245
+ if close:
246
+ plt.close()
259
247
 
260
248
  def plotXY(self,
261
- metadata: Union[None, Dict] = None,
249
+ metadata: Union[None, Dict, 'MetadataResult'] = None,
262
250
  downscale_factor: Union[None, int] = None,
263
251
  title: str = '',
264
252
  xlim: tuple = (None, None),
@@ -267,13 +255,14 @@ class Database:
267
255
  latex:bool = False,
268
256
  save: Union[str, None] = None) -> None:
269
257
 
258
+
270
259
  if metadata:
271
260
  metadata = metadata
272
261
  elif self.md:
273
262
  metadata = self.md
274
263
  else:
275
- print('Please provide metadata of the files you want to generate the data from. Exiting ...')
276
- sys.exit()
264
+ print('Please provide metadata of the files you want to generate the data from...')
265
+ return
277
266
 
278
267
  cmaps = self.custom_cmap()
279
268
  authors = list(metadata['author'])
@@ -298,7 +287,7 @@ class Database:
298
287
  for author in authors:
299
288
  citation = self.query(author=author)['reference']
300
289
  plt.plot([], [], color=colors[author], label=citation)
301
- plt.legend(loc='lower left')
290
+ plt.legend(loc='lower left', fontsize=16*scale_factor)
302
291
 
303
292
  x_extent = x1 - x0
304
293
  y_extent = y1 - y0
@@ -314,13 +303,83 @@ class Database:
314
303
  # self.scale_axes(ax, factor=1000)
315
304
  plt.title(title, fontsize=30*scale_factor)
316
305
  plt.tight_layout()
317
- if save:
318
- plt.savefig(save, dpi=200)
319
- plt.close()
320
- print('Figure saved as', save)
306
+
307
+ with self.plot_context():
308
+
309
+ if save:
310
+ plt.savefig(save, dpi=200)
311
+ print('Figure saved as', save)
312
+ else:
313
+ plt.show()
314
+
315
+ def plotXYDepth(self,
316
+ metadata: Union[None, Dict, 'MetadataResult'] = None,
317
+ downscale_factor: Union[None, int] = None,
318
+ title: str = '',
319
+ xlim: tuple = (None, None),
320
+ ylim: tuple = (None, None),
321
+ scale_factor: float = 1.0,
322
+ latex:bool = False,
323
+ cmaps = cmaps.torch_r,
324
+ save: Union[str, None] = None) -> None:
325
+
326
+ if metadata:
327
+ metadata = metadata
328
+ elif self.md:
329
+ metadata = self.md
321
330
  else:
322
- plt.show()
323
- plt.close()
331
+ print('Please provide metadata of the files you want to generate the data from...')
332
+ return
333
+
334
+ if latex:
335
+ from matplotlib import rc
336
+ rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
337
+ rc('text', usetex=True)
338
+
339
+ fig, ax = plt.subplots(figsize=(10,6))
340
+ plt.plot(self.gl.x/1000, self.gl.y/1000, linewidth=1, color='k')
341
+ for df, md in self.data_generator(metadata, downscale_factor=downscale_factor):
342
+ if md['age']:
343
+ var = md['age']
344
+ label = f'{var} isochrone depth [m]'
345
+ elif md['var']:
346
+ var = md['var']
347
+ label = f'{var} [m]'
348
+ if 'var' in locals():
349
+ scatter = plt.scatter(df['x']/1000, df['y']/1000, c=df[var], cmap=cmaps, s=1)
350
+
351
+ x0, x1 = ax.get_xlim() if xlim == (None, None) else xlim
352
+ y0, y1 = ax.get_ylim() if ylim == (None, None) else ylim
353
+
354
+
355
+ x_extent = x1 - x0
356
+ y_extent = y1 - y0
357
+
358
+ aspect_ratio = y_extent / x_extent
359
+
360
+ # Set the figure size based on the aspect ratio and a scale factor
361
+ plt.gcf().set_size_inches(8 * scale_factor, 8 * aspect_ratio * scale_factor)
362
+ ax.set_xlabel('x [km]')
363
+ ax.set_ylabel('y [km]')
364
+ ax.set_xlim(*xlim)
365
+ ax.set_ylim(*ylim)
366
+ # self.scale_axes(ax, factor=1000)
367
+ plt.title(title, fontsize=30*scale_factor)
368
+
369
+ if 'scatter' in locals():
370
+ cbar = fig.colorbar(scatter, ax=ax, orientation='horizontal', pad=0.05, fraction=0.05)
371
+ cbar.ax.xaxis.set_ticks_position('bottom')
372
+ if 'label' in locals():
373
+ cbar.set_label(label)
374
+
375
+ plt.tight_layout()
376
+
377
+ with self.plot_context():
378
+ if save:
379
+ plt.savefig(save, dpi=200)
380
+ print('Figure saved as', save)
381
+ else:
382
+ plt.show()
324
383
 
325
384
  class MetadataResult:
326
385
  def __init__(self, metadata):
@@ -334,23 +393,13 @@ class MetadataResult:
334
393
  md = self._metadata
335
394
  output = []
336
395
  output.append("Metadata from query:")
337
- output.append(f"\n - author:")
338
- for author in md['author']:
339
- output.append(f" {author}")
340
- output.append(f"\n - age:")
341
- output.append(f" {' '.join(md['age'])}")
342
- output.append(f"\n - var:")
343
- for var in md['var']:
344
- output.append(f" {var}")
345
- output.append(f"\n - trace_id:")
346
- output.append(f" {' '.join(md['trace_id'])}")
347
- output.append(f"\n - reference:")
348
- for ref in md['reference']:
349
- output.append(f" {ref}")
350
- output.append(f"\n - DOIs:")
351
- for doi in md['doi']:
352
- output.append(f" {doi}")
353
- output.append(f"\n - database: {md['database_path']}/{md['file_db']}")
396
+ output.append(f"\n - author: {', '.join(md['author'])}")
397
+ output.append(f"\n - age: {', '.join(map(str, md['age']))}")
398
+ output.append(f"\n - var: {', '.join(md['var'])}")
399
+ output.append(f"\n - trace_id: {', '.join(md['trace_id'])}")
400
+ output.append(f"\n - reference: {', '.join(md['reference'])}")
401
+ output.append(f" - DOIs: {', '.join(md['doi'])}")
402
+ output.append(f" - database: {md['database_path']}/{md['file_db']}")
354
403
  output.append(f" - query params: {md['_query_params']}")
355
404
  return "\n".join(output)
356
405
 
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: anta_database
3
+ Version: 0.1.4
4
+ Summary: SQLite database for the AntArchitecture Community Data
5
+ Author: Antoine Hermant
6
+ Author-email: antoine.hermant@etik.com
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://antoinehermant.github.io/anta_database/intro
9
+ Project-URL: Documentation, https://antoinehermant.github.io/anta_database/quick_start
10
+ Project-URL: Repository, https://github.com/antoinehermant/anta_database.git
11
+ Project-URL: Issues, https://github.com/antoinehermant/anta_database/issues
12
+ Keywords: isochrones,database,IRH,radar
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Programming Language :: Python
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: pandas
20
+ Requires-Dist: pyproj
21
+ Requires-Dist: matplotlib
22
+ Requires-Dist: colormaps
23
+ Dynamic: license-file
24
+
25
+ <h1 align="center">
26
+ <img src="https://raw.githubusercontent.com/antoinehermant/anta_database/main/book/logo.png" width="200">
27
+ </h1><br>
28
+
29
+ [![PyPi](https://img.shields.io/pypi/v/anta_database)](https://pypi.org/project/anta_database/)
30
+ [![Downloads](https://img.shields.io/pypi/dm/anta_database)](https://pypi.org/project/anta_database)
31
+
32
+ [![GitHub issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/antoinehermant/anta_database/issues)
33
+ <!-- [![Contributing](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://matplotlib.org/stable/devel/index.html) -->
34
+
35
+ AntADatabase is an efficient SQLite database for browsing, visualizing and processing Internal Reflecting Horizons (isochrones) across Antarctica, curated by the AntArchitecture action group. It is specifically designed for ice dynamic modelers who need a fast, memory-efficient data structure to constrain their models.
36
+
37
+ Visit the [Home Page](https://antoinehermant.github.io/anta_database/intro) for more information.
38
+
39
+ # SQLite Database
40
+
41
+ The database uses SQLite for efficient indexing. Data is sourced from the associated DOIs and stored as binary DataFrame files for each layer (IRH) and trace ID. This structure enables:
42
+
43
+ - Browsing by author (region), layer age, or trace ID.
44
+ - Memory efficiency: Only relevant data is read when needed.
45
+ - Fast read performance: Lightweight and optimized for speed.
46
+
47
+ # Key Features
48
+
49
+ - Efficient SQLite indexing
50
+ - Quick visualization on Antarctica map
51
+ - Generate lazy data for later use
52
+
53
+ # Installation
54
+
55
+ The Python module can be directly installed from [PyPI](https://pypi.org/project/anta-database/) with:
56
+
57
+ pip install anta_database
58
+
59
+ Note that this module is new and under development, so that the [PyPI](https://pypi.org/project/anta-database/) package may not contain the latest features. For the latest version and development, see the instruction below.
60
+ To get started with the anta_database module, see the [Documentation](https://antoinehermant.github.io/anta_database).
61
+ Also, you need the actual data to use this module. It is currently not available on any public repository, so please contact me.
62
+
63
+ ## Advanced installation
64
+
65
+ One can install the latest commit from this GitHub directory with:
66
+
67
+ pip install git+https://github.com/antoinehermant/anta_database.git
68
+
69
+ Or for development, you should clone this repo and install the module in development mode:
70
+
71
+ git clone git@github:antoinehermant/anta_database.git
72
+ pip install -e anta_database/
73
+
74
+ # Support and contact
75
+
76
+ You can email me for downloading the database: antoine.hermant@unibe.ch
77
+
78
+ Feel free to raise an issue on the GitHub if you find any bug or if you would like a feature added.
79
+
80
+ # Contribution
81
+
82
+ If you like this database and wish to help me develop this module, do not hesitate to contact me. You should then fork the repo, build feature branches and pull request. That would be much appreciated!
83
+
84
+ # Acknowledgments
85
+
86
+ I am developing this tool as part of my PhD project, which is funded by the Swiss National Science Foundation (grant no. 211542, Project CHARIBDIS)
87
+ Any data used through this database should be cited at source. For this, use the DOI provided in the metadata.
88
+ If you used this tool for your work and this was useful, please cite this repo, so other people get to know that it exists.
89
+