forked from initze/landsattrend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_lake_analysis.py
45 lines (38 loc) · 1.67 KB
/
run_lake_analysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from landsattrend.lake_analysis import LakeMaker
import os
os.environ['GDAL_PATH'] = r'C:\Users\initze\AppData\Local\Continuum\anaconda3\envs\landsattrend2\Scripts'
os.environ['GDAL_BIN'] = r'C:\Users\initze\AppData\Local\Continuum\anaconda3\envs\landsattrend2\Library\bin'
PROCESSING_DIR = os.getcwd()
DEM_LOCATION = os.path.join(PROCESSING_DIR, r'aux_data', 'dem', 'DEM.vrt')
FOREST_LOCATION = os.path.join(PROCESSING_DIR, r'aux_data', 'forestfire', 'forestfire.vrt')
tiles = ['32_8', '32_9', '32_10', '32_11']
zone = 'Z056-Kolyma'
directory_location = os.path.join(PROCESSING_DIR, 'process')
site_name = 'Z056-Kolyma'
CLASS_MODEL = os.path.join(PROCESSING_DIR, 'models', '20180831_RF_4class_noDEM_973samples_py3_v0.z')
LAKE_FILTER_MODEL = os.path.join(PROCESSING_DIR, 'models', '20180820_lakefilter_12039samples_py3.z')
def main():
l = LakeMaker(zone, os.path.join(directory_location, site_name), classperiod='1999-2019')
print("\nStart Classification")
l.classify(CLASS_MODEL, tiles)
# TODO: continue here
print("\nPreparing additional Data")
l.prepare_aux_data(DEM_LOCATION, FOREST_LOCATION)
print("\nCreating Masks")
l.make_masks()
print("\nCalculating Stats")
l.make_stats()
print("\nSaving DataFrame to Disk")
l.save_df()
print("\nFiltering non-lake objects")
l.filter_data(LAKE_FILTER_MODEL)
print("\nSaving DataFrame to Disk")
l.save_filtered_data()
print("\nTransforming data to metric values")
l.finalize_calculations()
print("\nSaving DataFrame to Disk")
l.save_results()
print("\nSaving ResultGrid at 3km resolution")
l.export_gridded_results([100, 250, 500])
if __name__ == "__main__":
main()