process satellite data from path
[JPSSData.git] / svm2gis.py
blob5aed3656e52fc4bf2560958453bbff10d2ffc5f4
1 from wrf2geotiff import readncproj, readllproj, create_geotiff
2 from contline import get_contour_verts
3 from contour2shp import contour2shp
4 from scipy.io import loadmat
5 import numpy as np
7 time = ['2019-08-01_00:00:00']
9 svm = loadmat('svm.mat')
11 if 'fxlon_interp' in svm:
12 fxlon = svm['fxlon_interp']
13 fxlat = svm['fxlat_interp']
14 tign_g = svm['tign_g_interp']
15 else:
16 fxlon = svm['fxlon']
17 fxlat = svm['fxlat']
18 tign_g = svm['tign_g']
20 tign_g[tign_g==tign_g.max()] = np.nan
22 print('Creating tign_g GeoTIFF file...')
23 sname = 'TIGN_G'
24 data = [tign_g]
25 ndv = -9999.0
26 csr,geotransform = readllproj(fxlon,fxlat)
27 create_geotiff(sname, data, ndv, geotransform, csr, time)
29 print('Computing the contours...')
30 time_num_interval = svm['time_num'][0]
31 time_num_granules = svm['time_num_granules'][0]
32 data = get_contour_verts(fxlon, fxlat, tign_g+time_num_interval[0], time_num_granules, contour_dt_hours=6, contour_dt_init=6, contour_dt_final=6)
34 print('Creating tign_g shape files...')
35 contour2shp(data, '.', geotransform, csr)