예제 #1
0
    def run(self):

        mun_shp_path = self.muns_shps_path + self.cve_muni + '.shp'
        raster_name = utils.date_rasternames(self.dist_raster_path,
                                             self.dates,
                                             dimension=self.dimension)
        utils.crop_raster(mun_shp_path, raster_name, self.cropmun_raster_path)
예제 #2
0
 def requires(self):
     cropmun_raster_path = utils.date_rasternames(self.crop_raster_path,
                                                  self.dates,
                                                  self.dimension,
                                                  self.cve_muni)
     yield CropDistanceRasters(dates=self.dates,
                               cve_muni=self.cve_muni,
                               dimension=self.dimension,
                               cropmun_raster_path=cropmun_raster_path)
예제 #3
0
    def requires(self):

        mun_shp_path = self.muns_shps_path + self.cve_muni + '.shp'
        raster_name = utils.date_rasternames(self.dist_raster_path,
                                             self.dates,
                                             dimension=self.dimension)
        yield MunShape(cve_muni=self.cve_muni, mun_shp_path=mun_shp_path)
        yield DistanceRasters(dates=self.dates,
                              dimension=self.dimension,
                              raster_name=raster_name)
예제 #4
0
 def run(self):
     h_path = utils.date_rasternames(self.clusters_path,
                                     self.dates,
                                     dimension='h',
                                     cve_muni=self.cve_muni,
                                     cutoff=self.cutoff)
     v_path = utils.date_rasternames(self.clusters_path,
                                     self.dates,
                                     dimension='v',
                                     cve_muni=self.cve_muni,
                                     cutoff=self.cutoff)
     h_clust = utils.raster_to_numpy(h_path)
     v_clust = utils.raster_to_numpy(v_path)
     cluster = pu.cluster_join(h_clust, v_clust)
     cluster_path = utils.date_rasternames(self.clusters_path,
                                           self.dates,
                                           cve_muni=self.cve_muni,
                                           cutoff=self.cutoff)
     cluster_u = pu.unify_clusters(cluster)
     pickle.dump(cluster_u, open(cluster_path.replace('.tiff', '.p'), 'wb'))
     utils.write_raster(cluster_u, cluster_path, h_path)
예제 #5
0
    def run(self):

        cropmun_raster_path = utils.date_rasternames(self.crop_raster_path,
                                                     self.dates,
                                                     self.dimension,
                                                     self.cve_muni)
        dist_array = utils.raster_to_numpy(cropmun_raster_path)
        if self.dimension == 'h':
            clust = pu.neighbor_clusters_rows(dist_array, float(self.cutoff))
        elif self.dimension == 'v':
            clust = pu.neighbor_clusters_cols(dist_array, float(self.cutoff))
        utils.write_raster(clust, self.cluster_1d_path, cropmun_raster_path)
예제 #6
0
 def requires(self):
     dims = ['h', 'v']
     for dim in dims:
         cluster_1d_path = utils.date_rasternames(self.clusters_path,
                                                  self.dates,
                                                  dimension=dim,
                                                  cve_muni=self.cve_muni,
                                                  cutoff=self.cutoff)
         yield Clusters1D(dates=self.dates,
                          cve_muni=self.cve_muni,
                          dimension=dim,
                          cutoff=self.cutoff,
                          cluster_1d_path=cluster_1d_path)
예제 #7
0
 def output(self):
     cluster_path = utils.date_rasternames(self.clusters_path,
                                           self.dates,
                                           cve_muni=self.cve_muni,
                                           cutoff=self.cutoff)
     return luigi.LocalTarget(cluster_path)