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
=np
.array(svm
['Z'])*tscale
+time_scale_num
[0]
23 #Z=np.reshape(zn,zz.shape,'F')
25 print 'Computing the contours...'
26 # Granules numeric times
27 time_num_granules
= svm
['time_num_granules'][0]
28 data
= get_contour_verts(xx
, yy
, zz
, time_num_granules
, contour_dt_hours
=6, contour_dt_init
=24, contour_dt_final
=12)
30 print 'Creating the KML file...'
31 # Creating the KML file
32 contour2kml(data
,'perimeters_svm.kml')
34 print 'perimeters_svm.kml generated'