anta-database 0.3.3__tar.gz → 0.3.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.
- {anta_database-0.3.3 → anta_database-0.3.4}/PKG-INFO +7 -7
- {anta_database-0.3.3 → anta_database-0.3.4}/README.md +6 -6
- anta_database-0.3.4/ROADMAP.md +12 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/compiling/compile.py +23 -3
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/database/database.py +16 -107
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/plotting/plotting.py +33 -32
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database.egg-info/PKG-INFO +7 -7
- {anta_database-0.3.3 → anta_database-0.3.4}/book/_config.yml +1 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/contribute.md +2 -0
- anta_database-0.3.4/book/figures/Overview_all.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/intro.md +18 -12
- {anta_database-0.3.3 → anta_database-0.3.4}/book/quick_start.ipynb +201 -78
- anta_database-0.3.3/ROADMAP.md +0 -12
- anta_database-0.3.3/book/figures/Overview_all.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/.github/workflows/deploy.yml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/.github/workflows/release.yml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/.gitignore +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/LICENSE +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/anta_database.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/compiling/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/compiling/reconnect.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/ANT_Basins_IMBIE2_v1.6.cpg +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/ANT_Basins_IMBIE2_v1.6.dbf +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/ANT_Basins_IMBIE2_v1.6.prj +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/ANT_Basins_IMBIE2_v1.6.shp +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/ANT_Basins_IMBIE2_v1.6.shx +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/GL.pkl +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/centeroid_coords_basins.cpg +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/centeroid_coords_basins.dbf +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/centeroid_coords_basins.prj +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/centeroid_coords_basins.shp +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/centeroid_coords_basins.shx +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/data/site-coords.pkl +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/database/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/figures/AntA_38ka.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/indexing/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/indexing/index_database.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database/plotting/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database.egg-info/SOURCES.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database.egg-info/dependency_links.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database.egg-info/requires.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/anta_database.egg-info/top_level.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/_toc.yml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/advanced.md +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/contact.md +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/logo.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/references.bib +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/book/requirements.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/pyproject.toml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anta_database
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: SQLite database for the AntArchitecture Community Data
|
|
5
5
|
Author: Antoine Hermant
|
|
6
6
|
Author-email: antoine.hermant@etik.com
|
|
@@ -48,12 +48,12 @@ Visit the [Home Page](https://antoinehermant.github.io/anta_database/intro) for
|
|
|
48
48
|
|
|
49
49
|
The AntADatabase contains all traced and dated Internal Reflective Horizons (isochrones) that have been published at that date. All the data is organized by flight transect for each dataset. The data is encoded in HDF5 (Hierarchical Data Format) which provides convenient data structure and performant read speeds.
|
|
50
50
|
Variables per file (when exist):
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
51
|
+
- PSX(point)
|
|
52
|
+
- PSY(point)
|
|
53
|
+
- Distance(point)
|
|
54
54
|
- IRH_DEPTH(point, age)
|
|
55
|
-
-
|
|
56
|
-
-
|
|
55
|
+
- IRH_NUM(point, age)
|
|
56
|
+
- ICE_THK(point)
|
|
57
57
|
- SURF_ELEV(point, age)
|
|
58
58
|
- BED_ELEV(point, age)
|
|
59
59
|
|
|
@@ -66,7 +66,7 @@ This Python module provides SQL indexing for the AntADatabase, as well as quick
|
|
|
66
66
|
- age
|
|
67
67
|
- acquisition_year (year of radar acquisition)
|
|
68
68
|
- region
|
|
69
|
-
-
|
|
69
|
+
- IMBIE_basin
|
|
70
70
|
- var (variable)
|
|
71
71
|
- flight id
|
|
72
72
|
|
|
@@ -16,12 +16,12 @@ Visit the [Home Page](https://antoinehermant.github.io/anta_database/intro) for
|
|
|
16
16
|
|
|
17
17
|
The AntADatabase contains all traced and dated Internal Reflective Horizons (isochrones) that have been published at that date. All the data is organized by flight transect for each dataset. The data is encoded in HDF5 (Hierarchical Data Format) which provides convenient data structure and performant read speeds.
|
|
18
18
|
Variables per file (when exist):
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
19
|
+
- PSX(point)
|
|
20
|
+
- PSY(point)
|
|
21
|
+
- Distance(point)
|
|
22
22
|
- IRH_DEPTH(point, age)
|
|
23
|
-
-
|
|
24
|
-
-
|
|
23
|
+
- IRH_NUM(point, age)
|
|
24
|
+
- ICE_THK(point)
|
|
25
25
|
- SURF_ELEV(point, age)
|
|
26
26
|
- BED_ELEV(point, age)
|
|
27
27
|
|
|
@@ -34,7 +34,7 @@ This Python module provides SQL indexing for the AntADatabase, as well as quick
|
|
|
34
34
|
- age
|
|
35
35
|
- acquisition_year (year of radar acquisition)
|
|
36
36
|
- region
|
|
37
|
-
-
|
|
37
|
+
- IMBIE_basin
|
|
38
38
|
- var (variable)
|
|
39
39
|
- flight id
|
|
40
40
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
Here is a todo list of features that we want to include in the AntADatabase.
|
|
4
|
+
|
|
5
|
+
## Important
|
|
6
|
+
- [x] Implement HDF5 format (In process, for next release)
|
|
7
|
+
- [x] Filter by radar system
|
|
8
|
+
- [x] Create shapefiles, e.g. for QAntarctica (In process)
|
|
9
|
+
|
|
10
|
+
## To discuss
|
|
11
|
+
- [ ] A netCDF version
|
|
12
|
+
|
|
@@ -294,7 +294,7 @@ class CompileDatabase:
|
|
|
294
294
|
header=0,
|
|
295
295
|
sep=sep,
|
|
296
296
|
# usecols=original_new_columns.columns,
|
|
297
|
-
na_values=['-9999', '-9999.0', 'NaN', 'nan', ''],
|
|
297
|
+
# na_values=['-9999', '-9999.0', 'NaN', 'nan', ''],
|
|
298
298
|
dtype=str
|
|
299
299
|
)
|
|
300
300
|
|
|
@@ -304,6 +304,26 @@ class CompileDatabase:
|
|
|
304
304
|
ds = ds[ds.columns.intersection(original_new_columns.columns)]
|
|
305
305
|
ds.columns = original_new_columns[ds.columns].iloc[0].values # renaming the columns
|
|
306
306
|
|
|
307
|
+
values_to_replace = ['-9999', '-9999.0', 'NaN', 'nan', '']
|
|
308
|
+
|
|
309
|
+
if 'PSX' in ds.columns and 'PSY' in ds.columns:
|
|
310
|
+
# Create a mask for rows where both PSX and PSY are in values_to_replace
|
|
311
|
+
mask = (
|
|
312
|
+
ds['PSX'].isin(values_to_replace) &
|
|
313
|
+
ds['PSY'].isin(values_to_replace)
|
|
314
|
+
)
|
|
315
|
+
if mask.any():
|
|
316
|
+
problematic_indices = ds.index[mask].tolist()
|
|
317
|
+
warnings.warn(
|
|
318
|
+
f"Found {len(problematic_indices)} rows where both PSX and PSY are in {values_to_replace}. "
|
|
319
|
+
f"Indices: {problematic_indices}. Dropping these rows."
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
ds = ds[~mask].copy()
|
|
323
|
+
|
|
324
|
+
cols_to_replace = [col for col in ds.columns if col not in ['PSX', 'PSY']]
|
|
325
|
+
ds[cols_to_replace] = ds[cols_to_replace].replace(values_to_replace, pd.NA)
|
|
326
|
+
|
|
307
327
|
pattern_values = original_new_columns[1:]
|
|
308
328
|
pattern_header = original_new_columns.iloc[0]
|
|
309
329
|
pattern_values.columns = pattern_header
|
|
@@ -873,9 +893,9 @@ class CompileDatabase:
|
|
|
873
893
|
|
|
874
894
|
df = gpd.GeoDataFrame({
|
|
875
895
|
"geometry": [Point(x, y) for x, y in zip(ds.PSX.values, ds.PSY.values)],
|
|
876
|
-
"irh_num": N.astype('
|
|
896
|
+
"irh_num": N.astype('int8'),
|
|
877
897
|
"max_age": age_max_depth.astype('int32'),
|
|
878
|
-
"max_depth": max_depth.astype('int16'),
|
|
898
|
+
"max_depth": np.rint(max_depth).astype('int16'),
|
|
879
899
|
# "flight_id": [flight_id] * len(N),
|
|
880
900
|
# "doi_data": [doi_data] * len(N),
|
|
881
901
|
}, crs="EPSG:3031")
|
|
@@ -715,7 +715,7 @@ class Database:
|
|
|
715
715
|
self,
|
|
716
716
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
717
717
|
data_dir: Optional[str] = None,
|
|
718
|
-
|
|
718
|
+
downsampling_factor: Optional[str] = None,
|
|
719
719
|
disable_tqdm: bool = False,
|
|
720
720
|
) -> Generator[Tuple[pd.DataFrame, Dict]]:
|
|
721
721
|
"""
|
|
@@ -744,35 +744,43 @@ class Database:
|
|
|
744
744
|
file_paths = self._get_file_paths_from_metadata(metadata=md)
|
|
745
745
|
file_paths = np.unique(file_paths) # Be carefull as many pointers point to the same file
|
|
746
746
|
|
|
747
|
+
if disable_tqdm or self._disable_tqdm:
|
|
748
|
+
disable_tqdm = True
|
|
749
|
+
|
|
747
750
|
for file_path in tqdm(file_paths, desc='Generating dataframes', total=len(file_paths), unit='file', disable=disable_tqdm):
|
|
748
751
|
full_path = os.path.join(data_dir, file_path)
|
|
749
752
|
file_md = self._get_file_metadata(file_path)
|
|
750
753
|
ds = h5py.File(full_path, 'r')
|
|
751
|
-
df = pd.DataFrame({'PSX': ds['PSX'][::
|
|
752
|
-
'PSY': ds['PSY'][::
|
|
754
|
+
df = pd.DataFrame({'PSX': ds['PSX'][::downsampling_factor],
|
|
755
|
+
'PSY': ds['PSY'][::downsampling_factor]})
|
|
753
756
|
|
|
754
757
|
if 'Distance' in ds.keys():
|
|
755
|
-
df['Distance'] = ds['Distance'][::
|
|
758
|
+
df['Distance'] = ds['Distance'][::downsampling_factor]
|
|
756
759
|
|
|
760
|
+
var_impl = []
|
|
761
|
+
age_impl = []
|
|
757
762
|
for var in md['var']:
|
|
758
763
|
if var == 'IRH_DEPTH':
|
|
764
|
+
var_impl.append(var)
|
|
759
765
|
for age in md['age']:
|
|
760
766
|
irh_values = ds['IRH_AGE'][:]
|
|
761
767
|
irh_index = np.where(irh_values == int(age))[0]
|
|
762
768
|
if len(irh_index) == 0:
|
|
763
769
|
continue
|
|
764
770
|
irh_index = irh_index[0]
|
|
771
|
+
age_impl.append(age)
|
|
765
772
|
|
|
766
|
-
df[int(age)] = ds[var][::
|
|
773
|
+
df[int(age)] = ds[var][::downsampling_factor, irh_index]
|
|
767
774
|
|
|
768
775
|
else:
|
|
769
776
|
if var in ds.keys():
|
|
770
|
-
|
|
777
|
+
var_impl.append(var)
|
|
778
|
+
df[var] = ds[var][::downsampling_factor]
|
|
771
779
|
|
|
772
780
|
metadata = {
|
|
773
781
|
'dataset': file_md['dataset'],
|
|
774
|
-
'var':
|
|
775
|
-
'age':
|
|
782
|
+
'var': var_impl,
|
|
783
|
+
'age': age_impl,
|
|
776
784
|
'flight_id': file_md['flight_id'],
|
|
777
785
|
'institute': file_md['institute'],
|
|
778
786
|
'project': file_md['project'],
|
|
@@ -789,105 +797,6 @@ class Database:
|
|
|
789
797
|
|
|
790
798
|
yield df, metadata
|
|
791
799
|
|
|
792
|
-
# def return_dataset(
|
|
793
|
-
# self,
|
|
794
|
-
# metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
795
|
-
# data_dir: Optional[str] = None,
|
|
796
|
-
# downscale_factor: Optional[str] = None,
|
|
797
|
-
# ) -> Generator[Tuple[pd.DataFrame, Dict]]:
|
|
798
|
-
# """
|
|
799
|
-
# Generates xarray Datasets from HDF5 files, one at a time, with lazy loading.
|
|
800
|
-
|
|
801
|
-
# Args:
|
|
802
|
-
# metadata: Metadata for filtering files.
|
|
803
|
-
# data_dir: Directory containing the data files.
|
|
804
|
-
# vars_to_load: List of variables to load from each file.
|
|
805
|
-
|
|
806
|
-
# Yields:
|
|
807
|
-
# Tuple[xr.Dataset, Dict]: A lazy-loaded xarray Dataset and its metadata.
|
|
808
|
-
# """
|
|
809
|
-
# # Resolve metadata
|
|
810
|
-
# md = metadata or self._md
|
|
811
|
-
# if not md:
|
|
812
|
-
# print('Please provide metadata of the files you want to generate the data from. Exiting...')
|
|
813
|
-
# return
|
|
814
|
-
|
|
815
|
-
# # Resolve data directory
|
|
816
|
-
# data_dir = data_dir or self._db_dir
|
|
817
|
-
# if not data_dir:
|
|
818
|
-
# print('No data directory provided. Exiting...')
|
|
819
|
-
# return
|
|
820
|
-
|
|
821
|
-
# if len(md['var']) > 1:
|
|
822
|
-
# print(f'WARNING: you requested multiple variables ({md['var']}), this will return individual dataframes for each variable in each transect.')
|
|
823
|
-
|
|
824
|
-
# file_paths = self._get_file_paths_from_metadata(metadata=md)
|
|
825
|
-
# file_paths = np.unique(file_paths) # Be carefull as many pointers point to the same file
|
|
826
|
-
|
|
827
|
-
# for file_path in file_paths:
|
|
828
|
-
# full_path = os.path.join(data_dir, file_path)
|
|
829
|
-
# file_md = self._get_file_metadata(file_path)
|
|
830
|
-
# for var in md['var']:
|
|
831
|
-
# if var == 'IRH_DEPTH':
|
|
832
|
-
# for age in md['age']:
|
|
833
|
-
# with h5py.File(full_path, 'r') as ds:
|
|
834
|
-
# irh_values = ds['age'][:]
|
|
835
|
-
# irh_index = np.where(irh_values == int(age))[0]
|
|
836
|
-
# if len(irh_index) == 0:
|
|
837
|
-
# continue
|
|
838
|
-
# irh_index = irh_index[0]
|
|
839
|
-
# df = pd.DataFrame({'x': ds['x'][::downscale_factor],
|
|
840
|
-
# 'y': ds['y'][::downscale_factor],
|
|
841
|
-
# 'distance': ds['distance'][::downscale_factor],
|
|
842
|
-
# var: ds[var][::downscale_factor, irh_index]})
|
|
843
|
-
|
|
844
|
-
# metadata = {
|
|
845
|
-
# 'dataset': file_md['dataset'],
|
|
846
|
-
# 'var': var,
|
|
847
|
-
# 'age': age,
|
|
848
|
-
# 'flight_id': file_md['flight_id'],
|
|
849
|
-
# 'institute': file_md['institute'],
|
|
850
|
-
# 'project': file_md['project'],
|
|
851
|
-
# 'acquisition_year': file_md['acquisition_year'],
|
|
852
|
-
# 'age_unc': file_md['age'],
|
|
853
|
-
# 'reference': file_md['reference'],
|
|
854
|
-
# 'DOI_dataset': file_md['DOI_dataset'],
|
|
855
|
-
# 'DOI_publication': file_md['DOI_publication'],
|
|
856
|
-
# 'flight_id': file_md['flight_id'],
|
|
857
|
-
# 'region': file_md['region'],
|
|
858
|
-
# 'IMBIE_basin': file_md['IMBIE_basin'],
|
|
859
|
-
# 'radar_instrument': file_md['radar_instrument'],
|
|
860
|
-
# }
|
|
861
|
-
|
|
862
|
-
# yield df, metadata
|
|
863
|
-
|
|
864
|
-
# else:
|
|
865
|
-
# ds = h5py.File(full_path, 'r')
|
|
866
|
-
# df = pd.DataFrame({'PSX': ds['PSX'][::downscale_factor],
|
|
867
|
-
# 'PSY': ds['PSY'][::downscale_factor],
|
|
868
|
-
# 'Distance': ds['Distance'][::downscale_factor],
|
|
869
|
-
# var: ds[var][::downscale_factor]})
|
|
870
|
-
|
|
871
|
-
# metadata = {
|
|
872
|
-
# 'dataset': file_md['dataset'],
|
|
873
|
-
# 'var': var,
|
|
874
|
-
# 'age': None,
|
|
875
|
-
# 'flight_id': file_md['flight_id'],
|
|
876
|
-
# 'institute': file_md['institute'],
|
|
877
|
-
# 'project': file_md['project'],
|
|
878
|
-
# 'acquisition_year': file_md['acquisition_year'],
|
|
879
|
-
# 'age_unc': file_md['age'],
|
|
880
|
-
# 'reference': file_md['reference'],
|
|
881
|
-
# 'DOI_dataset': file_md['DOI_dataset'],
|
|
882
|
-
# 'DOI_publication': file_md['DOI_publication'],
|
|
883
|
-
# 'flight_id': file_md['flight_id'],
|
|
884
|
-
# 'region': file_md['region'],
|
|
885
|
-
# 'IMBIE_basin': file_md['IMBIE_basin'],
|
|
886
|
-
# 'radar_instrument': file_md['radar_instrument'],
|
|
887
|
-
# }
|
|
888
|
-
|
|
889
|
-
# yield df, metadata
|
|
890
|
-
|
|
891
800
|
@property
|
|
892
801
|
def plot(self):
|
|
893
802
|
if self._plotting is None:
|
|
@@ -62,7 +62,7 @@ class Plotting:
|
|
|
62
62
|
def dataset(
|
|
63
63
|
self,
|
|
64
64
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
65
|
-
|
|
65
|
+
downsampling_factor: Optional[int] = None,
|
|
66
66
|
title: Optional[str] = None,
|
|
67
67
|
xlim: Optional[tuple] = (None, None),
|
|
68
68
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -82,7 +82,7 @@ class Plotting:
|
|
|
82
82
|
self._base_plot(
|
|
83
83
|
color_by='dataset',
|
|
84
84
|
metadata=metadata,
|
|
85
|
-
|
|
85
|
+
downsampling_factor=downsampling_factor,
|
|
86
86
|
marker_size=marker_size,
|
|
87
87
|
title=title,
|
|
88
88
|
xlim=xlim,
|
|
@@ -100,7 +100,7 @@ class Plotting:
|
|
|
100
100
|
def institute(
|
|
101
101
|
self,
|
|
102
102
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
103
|
-
|
|
103
|
+
downsampling_factor: Optional[int] = None,
|
|
104
104
|
title: Optional[str] = None,
|
|
105
105
|
xlim: Optional[tuple] = (None, None),
|
|
106
106
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -120,7 +120,7 @@ class Plotting:
|
|
|
120
120
|
self._base_plot(
|
|
121
121
|
color_by='institute',
|
|
122
122
|
metadata=metadata,
|
|
123
|
-
|
|
123
|
+
downsampling_factor=downsampling_factor,
|
|
124
124
|
marker_size=marker_size,
|
|
125
125
|
title=title,
|
|
126
126
|
xlim=xlim,
|
|
@@ -138,7 +138,7 @@ class Plotting:
|
|
|
138
138
|
def flight_id(
|
|
139
139
|
self,
|
|
140
140
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
141
|
-
|
|
141
|
+
downsampling_factor: Optional[int] = None,
|
|
142
142
|
title: Optional[str] = None,
|
|
143
143
|
xlim: Optional[tuple] = (None, None),
|
|
144
144
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -158,7 +158,7 @@ class Plotting:
|
|
|
158
158
|
self._base_plot(
|
|
159
159
|
color_by='flight_id',
|
|
160
160
|
metadata=metadata,
|
|
161
|
-
|
|
161
|
+
downsampling_factor=downsampling_factor,
|
|
162
162
|
scale_factor=scale_factor,
|
|
163
163
|
marker_size=marker_size,
|
|
164
164
|
title=title,
|
|
@@ -176,7 +176,7 @@ class Plotting:
|
|
|
176
176
|
def var(
|
|
177
177
|
self,
|
|
178
178
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
179
|
-
|
|
179
|
+
downsampling_factor: Optional[int] = None,
|
|
180
180
|
title: Optional[str] = None,
|
|
181
181
|
xlim: Optional[tuple] = (None, None),
|
|
182
182
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -196,7 +196,7 @@ class Plotting:
|
|
|
196
196
|
self._base_plot(
|
|
197
197
|
color_by='var',
|
|
198
198
|
metadata=metadata,
|
|
199
|
-
|
|
199
|
+
downsampling_factor=downsampling_factor,
|
|
200
200
|
title=title,
|
|
201
201
|
xlim=xlim,
|
|
202
202
|
ylim=ylim,
|
|
@@ -215,7 +215,7 @@ class Plotting:
|
|
|
215
215
|
self,
|
|
216
216
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
217
217
|
elevation: Optional[bool] = False,
|
|
218
|
-
|
|
218
|
+
downsampling_factor: Optional[int] = None,
|
|
219
219
|
title: Optional[str] = None,
|
|
220
220
|
xlim: Optional[tuple] = (None, None),
|
|
221
221
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -234,7 +234,7 @@ class Plotting:
|
|
|
234
234
|
color_by='transect_1D',
|
|
235
235
|
elevation=elevation,
|
|
236
236
|
metadata=metadata,
|
|
237
|
-
|
|
237
|
+
downsampling_factor=downsampling_factor,
|
|
238
238
|
title=title,
|
|
239
239
|
xlim=xlim,
|
|
240
240
|
ylim=ylim,
|
|
@@ -261,7 +261,7 @@ class Plotting:
|
|
|
261
261
|
self,
|
|
262
262
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
263
263
|
elevation: Optional[bool] = False,
|
|
264
|
-
|
|
264
|
+
downsampling_factor: Optional[int] = None,
|
|
265
265
|
title: Optional[str] = None,
|
|
266
266
|
xlim: Optional[tuple] = (None, None),
|
|
267
267
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -314,8 +314,8 @@ class Plotting:
|
|
|
314
314
|
if color_by == 'dataset':
|
|
315
315
|
if not title:
|
|
316
316
|
title = f'AntADatabase by datasets'
|
|
317
|
-
if
|
|
318
|
-
|
|
317
|
+
if downsampling_factor == None:
|
|
318
|
+
downsampling_factor = 1
|
|
319
319
|
datasets = list(metadata['dataset'])
|
|
320
320
|
bedmap_entries = {'BEDMAP1', 'BEDMAP2', 'BEDMAP3'}
|
|
321
321
|
bedmap_colors = {
|
|
@@ -341,8 +341,8 @@ class Plotting:
|
|
|
341
341
|
for f in file_paths:
|
|
342
342
|
full_path = os.path.join(self._db._db_dir, f)
|
|
343
343
|
with h5py.File(full_path, 'r') as ds:
|
|
344
|
-
all_x.append(ds['PSX'][::
|
|
345
|
-
all_y.append(ds['PSY'][::
|
|
344
|
+
all_x.append(ds['PSX'][::downsampling_factor])
|
|
345
|
+
all_y.append(ds['PSY'][::downsampling_factor])
|
|
346
346
|
df = pd.DataFrame({'PSX': np.concatenate(all_x),
|
|
347
347
|
'PSY': np.concatenate(all_y)})
|
|
348
348
|
plt.scatter(df['PSX']/1000, df['PSY']/1000, color=colors[dataset], s=marker_size, zorder=zorder, linewidths=0)
|
|
@@ -359,8 +359,8 @@ class Plotting:
|
|
|
359
359
|
if color_by == 'institute':
|
|
360
360
|
if not title:
|
|
361
361
|
title = f'AntADatabase by institutes'
|
|
362
|
-
if
|
|
363
|
-
|
|
362
|
+
if downsampling_factor == None:
|
|
363
|
+
downsampling_factor = 1
|
|
364
364
|
institutes = list(metadata['institute'])
|
|
365
365
|
|
|
366
366
|
color_indices = np.linspace(0.1, 0.9, len(institutes))
|
|
@@ -378,8 +378,8 @@ class Plotting:
|
|
|
378
378
|
for f in file_paths:
|
|
379
379
|
full_path = os.path.join(self._db._db_dir, f)
|
|
380
380
|
with h5py.File(full_path, 'r') as ds:
|
|
381
|
-
all_x.append(ds['PSX'][::
|
|
382
|
-
all_y.append(ds['PSY'][::
|
|
381
|
+
all_x.append(ds['PSX'][::downsampling_factor])
|
|
382
|
+
all_y.append(ds['PSY'][::downsampling_factor])
|
|
383
383
|
df = pd.DataFrame({'PSX': np.concatenate(all_x),
|
|
384
384
|
'PSY': np.concatenate(all_y)})
|
|
385
385
|
plt.scatter(df['PSX']/1000, df['PSY']/1000, color=colors[institute], s=marker_size, linewidths=0)
|
|
@@ -404,7 +404,7 @@ class Plotting:
|
|
|
404
404
|
|
|
405
405
|
|
|
406
406
|
all_dfs = []
|
|
407
|
-
for ds, _ in tqdm(self._db.data_generator(metadata,
|
|
407
|
+
for ds, _ in tqdm(self._db.data_generator(metadata, downsampling_factor=downsampling_factor, disable_tqdm=True), desc="Plotting", total=total_traces, unit='trace', disable=self._disable_tqdm):
|
|
408
408
|
all_dfs.append(ds)
|
|
409
409
|
df = pd.concat(all_dfs)
|
|
410
410
|
|
|
@@ -448,32 +448,32 @@ class Plotting:
|
|
|
448
448
|
if cmap == None:
|
|
449
449
|
cmap = cmaps.bukavu
|
|
450
450
|
extend = 'both'
|
|
451
|
-
if
|
|
452
|
-
if
|
|
451
|
+
if vmin is None: vmin = -1000
|
|
452
|
+
if vmax is None: vmax = 1000
|
|
453
453
|
if not title:
|
|
454
454
|
title = f'AntADatabase Bed Elevation'
|
|
455
455
|
elif var == 'ICE_THK':
|
|
456
456
|
if cmap == None:
|
|
457
457
|
cmap = cmaps.torch_r
|
|
458
458
|
extend = 'max'
|
|
459
|
-
if
|
|
460
|
-
if
|
|
459
|
+
if vmin is None: vmin = 0
|
|
460
|
+
if vmax is None: vmax = 4000
|
|
461
461
|
if not title:
|
|
462
462
|
title = f'AntADatabase Ice Thickness'
|
|
463
463
|
elif var == 'SURF_ELEV':
|
|
464
464
|
if cmap == None:
|
|
465
|
-
cmap = cmaps.
|
|
465
|
+
cmap = cmaps.ice_r
|
|
466
466
|
extend = 'max'
|
|
467
|
-
if
|
|
468
|
-
if
|
|
467
|
+
if vmin is None: vmin = 1000
|
|
468
|
+
if vmax is None: vmax = 4000
|
|
469
469
|
if not title:
|
|
470
470
|
title = f'AntADatabase Surface Elevation'
|
|
471
471
|
elif var == 'BASAL_UNIT':
|
|
472
472
|
if cmap == None:
|
|
473
473
|
cmap = cmaps.torch_r
|
|
474
474
|
extend = 'both'
|
|
475
|
-
if
|
|
476
|
-
if
|
|
475
|
+
if vmin is None: vmin = 2000
|
|
476
|
+
if vmax is None: vmax = 400
|
|
477
477
|
if not title:
|
|
478
478
|
title = f'AntADatabase Basal Unit'
|
|
479
479
|
scatter = plt.scatter(df['PSX']/1000, df['PSY']/1000, c=df[var], cmap=cmap, s=marker_size, vmin=vmin, vmax=vmax, linewidths=0, rasterized=True)
|
|
@@ -605,13 +605,14 @@ class Plotting:
|
|
|
605
605
|
all_y.append(ds['PSY'][:])
|
|
606
606
|
df = pd.DataFrame({'PSX': np.concatenate(all_x),
|
|
607
607
|
'PSY': np.concatenate(all_y)})
|
|
608
|
-
plt.scatter(df['PSX'][::
|
|
608
|
+
plt.scatter(df['PSX'][::downsampling_factor]/1000, df['PSY'][::downsampling_factor]/1000, color=colors[flight_id], s=marker_size, linewidths=0)
|
|
609
609
|
|
|
610
610
|
plt.plot([], [], color=colors[flight_id], label=flight_id, linewidth=3)
|
|
611
611
|
ncol = 2 if len(flight_ids) > 40 else 1
|
|
612
612
|
|
|
613
613
|
# --- Format Figure ---
|
|
614
|
-
|
|
614
|
+
if not self._disable_tqdm:
|
|
615
|
+
print('Formatting ...')
|
|
615
616
|
|
|
616
617
|
ax.set_xlim(*xlim)
|
|
617
618
|
ax.set_ylim(*ylim)
|
|
@@ -710,7 +711,7 @@ class Plotting:
|
|
|
710
711
|
site_coords = pd.read_pickle(self._site_coords_path)
|
|
711
712
|
for i in site_coords.index:
|
|
712
713
|
site = site_coords.loc[i]
|
|
713
|
-
ax.scatter(site['x']/1000, site['y']/1000, color='red', s=50, marker='^', edgecolor='black', linewidth=1.5)
|
|
714
|
+
ax.scatter(site['x']/1000, site['y']/1000, color='red', s=50, marker='^', edgecolor='black', linewidth=1.5, zorder=50)
|
|
714
715
|
# --- Save/Show ---
|
|
715
716
|
with self._plot_context():
|
|
716
717
|
if save:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anta_database
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: SQLite database for the AntArchitecture Community Data
|
|
5
5
|
Author: Antoine Hermant
|
|
6
6
|
Author-email: antoine.hermant@etik.com
|
|
@@ -48,12 +48,12 @@ Visit the [Home Page](https://antoinehermant.github.io/anta_database/intro) for
|
|
|
48
48
|
|
|
49
49
|
The AntADatabase contains all traced and dated Internal Reflective Horizons (isochrones) that have been published at that date. All the data is organized by flight transect for each dataset. The data is encoded in HDF5 (Hierarchical Data Format) which provides convenient data structure and performant read speeds.
|
|
50
50
|
Variables per file (when exist):
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
51
|
+
- PSX(point)
|
|
52
|
+
- PSY(point)
|
|
53
|
+
- Distance(point)
|
|
54
54
|
- IRH_DEPTH(point, age)
|
|
55
|
-
-
|
|
56
|
-
-
|
|
55
|
+
- IRH_NUM(point, age)
|
|
56
|
+
- ICE_THK(point)
|
|
57
57
|
- SURF_ELEV(point, age)
|
|
58
58
|
- BED_ELEV(point, age)
|
|
59
59
|
|
|
@@ -66,7 +66,7 @@ This Python module provides SQL indexing for the AntADatabase, as well as quick
|
|
|
66
66
|
- age
|
|
67
67
|
- acquisition_year (year of radar acquisition)
|
|
68
68
|
- region
|
|
69
|
-
-
|
|
69
|
+
- IMBIE_basin
|
|
70
70
|
- var (variable)
|
|
71
71
|
- flight id
|
|
72
72
|
|
|
@@ -6,3 +6,5 @@ Maybe first contact me so I know that people are interested and on which feature
|
|
|
6
6
|
|
|
7
7
|
The project is hosted on [GitHub](https://github.com/antoinehermant/anta_database). First you should fork the repository, create your own features branches and submit pull request.
|
|
8
8
|
|
|
9
|
+
Check the [Roadmap](https://github.com/antoinehermant/anta_database/blob/main/ROADMAP.md).
|
|
10
|
+
|
|
Binary file
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
# AntADatabase
|
|
2
2
|
|
|
3
|
-
AntADatabase
|
|
3
|
+
AntADatabase a Python-powered SQLite database designed 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.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Overview
|
|
6
6
|

|
|
7
7
|
**Figures** created using plotting functions from this module
|
|
8
8
|
|
|
9
9
|
### Datasets currently included:
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- Ashmore et al. 2020, https://doi.org/10.1029/2019GL086663
|
|
11
|
+
- BEDMAP1: Lythe et al. (2022), https://doi.org/10.5285/f64815ec-4077-4432-9f55-0ce230f46029
|
|
12
|
+
- BEDMAP2: Fretwell et al. (2022), https://doi.org/10.5285/2fd95199-365e-4da1-ae26-3b6d48b3e6ac
|
|
13
|
+
- BEDMAP3: Frémand et al. (2022), https://doi.org/10.5285/91523ff9-d621-46b3-87f7-ffb6efcd1847
|
|
14
|
+
- Beem et al. 2021, https://doi.org/10.15784/601437
|
|
15
|
+
- Bodart et al. 2021, https://doi.org/10.5285/F2DE31AF-9F83-44F8-9584-F0190A2CC3EB
|
|
16
|
+
- Bodart and Sutter 2025a, https://doi.org/10.5281/zenodo.17348976
|
|
17
|
+
- Bodart and Sutter 2025b, https://doi.org/10.5281/zenodo.17348094
|
|
18
|
+
- Cavitte et al. 2020, https://doi.org/10.15784/601411
|
|
12
19
|
- Chung et al. 2023 https://doi.pangaea.de/10.1594/PANGAEA.957176
|
|
20
|
+
- Franke et al. 2025, https://doi.org/10.1594/PANGAEA.973266
|
|
21
|
+
- Jacobel and Welch 2005, https://doi.org/10.7265/N5R20Z9T
|
|
22
|
+
- Leysinger-Vieli et al. 2011, https://doi.org/10.5281/zenodo.15516203
|
|
13
23
|
- Muldoon et al. 2023, https://doi.org/10.15784/601673
|
|
14
24
|
- Mulvaney et al. 2023, https://doi.pangaea.de/10.1594/PANGAEA.963470
|
|
25
|
+
- Sanderson et al. 2024, https://doi.org/10.5285/cfafb639-991a-422f-9caa-7793c195d316
|
|
26
|
+
- Siegert and Payne 2024, https://onlinelibrary.wiley.com/doi/10.1002/esp.1238
|
|
15
27
|
- Wang et al. 2023, https://doi.org/10.1594/PANGAEA.958462
|
|
16
|
-
- Bodart et al. 2021, https://doi.org/10.5285/F2DE31AF-9F83-44F8-9584-F0190A2CC3EB
|
|
17
|
-
- Beem et al. 2021, https://doi.org/10.15784/601437
|
|
18
|
-
- Ashmore et al. 2020, https://doi.org/10.1029/2019GL086663
|
|
19
|
-
- Cavitte et al. 2020, https://doi.org/10.15784/601411
|
|
20
28
|
- Winter et al. 2018, https://doi.org/10.1594/PANGAEA.895528
|
|
21
|
-
-
|
|
22
|
-
- Jacobel et al 2005, https://doi.org/10.7265/N5R20Z9T
|
|
23
|
-
- BEDMAP version 1, 2 and 3
|
|
29
|
+
- Yan et al. 2025, https://doi.org/10.5281/zenodo.14962526
|
|
24
30
|
|
|
25
31
|
## Key Features
|
|
26
32
|
- Standardized HDF5 format
|
|
27
|
-
-
|
|
33
|
+
- SQLite indexing
|
|
28
34
|
- Quick visualization on Antarctica map
|
|
29
35
|
- Generate lazy data for later use
|
|
30
36
|
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"- acquisition_year: year(s) in which the radar data were acquired\n",
|
|
79
79
|
"- age: age(s) in yrs before present of the layer(s) of interest\n",
|
|
80
80
|
"- region: region(s) of interest. E.g.: 'EAIS', 'WAIS'\n",
|
|
81
|
-
"-
|
|
82
|
-
"- var: variables(s) of interest. Possible variables currently are: 'IRH_DEPTH', 'IRH_DENS', '
|
|
81
|
+
"- IMBIE_basin: IMBIE basin(s) of interest. E.g.: 'G-H', 'Ap-B'.\n",
|
|
82
|
+
"- var: variables(s) of interest. Possible variables currently are: 'IRH_DEPTH', 'IRH_DENS', 'ICE_THK', 'BED_ELEV', 'SURF_ELEV'\n",
|
|
83
83
|
"- flight_id: ID of a particular flight line. This is useful for explicit flight IDs such as 'DC_LDC_DIVIDE'\n",
|
|
84
84
|
"\n",
|
|
85
85
|
"One can also combine field queries as well as providing lists. Use '%' for searching by regular expressions. Here are a few examples:"
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"#Examples of queries:\n",
|
|
96
96
|
"db.query(dataset='Cavitte_2020') # all data from Cavitte et al. 2020\n",
|
|
97
97
|
"db.query(age='38100') # all datasets with the 38.1ka isochrone\n",
|
|
98
|
-
"db.query(var='
|
|
99
|
-
"db.query(
|
|
100
|
-
"db.query(
|
|
101
|
-
"db.query(
|
|
98
|
+
"db.query(var='ICE_THK') # all datasets with IceThk variable\n",
|
|
99
|
+
"db.query(IMBIE_basin='G-H') # all flight lines that cross the G-H basin\n",
|
|
100
|
+
"db.query(flight_id='DC_LDC_DIVIDE') # all layers with the flight ID DC_LDC_DIVIDE\n",
|
|
101
|
+
"db.query(flight_id='%WSB%') # all flight lines with WSB in the flight ID\n",
|
|
102
102
|
"db.query(dataset=['Franke_2025', 'Winter_2018'], age='38100') # example of multiple criteria"
|
|
103
103
|
]
|
|
104
104
|
},
|
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
"metadata": {},
|
|
118
118
|
"outputs": [],
|
|
119
119
|
"source": [
|
|
120
|
+
"%%capture\n",
|
|
120
121
|
"db.filter_out(acquisition_year='<1990') # filter out all data acquired before 1990\n",
|
|
121
122
|
"db.query() # now all queries will exclude data acquired before 1990\n",
|
|
122
123
|
"\n",
|
|
@@ -134,37 +135,60 @@
|
|
|
134
135
|
"Use the results of the query in the plotting functions:"
|
|
135
136
|
]
|
|
136
137
|
},
|
|
138
|
+
{
|
|
139
|
+
"cell_type": "markdown",
|
|
140
|
+
"id": "cf1e071c",
|
|
141
|
+
"metadata": {},
|
|
142
|
+
"source": [
|
|
143
|
+
"Current implemented plotting functions are:\n",
|
|
144
|
+
"- plot.dataset(): plots locations of the data, with different colors for the different datasets (example above)\n",
|
|
145
|
+
"- plot.institute(): plots locations of the data, with different colors for the different institutes\n",
|
|
146
|
+
"- plot.var(): color-coded scatter plot of the variable of insterest.\n",
|
|
147
|
+
"- plot.flight_id(): color-coded trace IDs. Useful for identifying specific traces of interest.\n",
|
|
148
|
+
"- plot.transect_1D(): plots depths of the IRH and Bed along a single flight line \n",
|
|
149
|
+
"\n",
|
|
150
|
+
"In Jupyter Notebook, use '%matplotlib qt' or '%matplotlib widget' depending on your IDE, to switch to the matplotlib widget that allows you to zoom in etc.\n",
|
|
151
|
+
"Use '%matplotlib inline' (default) to plot the figure in the notebook"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"cell_type": "markdown",
|
|
156
|
+
"id": "a07fe92e",
|
|
157
|
+
"metadata": {},
|
|
158
|
+
"source": [
|
|
159
|
+
"### Plot datasets"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
137
162
|
{
|
|
138
163
|
"cell_type": "code",
|
|
139
164
|
"execution_count": null,
|
|
140
|
-
"id": "
|
|
165
|
+
"id": "0c68119f",
|
|
141
166
|
"metadata": {},
|
|
142
167
|
"outputs": [],
|
|
143
168
|
"source": [
|
|
144
|
-
"results = db.query(
|
|
169
|
+
"results = db.query(IMBIE_basin='G-H')\n",
|
|
145
170
|
"db.plot.dataset(results,\n",
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
" latex=True, # use latex compilers for plotting if you have them installed on your system\n",
|
|
151
|
-
" # save='AntA_38ka.pdf', # Uncomment to save the figure, otherwise it we visualize with pyplot\n",
|
|
171
|
+
" title='IRH data crossing the G-H IMBIE basin',\n",
|
|
172
|
+
" xlim=(-2000, -500), # set the plot extent in km\n",
|
|
173
|
+
" ylim=(-1000, 250),\n",
|
|
174
|
+
" marker_size=1, # adjust the size of the markers\n",
|
|
152
175
|
" )"
|
|
153
176
|
]
|
|
154
177
|
},
|
|
155
178
|
{
|
|
156
179
|
"cell_type": "markdown",
|
|
157
|
-
"id": "
|
|
180
|
+
"id": "a0217254",
|
|
158
181
|
"metadata": {},
|
|
159
182
|
"source": [
|
|
160
|
-
"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
183
|
+
"Note: all flight lines in the database are associated with one or several IMBIE basin(s). This depends if the flight line crosses one or multiple basins. The plot above shows all the flight lines which have traced IRH data and that crosses at some point the G-H basin."
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"cell_type": "markdown",
|
|
188
|
+
"id": "e735309e",
|
|
189
|
+
"metadata": {},
|
|
190
|
+
"source": [
|
|
191
|
+
"### Plot variables"
|
|
168
192
|
]
|
|
169
193
|
},
|
|
170
194
|
{
|
|
@@ -178,13 +202,13 @@
|
|
|
178
202
|
"source": [
|
|
179
203
|
"# %matplotlib widget\n",
|
|
180
204
|
"%matplotlib inline\n",
|
|
181
|
-
"results = db.query(age=['
|
|
205
|
+
"results = db.query(age=['37600', '38000', '38100', '38200', '38500'], var='IRH_DEPTH')\n",
|
|
182
206
|
"db.plot.var(results, title='AntArchitecture 38(.1)ka isochrone depth',\n",
|
|
183
|
-
"
|
|
207
|
+
" downsampling_factor=10, # downscale the datasets n times, which makes little visual difference but lighter to plot\n",
|
|
184
208
|
" xlim=(-500, 2400),\n",
|
|
185
209
|
" ylim=(-2200, 2200),\n",
|
|
186
|
-
" scale_factor=0.7
|
|
187
|
-
"
|
|
210
|
+
" scale_factor=0.7, # adjust the size of the plot \n",
|
|
211
|
+
" marker_size=1.2,\n",
|
|
188
212
|
" # save='AntA_38ka_depth.png'\n",
|
|
189
213
|
" )"
|
|
190
214
|
]
|
|
@@ -196,14 +220,22 @@
|
|
|
196
220
|
"metadata": {},
|
|
197
221
|
"outputs": [],
|
|
198
222
|
"source": [
|
|
199
|
-
"results = db.query(var='
|
|
223
|
+
"results = db.query(var='IRH_NUM')\n",
|
|
200
224
|
"db.plot.var(results, title='IRH Density over the Antarctic Ice Sheet',\n",
|
|
201
|
-
"
|
|
225
|
+
" downsampling_factor=100,\n",
|
|
202
226
|
" scale_factor=1,\n",
|
|
203
|
-
"
|
|
227
|
+
" marker_size=1.2,\n",
|
|
204
228
|
" )"
|
|
205
229
|
]
|
|
206
230
|
},
|
|
231
|
+
{
|
|
232
|
+
"cell_type": "markdown",
|
|
233
|
+
"id": "9185b390",
|
|
234
|
+
"metadata": {},
|
|
235
|
+
"source": [
|
|
236
|
+
"### Plot flight IDs"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
207
239
|
{
|
|
208
240
|
"cell_type": "code",
|
|
209
241
|
"execution_count": null,
|
|
@@ -211,22 +243,134 @@
|
|
|
211
243
|
"metadata": {},
|
|
212
244
|
"outputs": [],
|
|
213
245
|
"source": [
|
|
214
|
-
"results = db.query(dataset='Winter%',
|
|
246
|
+
"results = db.query(dataset='Winter%', flight_id=['EPICA%'])\n",
|
|
215
247
|
"db.plot.flight_id(results, title='Winter et al. 2018 - EPICA',\n",
|
|
216
248
|
" xlim=(-500, 1000),\n",
|
|
217
249
|
" ylim=(1000, 2200),\n",
|
|
218
|
-
"
|
|
250
|
+
" marker_size=1.2,\n",
|
|
219
251
|
" )"
|
|
220
252
|
]
|
|
221
253
|
},
|
|
254
|
+
{
|
|
255
|
+
"cell_type": "markdown",
|
|
256
|
+
"id": "84b02a87",
|
|
257
|
+
"metadata": {},
|
|
258
|
+
"source": [
|
|
259
|
+
"### Plot layer depths along transect"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"cell_type": "code",
|
|
264
|
+
"execution_count": null,
|
|
265
|
+
"id": "d0a358b2",
|
|
266
|
+
"metadata": {},
|
|
267
|
+
"outputs": [],
|
|
268
|
+
"source": [
|
|
269
|
+
"results = db.query(dataset='Cavitte_2020', flight_id='DC_LDC_DIVIDE')\n",
|
|
270
|
+
"db.plot.transect_1D(results)"
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"cell_type": "markdown",
|
|
275
|
+
"id": "fd1d77ba",
|
|
276
|
+
"metadata": {},
|
|
277
|
+
"source": [
|
|
278
|
+
"Use the elevation=True option to plot the transect in absolute elevation above sea level:"
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"cell_type": "code",
|
|
283
|
+
"execution_count": null,
|
|
284
|
+
"id": "32c3457a",
|
|
285
|
+
"metadata": {},
|
|
286
|
+
"outputs": [],
|
|
287
|
+
"source": [
|
|
288
|
+
"db.plot.transect_1D(results, elevation=True)"
|
|
289
|
+
]
|
|
290
|
+
},
|
|
222
291
|
{
|
|
223
292
|
"cell_type": "markdown",
|
|
224
293
|
"id": "3cee8359",
|
|
225
294
|
"metadata": {},
|
|
226
295
|
"source": [
|
|
227
296
|
"Other possible arguments for the plot methods:\n",
|
|
228
|
-
"- cmap: provide your colormap of choice (as LinearSegmentedColormap). Tip: 'import colormaps as cmaps' for a large choice of colormaps (see [Colormaps docs](https://pratiman-91.github.io/colormaps/)
|
|
229
|
-
"-
|
|
297
|
+
"- cmap: provide your colormap of choice (as LinearSegmentedColormap). Tip: 'import colormaps as cmaps' for a large choice of colormaps (see [Colormaps docs](https://pratiman-91.github.io/colormaps/)\n",
|
|
298
|
+
"- vmin and vmax: sets the minimum and maximum values for the colorbar."
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"cell_type": "markdown",
|
|
303
|
+
"id": "95dcf714",
|
|
304
|
+
"metadata": {},
|
|
305
|
+
"source": [
|
|
306
|
+
"## BEDMAP\n",
|
|
307
|
+
"\n",
|
|
308
|
+
"The AntADatabase now contains all the BEDMAP (1, 2 and 3) data. This is useful to see the whole extent of the existing radar data, or to reconnect the IRH datasets to BEDMAP in order to get the Bed Elevation or Ice Thickness when those are not included.\n",
|
|
309
|
+
"\n",
|
|
310
|
+
"By default, BEDMAP is not shown in the query, since it is not an IRH dataset. To include it, initialize the Database with the option:"
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"cell_type": "code",
|
|
315
|
+
"execution_count": null,
|
|
316
|
+
"id": "6de501f7",
|
|
317
|
+
"metadata": {},
|
|
318
|
+
"outputs": [],
|
|
319
|
+
"source": [
|
|
320
|
+
"db = Database('/home/anthe/documents/data/isochrones/AntADatabase/', include_BEDMAP=True)"
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"cell_type": "markdown",
|
|
325
|
+
"id": "28dcee6d",
|
|
326
|
+
"metadata": {},
|
|
327
|
+
"source": [
|
|
328
|
+
"## Get files from the database\n",
|
|
329
|
+
"\n",
|
|
330
|
+
"You may want to make your own plots or further process the data after querying the database. One option is to get the list of the files from your query and open them individually with either xarray or h5py. For this, use the get_files() function:"
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"cell_type": "code",
|
|
335
|
+
"execution_count": null,
|
|
336
|
+
"id": "fc67b755",
|
|
337
|
+
"metadata": {},
|
|
338
|
+
"outputs": [],
|
|
339
|
+
"source": [
|
|
340
|
+
"import xarray as xr\n",
|
|
341
|
+
"import matplotlib.pyplot as plt\n",
|
|
342
|
+
"results = db.query(dataset='Cavitte_2020', flight_id='DC_LDC_DIVIDE')\n",
|
|
343
|
+
"file_list = db.get_files(results)\n",
|
|
344
|
+
"f = file_list[0]\n",
|
|
345
|
+
"ds = xr.open_dataset(f, engine='h5netcdf')\n",
|
|
346
|
+
"print(ds)\n",
|
|
347
|
+
"plt.plot(ds.Distance, ds.IRH_DEPTH)\n",
|
|
348
|
+
"plt.show()"
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"cell_type": "markdown",
|
|
353
|
+
"id": "57c0f26c",
|
|
354
|
+
"metadata": {},
|
|
355
|
+
"source": [
|
|
356
|
+
"xarray provides a nice interface for interacting with the data. This works great when dealing with one file, and for example quickly plot all the layers (see above). But xarray adds some overload, which feels slow when reading many files. h5py on the other hand reads the underlying data right away, which is much more efficient:"
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"cell_type": "code",
|
|
361
|
+
"execution_count": null,
|
|
362
|
+
"id": "a404f0ed",
|
|
363
|
+
"metadata": {},
|
|
364
|
+
"outputs": [],
|
|
365
|
+
"source": [
|
|
366
|
+
"import h5py\n",
|
|
367
|
+
"import matplotlib.pyplot as plt\n",
|
|
368
|
+
"results = db.query(dataset='Cavitte_2020')\n",
|
|
369
|
+
"file_list = db.get_files(results)\n",
|
|
370
|
+
"for f in file_list:\n",
|
|
371
|
+
" with h5py.File(f, 'r') as ds:\n",
|
|
372
|
+
" plt.scatter(ds['PSX'][:], ds['PSY'][:], c=ds['ICE_THK'][:], s=1)\n",
|
|
373
|
+
"plt.show()"
|
|
230
374
|
]
|
|
231
375
|
},
|
|
232
376
|
{
|
|
@@ -238,7 +382,7 @@
|
|
|
238
382
|
"\n",
|
|
239
383
|
"Note: This part could be developed further in the future if there is the need. But for now, I am designing a separate Python module for constraining my ice sheet model of use, which is tailored to this database and other parallel processing libraries.\n",
|
|
240
384
|
"\n",
|
|
241
|
-
"The data_generator() function reads the query and 'yield' the dataframes for later use.\n",
|
|
385
|
+
"The data_generator() function reads the query and 'yield' the dataframes for later use. It uses h5py to read all the data efficiently, and creates pandas dataframes, including all the variables and ages from the query. Columns for IRH DEPTH are named after the age. Basically, it reads the data with h5py as shown above and restructure it as bit, which can be easier to manage layers than with h5py dimensions.\n",
|
|
242
386
|
"Here is a quick example of how this can be used for computing the mean layer depth:"
|
|
243
387
|
]
|
|
244
388
|
},
|
|
@@ -249,7 +393,7 @@
|
|
|
249
393
|
"metadata": {},
|
|
250
394
|
"outputs": [],
|
|
251
395
|
"source": [
|
|
252
|
-
"results = db.query(age=['38100'])\n",
|
|
396
|
+
"results = db.query(age=['37600', '38000', '38100', '38200', '38500'], var='IRH_DEPTH')\n",
|
|
253
397
|
"lazy_dfs = db.data_generator(results)\n",
|
|
254
398
|
"\n",
|
|
255
399
|
"import numpy as np\n",
|
|
@@ -257,7 +401,7 @@
|
|
|
257
401
|
"min_depth = float('inf')\n",
|
|
258
402
|
"max_depth = float('-inf')\n",
|
|
259
403
|
"for df, md in lazy_dfs:\n",
|
|
260
|
-
" depth_values = df['
|
|
404
|
+
" depth_values = df[int(md['age'][0])].values\n",
|
|
261
405
|
" mean_depth_trs.append(np.mean(depth_values))\n",
|
|
262
406
|
" min_depth = min(min_depth, min(depth_values))\n",
|
|
263
407
|
" max_depth = max(max_depth, max(depth_values))\n",
|
|
@@ -276,35 +420,6 @@
|
|
|
276
420
|
"In the for loop, 'df' is an individual dataframe from the database, corresponding to a single layer of a single trace from a single dataset. The 'md' stores the unique metadata from the current 'df'. One can then associate the metadata with the current df, for example:"
|
|
277
421
|
]
|
|
278
422
|
},
|
|
279
|
-
{
|
|
280
|
-
"cell_type": "code",
|
|
281
|
-
"execution_count": null,
|
|
282
|
-
"id": "d0a358b2",
|
|
283
|
-
"metadata": {},
|
|
284
|
-
"outputs": [],
|
|
285
|
-
"source": [
|
|
286
|
-
"results = db.query(dataset='Cavitte_2020', trace_id='DC_LDC_DIVIDE')\n",
|
|
287
|
-
"lazy_dfs = db.data_generator(results)\n",
|
|
288
|
-
"\n",
|
|
289
|
-
"import matplotlib.pyplot as plt\n",
|
|
290
|
-
"# from matplotlib import rc\n",
|
|
291
|
-
"# rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})\n",
|
|
292
|
-
"# rc('text', usetex=True) # Do you use latex?\n",
|
|
293
|
-
"\n",
|
|
294
|
-
"for df, md in lazy_dfs:\n",
|
|
295
|
-
" if md['age'] is not None:\n",
|
|
296
|
-
" plt.plot(df.distance/1000, df['IRHDepth'], label=md['age'])\n",
|
|
297
|
-
" if md['var'] == 'IceThk':\n",
|
|
298
|
-
" plt.plot(df.distance/1000, df['IceThk'], linewidth=2, color='k', label='Bedrock')\n",
|
|
299
|
-
"\n",
|
|
300
|
-
"plt.legend(ncol=2)\n",
|
|
301
|
-
"plt.xlabel('Distance (km)')\n",
|
|
302
|
-
"plt.ylabel('Depth (m)')\n",
|
|
303
|
-
"plt.ylim(4000, 0)\n",
|
|
304
|
-
"plt.title('Isochronal structure along DC_LDC_DIVIDE transect')\n",
|
|
305
|
-
"plt.show()"
|
|
306
|
-
]
|
|
307
|
-
},
|
|
308
423
|
{
|
|
309
424
|
"cell_type": "markdown",
|
|
310
425
|
"id": "1051a179",
|
|
@@ -312,7 +427,7 @@
|
|
|
312
427
|
"source": [
|
|
313
428
|
"### Downscale the data\n",
|
|
314
429
|
"\n",
|
|
315
|
-
"The
|
|
430
|
+
"The downsampling_factor argument in the data_generator reduces the size of the generated data by n times. This is useful when dealing with large data where the downscaling has a neglectable influence on the results.\n",
|
|
316
431
|
"Another solution, probably more straightforward, is the downsample_distance option, which allows to provide a distance in meters by which the data should be average along the transects:"
|
|
317
432
|
]
|
|
318
433
|
},
|
|
@@ -325,19 +440,19 @@
|
|
|
325
440
|
"source": [
|
|
326
441
|
"import matplotlib.pyplot as plt\n",
|
|
327
442
|
"\n",
|
|
328
|
-
"results = db.query(dataset='Cavitte_2020', age='
|
|
443
|
+
"results = db.query(dataset='Cavitte_2020', age='277900', flight_id='DC_LDC_DIVIDE')\n",
|
|
329
444
|
"original = db.data_generator(results)\n",
|
|
330
|
-
"downscale_10 = db.data_generator(results,
|
|
331
|
-
"downsampled_by_distance = db.data_generator(results, downsample_distance=5000)\n",
|
|
445
|
+
"downscale_10 = db.data_generator(results, downsampling_factor=100)\n",
|
|
446
|
+
"# downsampled_by_distance = db.data_generator(results, downsample_distance=5000)\n",
|
|
332
447
|
"\n",
|
|
333
|
-
"list = [original, downscale_10
|
|
334
|
-
"labels = ['original', 'downscale 100'
|
|
448
|
+
"list = [original, downscale_10] #, downsampled_by_distance]\n",
|
|
449
|
+
"labels = ['original', 'downscale 100'] #, 'downsample 5km']\n",
|
|
335
450
|
"\n",
|
|
336
451
|
"for i, lazy_dfs in enumerate(list):\n",
|
|
337
452
|
" for df, md in lazy_dfs:\n",
|
|
338
|
-
" plt.plot(df.
|
|
453
|
+
" plt.plot(df.Distance, df[277900],label=labels[i], linestyle='--')\n",
|
|
339
454
|
"\n",
|
|
340
|
-
"plt.ylim(
|
|
455
|
+
"plt.ylim(2600, 1800)\n",
|
|
341
456
|
"plt.xlabel('Distance along DC_LDC_DIVIDE (km)')\n",
|
|
342
457
|
"plt.ylabel('Depth (m)')\n",
|
|
343
458
|
"plt.legend()\n",
|
|
@@ -363,7 +478,7 @@
|
|
|
363
478
|
"metadata": {},
|
|
364
479
|
"outputs": [],
|
|
365
480
|
"source": [
|
|
366
|
-
"db.query(var='
|
|
481
|
+
"db.query(var='IRH_NUM')\n",
|
|
367
482
|
"# db.plot.var() # This is equivalent to the overview plot above. Note that without downscaling it is very heavy to plot.\n",
|
|
368
483
|
"\n",
|
|
369
484
|
"import numpy as np\n",
|
|
@@ -371,7 +486,7 @@
|
|
|
371
486
|
"min_density = float('inf')\n",
|
|
372
487
|
"max_density = float('-inf')\n",
|
|
373
488
|
"for df, md in db.data_generator(): # without explicitly passing results, it uses the last query.\n",
|
|
374
|
-
" density_values = df['
|
|
489
|
+
" density_values = df['IRH_NUM']\n",
|
|
375
490
|
" mean_density_trs.append(np.mean(density_values))\n",
|
|
376
491
|
" min_density = min(min_density, min(density_values))\n",
|
|
377
492
|
" max_density = max(max_density, max(density_values))\n",
|
|
@@ -383,13 +498,21 @@
|
|
|
383
498
|
],
|
|
384
499
|
"metadata": {
|
|
385
500
|
"kernelspec": {
|
|
386
|
-
"display_name": "
|
|
501
|
+
"display_name": "geo",
|
|
387
502
|
"language": "python",
|
|
388
503
|
"name": "python3"
|
|
389
504
|
},
|
|
390
505
|
"language_info": {
|
|
506
|
+
"codemirror_mode": {
|
|
507
|
+
"name": "ipython",
|
|
508
|
+
"version": 3
|
|
509
|
+
},
|
|
510
|
+
"file_extension": ".py",
|
|
511
|
+
"mimetype": "text/x-python",
|
|
391
512
|
"name": "python",
|
|
392
|
-
"
|
|
513
|
+
"nbconvert_exporter": "python",
|
|
514
|
+
"pygments_lexer": "ipython3",
|
|
515
|
+
"version": "3.13.9"
|
|
393
516
|
}
|
|
394
517
|
},
|
|
395
518
|
"nbformat": 4,
|
anta_database-0.3.3/ROADMAP.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Roadmap
|
|
2
|
-
|
|
3
|
-
Here is a todo list of features that we want to include in the AntADatabase.
|
|
4
|
-
|
|
5
|
-
## Important
|
|
6
|
-
- [ ] Implement HDF5 format (In process, for next release)
|
|
7
|
-
- [ ] Filter by radar system
|
|
8
|
-
- [ ] Create shapefiles, e.g. for QAntarctica (In process)
|
|
9
|
-
|
|
10
|
-
## To discuss
|
|
11
|
-
- [ ] A netCDF version
|
|
12
|
-
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|