How to use the ulmo.usgs.eros function in ulmo

To help you get started, we’ve selected a few ulmo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erdc / quest / dsl / services / usgs_eros.py View on Github external
if locations is not None:
            try:
                with open(self.cache_file) as f:
                    metadata = json.load(f)
            except:
                metadata = self.get_locations()

            selected = [feature for feature in metadata['features'] if feature['id'] in locations]
            return FeatureCollection(selected)

        if bounding_box is None:
            bounding_box = self.metadata['bounding_boxes'][0] 

        bbox = [float(p) for p in bounding_box]

        locations = eros.get_raster_availability(self.product_key, bbox)

        if os.path.exists(self.cache_file):
            existing = json.load(open(self.cache_file))
            locations = util.append_features(existing, locations)

        with open(self.cache_file, 'w') as f:
            dump(locations, f)

        return locations