anta-database 0.4.0__tar.gz → 0.4.2__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 (66) hide show
  1. {anta_database-0.4.0 → anta_database-0.4.2}/PKG-INFO +1 -1
  2. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/__init__.py +2 -0
  3. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/database/database.py +8 -0
  4. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/plotting/__init__.py +2 -1
  5. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/plotting/plotting.py +36 -31
  6. anta_database-0.4.2/anta_database/plotting/plotting_pism.py +859 -0
  7. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database.egg-info/PKG-INFO +1 -1
  8. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database.egg-info/SOURCES.txt +1 -0
  9. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database.egg-info/scm_file_list.json +1 -0
  10. anta_database-0.4.2/anta_database.egg-info/scm_version.json +8 -0
  11. {anta_database-0.4.0 → anta_database-0.4.2}/book/_toc.yml +6 -1
  12. anta_database-0.4.2/book/advanced.md +222 -0
  13. anta_database-0.4.2/book/contact.md +27 -0
  14. anta_database-0.4.2/book/contribute.md +39 -0
  15. anta_database-0.4.2/book/intro.md +83 -0
  16. anta_database-0.4.2/book/pism_example.ipynb +531 -0
  17. anta_database-0.4.2/book/quick_start.ipynb +761 -0
  18. anta_database-0.4.0/anta_database.egg-info/scm_version.json +0 -8
  19. anta_database-0.4.0/book/advanced.md +0 -154
  20. anta_database-0.4.0/book/contact.md +0 -9
  21. anta_database-0.4.0/book/contribute.md +0 -10
  22. anta_database-0.4.0/book/intro.md +0 -48
  23. anta_database-0.4.0/book/pism_example.ipynb +0 -302
  24. anta_database-0.4.0/book/quick_start.ipynb +0 -574
  25. {anta_database-0.4.0 → anta_database-0.4.2}/.github/workflows/deploy.yml +0 -0
  26. {anta_database-0.4.0 → anta_database-0.4.2}/.github/workflows/release.yml +0 -0
  27. {anta_database-0.4.0 → anta_database-0.4.2}/.gitignore +0 -0
  28. {anta_database-0.4.0 → anta_database-0.4.2}/LICENSE +0 -0
  29. {anta_database-0.4.0 → anta_database-0.4.2}/README.md +0 -0
  30. {anta_database-0.4.0 → anta_database-0.4.2}/ROADMAP.md +0 -0
  31. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/compiling/__init__.py +0 -0
  32. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/compiling/compile.py +0 -0
  33. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/compiling/reconnect.py +0 -0
  34. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/compiling/zarr_converter_simple.py +0 -0
  35. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ANT_Basins_IMBIE2_v1.6.cpg +0 -0
  36. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ANT_Basins_IMBIE2_v1.6.dbf +0 -0
  37. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ANT_Basins_IMBIE2_v1.6.parquet +0 -0
  38. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ANT_Basins_IMBIE2_v1.6.prj +0 -0
  39. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ANT_Basins_IMBIE2_v1.6.shp +0 -0
  40. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ANT_Basins_IMBIE2_v1.6.shx +0 -0
  41. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/GL.parquet +0 -0
  42. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/centeroid_coords_basins.cpg +0 -0
  43. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/centeroid_coords_basins.dbf +0 -0
  44. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/centeroid_coords_basins.prj +0 -0
  45. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/centeroid_coords_basins.shp +0 -0
  46. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/centeroid_coords_basins.shx +0 -0
  47. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/centeroid_coors_basins.parquet +0 -0
  48. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/convert_data.py +0 -0
  49. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/ice-core-coordinates.csv +0 -0
  50. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/data/site-coords.parquet +0 -0
  51. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/database/__init__.py +0 -0
  52. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/figures/AntA_38ka.png +0 -0
  53. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/indexing/__init__.py +0 -0
  54. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/indexing/index_database.py +0 -0
  55. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/test_interactive.py +0 -0
  56. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database/test_interactive_full.py +0 -0
  57. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database.egg-info/dependency_links.txt +0 -0
  58. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database.egg-info/requires.txt +0 -0
  59. {anta_database-0.4.0 → anta_database-0.4.2}/anta_database.egg-info/top_level.txt +0 -0
  60. {anta_database-0.4.0 → anta_database-0.4.2}/book/_config.yml +0 -0
  61. {anta_database-0.4.0 → anta_database-0.4.2}/book/figures/Overview_all.png +0 -0
  62. {anta_database-0.4.0 → anta_database-0.4.2}/book/logo.png +0 -0
  63. {anta_database-0.4.0 → anta_database-0.4.2}/book/references.bib +0 -0
  64. {anta_database-0.4.0 → anta_database-0.4.2}/book/requirements.txt +0 -0
  65. {anta_database-0.4.0 → anta_database-0.4.2}/pyproject.toml +0 -0
  66. {anta_database-0.4.0 → anta_database-0.4.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anta_database
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: SQLite database for the AntArchitecture Community Data
5
5
  Author: Antoine Hermant
6
6
  Author-email: antoine.hermant@etik.com
@@ -16,6 +16,7 @@ from .indexing.index_database import IndexDatabase
16
16
 
17
17
  # Plotting modules
18
18
  from .plotting.plotting import Plotting
19
+ from .plotting.plotting_pism import PISMPlotting
19
20
 
20
21
  __all__ = [
21
22
  # Database classes
@@ -27,4 +28,5 @@ __all__ = [
27
28
  "IndexDatabase",
28
29
  # Plotting functions
29
30
  "Plotting",
31
+ "PISMPlotting",
30
32
  ]
@@ -8,6 +8,7 @@ from typing import Union, List, Dict, Tuple, Optional, Generator
8
8
  from tqdm import tqdm
9
9
 
10
10
  from anta_database.plotting.plotting import Plotting
11
+ from anta_database.plotting.plotting_pism import PISMPlotting
11
12
  from anta_database.indexing.index_database import IndexDatabase
12
13
 
13
14
 
@@ -25,6 +26,7 @@ class Database:
25
26
  self._file_db_path = os.path.join(self._db_dir, file_db)
26
27
  self._md = None
27
28
  self._plotting = None
29
+ self._pism_plotting = None
28
30
  self._max_displayed_flight_ids = max_displayed_flight_ids
29
31
  self._include_BM = include_BEDMAP
30
32
  self._include_BM = index_database
@@ -981,6 +983,12 @@ class Database:
981
983
  self._plotting = Plotting(self)
982
984
  return self._plotting
983
985
 
986
+ @property
987
+ def plot_PISM(self):
988
+ if self._pism_plotting is None:
989
+ self._pism_plotting = PISMPlotting(self)
990
+ return self._pism_plotting
991
+
984
992
 
985
993
  class MetadataResult:
986
994
  def __init__(self, metadata, max_displayed_flight_ids):
@@ -5,5 +5,6 @@ Contains functions for data visualization and plotting.
5
5
  """
6
6
 
7
7
  from .plotting import Plotting
8
+ from .plotting_pism import PISMPlotting
8
9
 
9
- __all__ = ["Plotting"]
10
+ __all__ = ["Plotting", "PISMPlotting"]
@@ -241,7 +241,7 @@ class Plotting:
241
241
  mini_map=mini_map,
242
242
  )
243
243
 
244
- def transect_1D(
244
+ def stratigraphy(
245
245
  self,
246
246
  metadata: Union[None, Dict, "MetadataResult"] = None,
247
247
  elevation: Optional[bool] = False,
@@ -263,7 +263,7 @@ class Plotting:
263
263
  Plot the color-coded values of the given variable on Antarcitic map
264
264
  """
265
265
  self._base_plot(
266
- color_by="transect_1D",
266
+ color_by="stratigraphy",
267
267
  elevation=elevation,
268
268
  metadata=metadata,
269
269
  downsampling_factor=downsampling_factor,
@@ -334,12 +334,12 @@ class Plotting:
334
334
  # else: FIXME: this seems to crash spyder for spyder users
335
335
  # matplotlib.use('TkAgg')
336
336
 
337
- fig, ax = plt.subplots()
337
+ fig, ax = plt.subplots(constrained_layout=True)
338
338
 
339
339
  if basins:
340
340
  grounding_line = False
341
341
  # --- Plot Grounding Line ---
342
- if True and color_by != "transect_1D": # FIXME
342
+ if True and color_by != "stratigraphy": # FIXME
343
343
  gl = pd.read_parquet(self._gl_path)
344
344
  ax.plot(gl.x / 1000, gl.y / 1000, linewidth=1, color="k")
345
345
 
@@ -365,6 +365,9 @@ class Plotting:
365
365
  xmin, xmax = xlim
366
366
  ymin, ymax = ylim
367
367
 
368
+ if color_by == "stratigraphy":
369
+ mini_map = False
370
+
368
371
  inset_pos = [0.7, 0.75, 0.25, 0.25]
369
372
  inset = fig.add_axes(
370
373
  inset_pos, # [left, bottom, width, height] in figure coordinates
@@ -506,6 +509,7 @@ class Plotting:
506
509
  color=colors[institute],
507
510
  s=marker_size,
508
511
  linewidths=0,
512
+ zorder=10,
509
513
  )
510
514
 
511
515
  ax.plot([], [], color=colors[institute], label=institute, linewidth=3)
@@ -596,10 +600,9 @@ class Plotting:
596
600
  subset["PSX"] / 1000,
597
601
  subset["PSY"] / 1000,
598
602
  color="darkgreen",
599
- s=marker_size,
600
- norm=norm,
603
+ s=marker_size * 0.5,
601
604
  linewidths=0,
602
- zorder=i,
605
+ zorder=11,
603
606
  )
604
607
 
605
608
  elif var in ["ICE_THK", "SURF_ELEV", "BED_ELEV", "BASAL_UNIT"]:
@@ -659,11 +662,9 @@ class Plotting:
659
662
  df["PSX"] / 1000,
660
663
  df["PSY"] / 1000,
661
664
  color="darkgreen",
662
- s=marker_size,
663
- vmin=vmin,
664
- vmax=vmax,
665
+ s=marker_size * 0.5,
665
666
  linewidths=0,
666
- rasterized=True,
667
+ zorder=11,
667
668
  )
668
669
 
669
670
  elif var in ["IRH_DEPTH"]:
@@ -710,14 +711,12 @@ class Plotting:
710
711
  df["PSX"] / 1000,
711
712
  df["PSY"] / 1000,
712
713
  color="darkgreen",
713
- s=marker_size,
714
- vmin=vmin,
715
- vmax=vmax,
714
+ s=marker_size * 0.5,
716
715
  linewidths=0,
717
- rasterized=True,
716
+ zorder=11,
718
717
  )
