Ejemplo n.º 1
0
    def targetNAIP(self):
        infoNAIP = {}
        startT, endT = self.dataloader.getTime('01-01-2018', '01-01-2020')

        listImages = stippy.list_node_images(self.host_addr,
                                             album=self.album,
                                             geocode='9q',
                                             recurse=True,
                                             platform='NAIP',
                                             source='filled',
                                             start_timestamp=startT,
                                             end_timestamp=endT,
                                             min_pixel_coverage=1.0)
        count = 0

        for (node, image) in listImages:
            for p in image.files:
                if p.path.endswith('-0.tif'):
                    g = image.geocode
                    count += 1
                    if g not in infoNAIP:
                        infoNAIP[g] = np.array([[image.timestamp, p.path]],
                                               dtype=np.dtype(object))
                    else:
                        paths = infoNAIP.get(g)
                        paths = np.concatenate(
                            (paths,
                             np.array([[image.timestamp, p.path]],
                                      dtype=np.dtype(object))))
                        infoNAIP[g] = paths
        return infoNAIP
Ejemplo n.º 2
0
    def getModisTileAtGivenTime(self):
        startT, endT = self.getTime(self.startT, self.endT)
        metaModis = {}

        for g in list(self.train_geohashes):

            listImages = stippy.list_node_images(self.host_addr,
                                                 album=self.album,
                                                 geocode=g,
                                                 recurse=False,
                                                 platform='MODIS',
                                                 start_timestamp=startT,
                                                 end_timestamp=endT)
            itr_time = self.getSentiT(self.train_geohashes.get(g)[:, 0])
            try:
                (node, b_image) = listImages.__next__()
                t = next(itr_time)
                while True:
                    if (abs(t - b_image.timestamp) <
                            86400) and g == b_image.geocode:
                        for p in b_image.files:
                            if p.path.endswith('-1.tif'):
                                pathf = p.path
                                metaModis[g + "_" + str(t)] = pathf
                            (_, b_image) = listImages.__next__()
                            t = next(itr_time)
                    elif t < b_image.timestamp:
                        t = next(itr_time)
                    elif t > b_image.timestamp:
                        (_, b_image) = listImages.__next__()
            except StopIteration:
                pass
        return metaModis
Ejemplo n.º 3
0
    def getModisBetweenTwoSentinel(self, geo, startT, endT):
        metaModis = []
        listImages = stippy.list_node_images(self.host_addr,
                                             album=self.album,
                                             geocode=geo,
                                             recurse=False,
                                             platform='MODIS',
                                             start_timestamp=startT,
                                             end_timestamp=endT)
        count = 0

        for (node, image) in listImages:
            for p in image.files:
                if p.path.endswith('-1.tif'):
                    metaModis.append(p.path)
                    count += 1
            if count > 5:
                break
        return self.accessFiles(metaModis, isSentinel=False)
Ejemplo n.º 4
0
                        '--ip-address',
                        type=str,
                        help='stip host ip address',
                        default='127.0.0.1')
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        help='stip host rpc port',
                        default='15606')
    parser.add_argument('-t',
                        '--thread-count',
                        type=int,
                        help='worker thread count',
                        default='8')

    args = parser.parse_args()

    # compile list of processing images
    host_addr = args.ip_address + ':' + str(args.port)
    images = []
    for (node, image) in stippy.list_node_images(host_addr,
                                                 args.album,
                                                 min_pixel_coverage=0.9,
                                                 max_cloud_coverage=0.2,
                                                 platform='Sentinel-2'):
        images.append(image)

    # process images
    with multiprocessing.Pool(args.thread_count) as pool:
        pool.map(process, images)
Ejemplo n.º 5
0
    parser.add_argument('album', type=str, help='stip album')
    parser.add_argument('-i',
                        '--ip-address',
                        type=str,
                        help='stip host ip address',
                        default='127.0.0.1')
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        help='stip host rpc port',
                        default='15606')
    parser.add_argument('-t',
                        '--thread-count',
                        type=int,
                        help='worker thread count',
                        default='4')

    args = parser.parse_args()

    # compile list of processing images
    host_addr = args.ip_address + ':' + str(args.port)
    images = []
    for (node, image) in stippy.list_node_images(host_addr,
                                                 args.album,
                                                 platform='Sentinel-2'):
        images.append(image)

    # process images
    with multiprocessing.Pool(args.thread_count) as pool:
        pool.map(process, images)
Ejemplo n.º 6
0
    parser.add_argument('album', type=str, help='stip album')
    parser.add_argument('-i',
                        '--ip-address',
                        type=str,
                        help='stip host ip address',
                        default='127.0.0.1')
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        help='stip host rpc port',
                        default='15606')
    parser.add_argument('-t',
                        '--thread-count',
                        type=int,
                        help='worker thread count',
                        default='8')

    args = parser.parse_args()

    # compile list of processing images
    host_addr = args.ip_address + ':' + str(args.port)
    images = []
    for (node, image) in stippy.list_node_images(host_addr,
                                                 args.album,
                                                 platform='NLCD'):
        images.append((image.files[0].path, image.geocode))

    # process images
    with multiprocessing.Pool(args.thread_count) as pool:
        pool.map(process, images)
Ejemplo n.º 7
0

def process_pair(a_image, b_image):
    print('  ' + a_image.geocode + ' ' + str(a_image.timestamp) + ' ' +
          str(b_image.timestamp))


if __name__ == '__main__':
    host_addr = '127.0.0.1:15606'

    # print nodes
    nodes = stippy.list_nodes(host_addr)
    for node in nodes:
        # initailize image iterators
        a_iter = stippy.list_node_images(node.rpcAddr,
                                         'test',
                                         platform='MODIS')
        b_iter = stippy.list_node_images(node.rpcAddr,
                                         'test',
                                         platform='Sentinel-2')

        try:
            # initialize images
            (_, a_image) = a_iter.__next__()
            (_, b_image) = b_iter.__next__()

            while True:
                if abs(a_image.timestamp - b_image.timestamp) < 86400:
                    if a_image.geocode == b_image.geocode:
                        process_pair(a_image, b_image)
Ejemplo n.º 8
0
        print('    ' + str(file.subdataset))

if __name__ == '__main__':
    host_addr = '127.0.0.1:15606'

    # print Sentinel-2 images with > 90% pixel coverage
    #   and < 10% cloud coverage
    print('-----NODE IMAGES 1-----')
    stip_iter = stippy.list_images(host_addr, 'test', platform='Sentinel-2', 
        min_pixel_coverage=0.9, max_cloud_coverage=0.1)

    for (node, image) in stip_iter:
        display(node, image)

    # print images from only the queried 
    #   node for all geohashes starting with '9q'
    print('-----NODE IMAGES 2-----')
    stip_iter = stippy.list_node_images(host_addr,
        'test', recurse=True, geocode='9q')

    for (node, image) in stip_iter:
        display(node, image)

    # print all images from 2018 
    print('-----NODE IMAGES 3-----')
    stip_iter = stippy.list_images(host_addr, 'test',
        start_timestamp=1514764800, end_timestamp=1546300800)

    for (node, image) in stip_iter:
        display(node, image)