2 from scipy
.io
import loadmat
3 from contline
import get_contour_verts
4 from contour2kml
import contour2kml
8 matlab_file
= 'svm.mat'
9 if os
.path
.isfile(matlab_file
) and os
.access(matlab_file
,os
.R_OK
):
10 print 'Loading the data...'
11 svm
=loadmat('svm.mat')
13 print 'Error: file %s not exist or not readable' % matlab_file
16 # Reading the variables in the file
17 xx
=np
.array(svm
['fxlon'])
18 yy
=np
.array(svm
['fxlat'])
19 tscale
=svm
['tscale'][0]
20 time_scale_num
=svm
['time_scale_num'][0]
21 zz
=svm
['Z']*tscale
+time_scale_num
[0]
23 print 'Computing the contours...'
24 # Granules numeric times
25 time_num_granules
= svm
['time_num_granules'][0]
26 data
= get_contour_verts(xx
, yy
, zz
, time_num_granules
, contour_dt_hours
=6, contour_dt_init
=6, contour_dt_final
=6)
28 print 'Creating the KML file...'
29 # Creating the KML file
30 contour2kml(data
,'perimeters_svm.kml')
32 print 'perimeters_svm.kml generated'