719
718
 
720
- if color_by == "transect_1D":
719
+ if color_by == "stratigraphy":
721
720
  flight_id = list(metadata["flight_id"])
722
721
  if len(flight_id) > 1:
723
722
  flight_id = flight_id[0]
@@ -808,14 +807,17 @@ class Plotting:
808
807
  ax.plot([], [], color="grey", label="Surface Elevation", linewidth=3)
809
808
 
810
809
  else:
811
- scatter = ax.scatter(
812
- ds.Distance / 1000,
813
- ds.ICE_THK,
814
- color="k",
815
- s=marker_size,
816
- linewidths=0.1,
817
- )
818
- ax.plot([], [], color="k", label="Bed Depth", linewidth=3)
810
+ if "ICE_THK" in ds.variables:
811
+ scatter = ax.scatter(
812
+ ds.Distance / 1000,
813
+ ds.ICE_THK,
814
+ color="k",
815
+ s=marker_size,
816
+ linewidths=0.1,
817
+ )
818
+ ax.plot([], [], color="k", label="Bed Depth", linewidth=3)
819
+ else:
820
+ print("Cannot plot Bed Depth from the variables in the file")
819
821
 
820
822
  if elevation:
821
823
  ylim = (
@@ -876,6 +878,7 @@ class Plotting:
876
878
  color=colors[flight_id],
877
879
  s=marker_size,
878
880
  linewidths=0,
881
+ zorder=10,
879
882
  )
