forked from pinguinonice/sarscapepy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_decomposition_and_animate_two_LOS.py
More file actions
65 lines (46 loc) · 2.2 KB
/
Copy pathexample_decomposition_and_animate_two_LOS.py
File metadata and controls
65 lines (46 loc) · 2.2 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 17 14:02:53 2020
@author: philipp
"""
from sarscapepy import shape2grid, read_file,interpolateTemporal,animateGrid,decomposeTwoOrbits
# read file
#path_asc= input('Enter Shape file name please : ')
# PSI
path_asc= 'D:/Philipp/5-Projects/STINGS/Idrija/Idrija II/PS_S44A_II/PSI_PS_processing/geocoding/PSI_PS_60_0.shp'
path_dsc= 'D:/Philipp/5-Projects/STINGS/Idrija/Idrija II/PS_S22D_II/PSI_PS_processing/geocoding/PSI_PS_60_0.shp'
# # SBAS
# path_asc= r'D:\Philipp\5-Projects\STINGS\Idrija\Idrija II\SB_S44A_III\SBAS_SBAS_processing\inversion\vector\SI_v50d0_h50d0_c0d6_VD_0.shp'
# path_dsc= r'D:\Philipp\5-Projects\STINGS\Idrija\Idrija II\SB_S22D_II\SBAS_SBAS_processing\inversion\vector\SI_v50d0_h50d0_c0d6_VD_0.shp'
#read header and drop last coloumn!
asc=read_file(path_asc)
dsc=read_file(path_dsc)
#interpolate to grid
LonMin=14.01
LonMax=14.05
LatMin=45.99
LatMax=46.02
grid_asc=shape2grid(dataFrame=asc, values=None, gridSize=1/3600, LonMin=LonMin,LonMax=LonMax,LatMin=LatMin,LatMax=LatMax, method='linear')
grid_dsc=shape2grid(dataFrame=dsc, values=None, gridSize=1/3600, LonMin=LonMin,LonMax=LonMax,LatMin=LatMin,LatMax=LatMax, method='linear')
# temporal resample
timeStart = '20180103'
timeEnd ='20190823'
timeStepDays=10 #days
kind= 'cubic' #‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’
grid_asc =interpolateTemporal(grid_asc, timeStart, timeEnd, timeStepDays, kind =kind)
grid_dsc =interpolateTemporal(grid_dsc, timeStart, timeEnd, timeStepDays, kind =kind)
# decompose all D_XXXXXX
suffix='_vert'
DateStrigns=[key for key in grid_asc.keys() if (('D_' in key) and (suffix not in key) and ('org' not in key)) ]
for DateStrign in DateStrigns:
grid_asc, grid_dsc=decomposeTwoOrbits(grid_asc, grid_dsc, layer_name=DateStrign)
# animate and save vertical
base_path="basemap/Idrija_14.tif"
out_path="output/animation_vertPSI.gif"
clim=(-50,50)
animateGrid(grid_asc,clim,out_path,base_path=base_path,suffix='_vert')
# animate and save horizontal
base_path="basemap/Idrija_14.tif"
out_path="output/animation_eastPSI.gif"
clim=(-50,50)
animateGrid(grid_asc,clim,out_path,base_path=base_path,suffix='_east')