anta-database 0.3.3__tar.gz → 0.3.5__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.5}/PKG-INFO +7 -7
- {anta_database-0.3.3 → anta_database-0.3.5}/README.md +6 -6
- anta_database-0.3.5/ROADMAP.md +12 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/compiling/compile.py +23 -3
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/database/database.py +25 -107
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/plotting/plotting.py +57 -60
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database.egg-info/PKG-INFO +7 -7
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database.egg-info/SOURCES.txt +1 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/_config.yml +1 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/_toc.yml +1 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/contribute.md +2 -0
- anta_database-0.3.5/book/figures/Overview_all.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/intro.md +18 -12
- anta_database-0.3.5/book/pism_example.ipynb +299 -0
- anta_database-0.3.5/book/quick_start.ipynb +534 -0
- 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/book/quick_start.ipynb +0 -397
- {anta_database-0.3.3 → anta_database-0.3.5}/.github/workflows/deploy.yml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/.github/workflows/release.yml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/.gitignore +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/LICENSE +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/anta_database.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/compiling/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/compiling/reconnect.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/ANT_Basins_IMBIE2_v1.6.cpg +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/ANT_Basins_IMBIE2_v1.6.dbf +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/ANT_Basins_IMBIE2_v1.6.prj +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/ANT_Basins_IMBIE2_v1.6.shp +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/ANT_Basins_IMBIE2_v1.6.shx +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/GL.pkl +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/centeroid_coords_basins.cpg +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/centeroid_coords_basins.dbf +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/centeroid_coords_basins.prj +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/centeroid_coords_basins.shp +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/centeroid_coords_basins.shx +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/data/site-coords.pkl +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/database/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/figures/AntA_38ka.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/indexing/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/indexing/index_database.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database/plotting/__init__.py +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database.egg-info/dependency_links.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database.egg-info/requires.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/anta_database.egg-info/top_level.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/advanced.md +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/contact.md +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/logo.png +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/references.bib +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/book/requirements.txt +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/pyproject.toml +0 -0
- {anta_database-0.3.3 → anta_database-0.3.5}/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.5
|
|
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,8 +715,9 @@ 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
|
+
fraction_depth: Optional[bool] = False,
|
|
720
721
|
) -> Generator[Tuple[pd.DataFrame, Dict]]:
|
|
721
722
|
"""
|
|
722
723
|
Generates xarray Datasets from HDF5 files, one at a time, with lazy loading.
|
|
@@ -744,35 +745,51 @@ class Database:
|
|
|
744
745
|
file_paths = self._get_file_paths_from_metadata(metadata=md)
|
|
745
746
|
file_paths = np.unique(file_paths) # Be carefull as many pointers point to the same file
|
|
746
747
|
|
|
748
|
+
if disable_tqdm or self._disable_tqdm:
|
|
749
|
+
disable_tqdm = True
|
|
750
|
+
|
|
747
751
|
for file_path in tqdm(file_paths, desc='Generating dataframes', total=len(file_paths), unit='file', disable=disable_tqdm):
|
|
748
752
|
full_path = os.path.join(data_dir, file_path)
|
|
749
753
|
file_md = self._get_file_metadata(file_path)
|
|
750
754
|
ds = h5py.File(full_path, 'r')
|
|
751
|
-
df = pd.DataFrame({'PSX': ds['PSX'][::
|
|
752
|
-
'PSY': ds['PSY'][::
|
|
755
|
+
df = pd.DataFrame({'PSX': ds['PSX'][::downsampling_factor],
|
|
756
|
+
'PSY': ds['PSY'][::downsampling_factor]})
|
|
753
757
|
|
|
754
758
|
if 'Distance' in ds.keys():
|
|
755
|
-
df['Distance'] = ds['Distance'][::
|
|
759
|
+
df['Distance'] = ds['Distance'][::downsampling_factor]
|
|
756
760
|
|
|
761
|
+
var_impl = []
|
|
762
|
+
age_impl = []
|
|
757
763
|
for var in md['var']:
|
|
758
764
|
if var == 'IRH_DEPTH':
|
|
765
|
+
var_impl.append(var)
|
|
759
766
|
for age in md['age']:
|
|
760
767
|
irh_values = ds['IRH_AGE'][:]
|
|
761
768
|
irh_index = np.where(irh_values == int(age))[0]
|
|
762
769
|
if len(irh_index) == 0:
|
|
763
770
|
continue
|
|
764
771
|
irh_index = irh_index[0]
|
|
772
|
+
age_impl.append(age)
|
|
765
773
|
|
|
766
|
-
df[
|
|
774
|
+
df[age] = ds[var][::downsampling_factor, irh_index]
|
|
775
|
+
if fraction_depth:
|
|
776
|
+
if 'ICE_THK' in ds.keys():
|
|
777
|
+
df[age] *= 100/ds['ICE_THK'][::downsampling_factor]
|
|
778
|
+
else:
|
|
779
|
+
df[age] = np.nan
|
|
780
|
+
# print(f'WARNING: flight line {file_md['flight_id']} in {file_md['dataset']} does not have ICE_THK, cannot compute fraction depth, will return NaN')
|
|
767
781
|
|
|
768
782
|
else:
|
|
769
783
|
if var in ds.keys():
|
|
770
|
-
|
|
784
|
+
var_impl.append(var)
|
|
785
|
+
df[var] = ds[var][::downsampling_factor]
|
|
771
786
|
|
|
787
|
+
if 0 < len(age_impl) <= 1:
|
|
788
|
+
age_impl = list(age_impl)[0]
|
|
772
789
|
metadata = {
|
|
773
790
|
'dataset': file_md['dataset'],
|
|
774
|
-
'var':
|
|
775
|
-
'age':
|
|
791
|
+
'var': var_impl,
|
|
792
|
+
'age': age_impl,
|
|
776
793
|
'flight_id': file_md['flight_id'],
|
|
777
794
|
'institute': file_md['institute'],
|
|
778
795
|
'project': file_md['project'],
|
|
@@ -789,105 +806,6 @@ class Database:
|
|
|
789
806
|
|
|
790
807
|
yield df, metadata
|
|
791
808
|
|
|
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
809
|
@property
|
|
892
810
|
def plot(self):
|
|
893
811
|
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,8 @@ 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
|
+
fraction_depth: Optional[bool] = False,
|
|
180
181
|
title: Optional[str] = None,
|
|
181
182
|
xlim: Optional[tuple] = (None, None),
|
|
182
183
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -196,7 +197,8 @@ class Plotting:
|
|
|
196
197
|
self._base_plot(
|
|
197
198
|
color_by='var',
|
|
198
199
|
metadata=metadata,
|
|
199
|
-
|
|
200
|
+
downsampling_factor=downsampling_factor,
|
|
201
|
+
fraction_depth=fraction_depth,
|
|
200
202
|
title=title,
|
|
201
203
|
xlim=xlim,
|
|
202
204
|
ylim=ylim,
|
|
@@ -215,7 +217,7 @@ class Plotting:
|
|
|
215
217
|
self,
|
|
216
218
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
217
219
|
elevation: Optional[bool] = False,
|
|
218
|
-
|
|
220
|
+
downsampling_factor: Optional[int] = None,
|
|
219
221
|
title: Optional[str] = None,
|
|
220
222
|
xlim: Optional[tuple] = (None, None),
|
|
221
223
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -234,7 +236,7 @@ class Plotting:
|
|
|
234
236
|
color_by='transect_1D',
|
|
235
237
|
elevation=elevation,
|
|
236
238
|
metadata=metadata,
|
|
237
|
-
|
|
239
|
+
downsampling_factor=downsampling_factor,
|
|
238
240
|
title=title,
|
|
239
241
|
xlim=xlim,
|
|
240
242
|
ylim=ylim,
|
|
@@ -261,7 +263,8 @@ class Plotting:
|
|
|
261
263
|
self,
|
|
262
264
|
metadata: Union[None, Dict, 'MetadataResult'] = None,
|
|
263
265
|
elevation: Optional[bool] = False,
|
|
264
|
-
|
|
266
|
+
fraction_depth: Optional[bool] = False,
|
|
267
|
+
downsampling_factor: Optional[int] = None,
|
|
265
268
|
title: Optional[str] = None,
|
|
266
269
|
xlim: Optional[tuple] = (None, None),
|
|
267
270
|
ylim: Optional[tuple] = (None, None),
|
|
@@ -314,8 +317,8 @@ class Plotting:
|
|
|
314
317
|
if color_by == 'dataset':
|
|
315
318
|
if not title:
|
|
316
319
|
title = f'AntADatabase by datasets'
|
|
317
|
-
if
|
|
318
|
-
|
|
320
|
+
if downsampling_factor == None:
|
|
321
|
+
downsampling_factor = 1
|
|
319
322
|
datasets = list(metadata['dataset'])
|
|
320
323
|
bedmap_entries = {'BEDMAP1', 'BEDMAP2', 'BEDMAP3'}
|
|
321
324
|
bedmap_colors = {
|
|
@@ -341,8 +344,8 @@ class Plotting:
|
|
|
341
344
|
for f in file_paths:
|
|
342
345
|
full_path = os.path.join(self._db._db_dir, f)
|
|
343
346
|
with h5py.File(full_path, 'r') as ds:
|
|
344
|
-
all_x.append(ds['PSX'][::
|
|
345
|
-
all_y.append(ds['PSY'][::
|
|
347
|
+
all_x.append(ds['PSX'][::downsampling_factor])
|
|
348
|
+
all_y.append(ds['PSY'][::downsampling_factor])
|
|
346
349
|
df = pd.DataFrame({'PSX': np.concatenate(all_x),
|
|
347
350
|
'PSY': np.concatenate(all_y)})
|
|
348
351
|
plt.scatter(df['PSX']/1000, df['PSY']/1000, color=colors[dataset], s=marker_size, zorder=zorder, linewidths=0)
|
|
@@ -359,8 +362,8 @@ class Plotting:
|
|
|
359
362
|
if color_by == 'institute':
|
|
360
363
|
if not title:
|
|
361
364
|
title = f'AntADatabase by institutes'
|
|
362
|
-
if
|
|
363
|
-
|
|
365
|
+
if downsampling_factor == None:
|
|
366
|
+
downsampling_factor = 1
|
|
364
367
|
institutes = list(metadata['institute'])
|
|
365
368
|
|
|
366
369
|
color_indices = np.linspace(0.1, 0.9, len(institutes))
|
|
@@ -378,8 +381,8 @@ class Plotting:
|
|
|
378
381
|
for f in file_paths:
|
|
379
382
|
full_path = os.path.join(self._db._db_dir, f)
|
|
380
383
|
with h5py.File(full_path, 'r') as ds:
|
|
381
|
-
all_x.append(ds['PSX'][::
|
|
382
|
-
all_y.append(ds['PSY'][::
|
|
384
|
+
all_x.append(ds['PSX'][::downsampling_factor])
|
|
385
|
+
all_y.append(ds['PSY'][::downsampling_factor])
|
|
383
386
|
df = pd.DataFrame({'PSX': np.concatenate(all_x),
|
|
384
387
|
'PSY': np.concatenate(all_y)})
|
|
385
388
|
plt.scatter(df['PSX']/1000, df['PSY']/1000, color=colors[institute], s=marker_size, linewidths=0)
|
|
@@ -402,9 +405,8 @@ class Plotting:
|
|
|
402
405
|
else:
|
|
403
406
|
var = var[0]
|
|
404
407
|
|
|
405
|
-
|
|
406
408
|
all_dfs = []
|
|
407
|
-
for ds, _ in tqdm(self._db.data_generator(metadata,
|
|
409
|
+
for ds, _ in tqdm(self._db.data_generator(metadata, downsampling_factor=downsampling_factor, disable_tqdm=True, fraction_depth=fraction_depth), desc="Plotting", total=total_traces, unit='trace', disable=self._disable_tqdm):
|
|
408
410
|
all_dfs.append(ds)
|
|
409
411
|
df = pd.concat(all_dfs)
|
|
410
412
|
|
|
@@ -448,67 +450,61 @@ class Plotting:
|
|
|
448
450
|
if cmap == None:
|
|
449
451
|
cmap = cmaps.bukavu
|
|
450
452
|
extend = 'both'
|
|
451
|
-
if
|
|
452
|
-
if
|
|
453
|
+
if vmin is None: vmin = -1000
|
|
454
|
+
if vmax is None: vmax = 1000
|
|
453
455
|
if not title:
|
|
454
456
|
title = f'AntADatabase Bed Elevation'
|
|
455
457
|
elif var == 'ICE_THK':
|
|
456
458
|
if cmap == None:
|
|
457
459
|
cmap = cmaps.torch_r
|
|
458
460
|
extend = 'max'
|
|
459
|
-
if
|
|
460
|
-
if
|
|
461
|
+
if vmin is None: vmin = 0
|
|
462
|
+
if vmax is None: vmax = 4000
|
|
461
463
|
if not title:
|
|
462
464
|
title = f'AntADatabase Ice Thickness'
|
|
463
465
|
elif var == 'SURF_ELEV':
|
|
464
466
|
if cmap == None:
|
|
465
|
-
cmap = cmaps.
|
|
467
|
+
cmap = cmaps.ice_r
|
|
466
468
|
extend = 'max'
|
|
467
|
-
if
|
|
468
|
-
if
|
|
469
|
+
if vmin is None: vmin = 1000
|
|
470
|
+
if vmax is None: vmax = 4000
|
|
469
471
|
if not title:
|
|
470
472
|
title = f'AntADatabase Surface Elevation'
|
|
471
473
|
elif var == 'BASAL_UNIT':
|
|
472
474
|
if cmap == None:
|
|
473
475
|
cmap = cmaps.torch_r
|
|
474
476
|
extend = 'both'
|
|
475
|
-
if
|
|
476
|
-
if
|
|
477
|
+
if vmin is None: vmin = 2000
|
|
478
|
+
if vmax is None: vmax = 400
|
|
477
479
|
if not title:
|
|
478
480
|
title = f'AntADatabase Basal Unit'
|
|
479
481
|
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)
|
|
480
482
|
|
|
481
|
-
elif var in ['IRH_DEPTH'
|
|
482
|
-
if
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
483
|
+
elif var in ['IRH_DEPTH']:
|
|
484
|
+
if cmap == None:
|
|
485
|
+
cmap = cmaps.torch_r
|
|
486
|
+
extend = 'both'
|
|
487
|
+
age = list(metadata['age'])
|
|
488
|
+
if not title:
|
|
489
|
+
if fraction_depth:
|
|
490
|
+
title = f'AntADatabase IRH Fraction Depth'
|
|
491
|
+
else:
|
|
489
492
|
title = f'AntADatabase IRH Depth'
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
if cmap == None:
|
|
498
|
-
cmap = cmaps.torch_r
|
|
499
|
-
extend = 'both'
|
|
500
|
-
age = list(metadata['age'])
|
|
501
|
-
if len(age) > 1:
|
|
502
|
-
print('WARNING: Multiple layers provided: ', age,
|
|
503
|
-
'\nSelect a unique age for better results')
|
|
504
|
-
elif len(age) == 0:
|
|
505
|
-
print('No layer provided, please provide a valid age.')
|
|
506
|
-
return
|
|
507
|
-
age = age[0]
|
|
493
|
+
if len(age) > 1:
|
|
494
|
+
print('WARNING: Multiple layers provided: ', age,
|
|
495
|
+
'\nSelect a unique age for better results')
|
|
496
|
+
elif len(age) == 0:
|
|
497
|
+
print('No layer provided, please provide a valid age.')
|
|
498
|
+
return
|
|
499
|
+
if fraction_depth:
|
|
508
500
|
label = r'IRH Fractional Depth [\%]'
|
|
501
|
+
if vmin is None: vmin = 0
|
|
502
|
+
if vmax is None: vmax = 100
|
|
503
|
+
else:
|
|
504
|
+
label = f'IRH Depth [m]'
|
|
509
505
|
|
|
510
506
|
for age in metadata['age']:
|
|
511
|
-
scatter = plt.scatter(df['PSX']/1000, df['PSY']/1000, c=df[
|
|
507
|
+
scatter = plt.scatter(df['PSX']/1000, df['PSY']/1000, c=df[age], cmap=cmap, s=marker_size, vmin=vmin, vmax=vmax, linewidths=0, rasterized=True)
|
|
512
508
|
|
|
513
509
|
if color_by == 'transect_1D':
|
|
514
510
|
flight_id = list(metadata['flight_id'])
|
|
@@ -605,13 +601,14 @@ class Plotting:
|
|
|
605
601
|
all_y.append(ds['PSY'][:])
|
|
606
602
|
df = pd.DataFrame({'PSX': np.concatenate(all_x),
|
|
607
603
|
'PSY': np.concatenate(all_y)})
|
|
608
|
-
plt.scatter(df['PSX'][::
|
|
604
|
+
plt.scatter(df['PSX'][::downsampling_factor]/1000, df['PSY'][::downsampling_factor]/1000, color=colors[flight_id], s=marker_size, linewidths=0)
|
|
609
605
|
|
|
610
606
|
plt.plot([], [], color=colors[flight_id], label=flight_id, linewidth=3)
|
|
611
607
|
ncol = 2 if len(flight_ids) > 40 else 1
|
|
612
608
|
|
|
613
609
|
# --- Format Figure ---
|
|
614
|
-
|
|
610
|
+
if not self._disable_tqdm:
|
|
611
|
+
print('Formatting ...')
|
|
615
612
|
|
|
616
613
|
ax.set_xlim(*xlim)
|
|
617
614
|
ax.set_ylim(*ylim)
|
|
@@ -710,7 +707,7 @@ class Plotting:
|
|
|
710
707
|
site_coords = pd.read_pickle(self._site_coords_path)
|
|
711
708
|
for i in site_coords.index:
|
|
712
709
|
site = site_coords.loc[i]
|
|
713
|
-
ax.scatter(site['x']/1000, site['y']/1000, color='red', s=50, marker='^', edgecolor='black', linewidth=1.5)
|
|
710
|
+
ax.scatter(site['x']/1000, site['y']/1000, color='red', s=50, marker='^', edgecolor='black', linewidth=1.5, zorder=50)
|
|
714
711
|
# --- Save/Show ---
|
|
715
712
|
with self._plot_context():
|
|
716
713
|
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.5
|
|
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
|