refactor: reorganize project structure by moving core modules and update import paths in API server
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import new_import_ODC
|
||||
importlib = __import__('importlib')
|
||||
importlib.reload(new_import_ODC)
|
||||
from new_import_ODC import *
|
||||
import numpy as np
|
||||
|
||||
date_range = ("2022-09-01", "2022-10-01")
|
||||
longtitude_range = (105.86, 105.94)
|
||||
latitude_range = (9.65, 9.69)
|
||||
coordinates = (longtitude_range, latitude_range)
|
||||
|
||||
print("Loading S2...")
|
||||
data = load_data(None, date_range, longtitude_range, latitude_range)
|
||||
result = mask_clean(data)
|
||||
ds1 = calculate_indices(result, index="NDVI", satellite_mission="s2")
|
||||
ndvi = ds1["NDVI"]
|
||||
time_split = [
|
||||
slice("2022-09-01", "2023-01-01"),
|
||||
slice("2023-01-01", "2023-05-01"),
|
||||
slice("2023-05-01", "2023-07-01"),
|
||||
slice("2023-07-01", "2022-10-01"),
|
||||
]
|
||||
fill_nan_ndvi = fill_nan(ndvi, time_split)
|
||||
average_ndvi = fill_nan_ndvi.resample(time="1M").mean().compute()
|
||||
|
||||
print("Loading S1...")
|
||||
dsvh, dsvv = load_data_sen1(None, date_range, coordinates)
|
||||
average_vv = calculate_average(dsvv, time_pattern='1M')
|
||||
average_vh = calculate_average(dsvh, time_pattern='1M')
|
||||
|
||||
train = load_train_data("train/ST_training_data_updated_1130points_new.shp")
|
||||
point = train.iloc[0]
|
||||
|
||||
ndvi_val = average_ndvi.sel(x=point.geometry.x, y=point.geometry.y, method='nearest').values
|
||||
vh_val = average_vh.sel(x=point.geometry.x, y=point.geometry.y, method='nearest').values
|
||||
vv_val = average_vv.sel(x=point.geometry.x, y=point.geometry.y, method='nearest').values
|
||||
|
||||
print("NDVI shape:", ndvi_val.shape, "ndim:", ndvi_val.ndim)
|
||||
print("VH shape:", vh_val.shape, "ndim:", vh_val.ndim)
|
||||
print("VV shape:", vv_val.shape, "ndim:", vv_val.ndim)
|
||||
|
||||
Reference in New Issue
Block a user