880
883
 
881
884
  ax.plot([], [], color=colors[flight_id], label=flight_id, linewidth=3)
@@ -894,7 +897,11 @@ class Plotting:
894
897
  if not self._disable_tqdm:
895
898
  print("Formatting ...")
896
899
 
897
- if auto_zoom:
900
+ if color_by == "stratigraphy":
901
+ xmin, xmax = xlim
902
+ ymin, ymax = ylim
903
+
904
+ elif auto_zoom:
898
905
  xmin = xmin - 10 if xmin is not None else None
899
906
  xmax = xmax + 10 if xmax is not None else None
900
907
  ymin = ymin - 10 if ymin is not None else None
@@ -902,7 +909,7 @@ class Plotting:
902
909
 
903
910
  ax.set_xlim(xmin, xmax)
904
911
  ax.set_ylim(ymin, ymax)
905
- if color_by != "transect_1D":
912
+ if color_by != "stratigraphy":
906
913
  x0_ax, x1_ax = ax.get_xlim()
907
914
  y0_ax, y1_ax = ax.get_ylim()
908
915
  x0 = x0_ax if xlim[0] == None else xlim[0]
@@ -960,7 +967,7 @@ class Plotting:
960
967
  cbar.ax.xaxis.set_ticks_position("bottom")
961
968
  if label:
962
969
  cbar.set_label(label)
963
- elif color_by == "transect_1D":
970
+ elif color_by == "stratigraphy":
964
971
  ax.legend(ncols=2)
965
972
  ax.set_xlabel("Distance along transect [km]")
966
973
  if elevation:
@@ -969,10 +976,8 @@ class Plotting:
969
976
  ax.set_ylabel("Depth below surface [m]")
970
977
  plt.gcf().set_size_inches(10 * scale_factor, 10 * 2 / 3)
971
978
 
972
- plt.tight_layout()
973
-
974
979
  # --- Plot IMBIE basins ---
975
- if basins and color_by != "transect_1D":
980
+ if basins and color_by != "stratigraphy":
976
981
  sf_basins = shapefile.Reader(self._imbie_path)
977
982
  basin_patches = []
978
983
 
@@ -1072,7 +1077,7 @@ class Plotting:
1072
1077
  inset.remove()
1073
1078
 
1074
1079
  # --- Plot ice core sites ---
1075
- if stations and color_by != "transect_1D":
1080
+ if stations and color_by != "stratigraphy":
1076
1081
  site_coords = pd.read_parquet(self._site_coords_path)
1077
1082
  for i in site_coords.index:
1078
1083
  site = site_coords.loc[i]