Spaces:
Running
on
L4
Running
on
L4
Update helpers/functional.py
Browse files- helpers/functional.py +12 -4
helpers/functional.py
CHANGED
|
@@ -27,15 +27,23 @@ else:
|
|
| 27 |
DATASET_NAME = 'Major-TOM/Core-S1RTC'
|
| 28 |
rtc_meta_path = 'https://huggingface.co/datasets/{}/resolve/main/metadata.parquet'.format(DATASET_NAME)
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
grid = Grid(10, latitude_range=(-90,90), longitude_range=(-180,180))
|
| 31 |
l2a_df = pd.read_parquet(l2a_meta_path)
|
| 32 |
l1c_df = pd.read_parquet(l1c_meta_path)
|
| 33 |
rtc_df = pd.read_parquet(rtc_meta_path)
|
|
|
|
| 34 |
|
| 35 |
df_dict = {
|
| 36 |
-
'
|
| 37 |
-
'
|
| 38 |
-
'
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
def pretty_date(input):
|
|
@@ -84,7 +92,7 @@ def cell2row(grid_string, meta_df, return_row = False):
|
|
| 84 |
else:
|
| 85 |
return None
|
| 86 |
|
| 87 |
-
def map_to_image(map, return_centre=False, return_gridcell=False, return_timestamp=False, source='
|
| 88 |
|
| 89 |
try:
|
| 90 |
# 1. get bounds
|
|
|
|
| 27 |
DATASET_NAME = 'Major-TOM/Core-S1RTC'
|
| 28 |
rtc_meta_path = 'https://huggingface.co/datasets/{}/resolve/main/metadata.parquet'.format(DATASET_NAME)
|
| 29 |
|
| 30 |
+
if os.path.isfile('helpers/dem_metadata.parquet'):
|
| 31 |
+
dem_meta_path = 'helpers/dem_metadata.parquet'
|
| 32 |
+
else:
|
| 33 |
+
DATASET_NAME = 'Major-TOM/Core-DEM'
|
| 34 |
+
dem_meta_path = 'https://huggingface.co/datasets/{}/resolve/main/metadata.parquet'.format(DATASET_NAME)
|
| 35 |
+
|
| 36 |
grid = Grid(10, latitude_range=(-90,90), longitude_range=(-180,180))
|
| 37 |
l2a_df = pd.read_parquet(l2a_meta_path)
|
| 38 |
l1c_df = pd.read_parquet(l1c_meta_path)
|
| 39 |
rtc_df = pd.read_parquet(rtc_meta_path)
|
| 40 |
+
dem_df = pd.read_parquet(dem_meta_path)
|
| 41 |
|
| 42 |
df_dict = {
|
| 43 |
+
'Sentinel-2 L2A' : l2a_df,
|
| 44 |
+
'Sentinel-2 L1C' : l1c_df,
|
| 45 |
+
'Sentinel-1 RTC' : rtc_df,
|
| 46 |
+
'COP-DEM' : dem_df
|
| 47 |
}
|
| 48 |
|
| 49 |
def pretty_date(input):
|
|
|
|
| 92 |
else:
|
| 93 |
return None
|
| 94 |
|
| 95 |
+
def map_to_image(map, return_centre=False, return_gridcell=False, return_timestamp=False, source='Sentinel-2 L2A'):
|
| 96 |
|
| 97 |
try:
|
| 98 |
# 1. get bounds
|