예제 #1
0
    def test_providers(self) -> None:
        item = self.item.clone()
        cm = item.common_metadata
        analytic = item.assets["analytic"]
        analytic_cm = CommonMetadata(analytic)
        thumbnail = item.assets["thumbnail"]
        thumbnail_cm = CommonMetadata(thumbnail)

        item_value = cm.providers
        a2_known_value = [
            Provider(
                name="USGS",
                url="https://landsat.usgs.gov/",
                roles=[ProviderRole.PRODUCER, ProviderRole.LICENSOR],
            )
        ]

        # Get
        self.assertNotEqual(thumbnail_cm.providers, item_value)
        self.assertEqual(thumbnail_cm.providers, a2_known_value)

        # Set
        set_value = [
            Provider(
                name="John Snow",
                url="https://cholera.com/",
                roles=[ProviderRole.PRODUCER],
            )
        ]
        analytic_cm.providers = set_value

        self.assertEqual(analytic_cm.providers, set_value)
        self.assertEqual(analytic.to_dict()["providers"],
                         [p.to_dict() for p in set_value])
예제 #2
0
    def test_common_metadata_providers(self) -> None:
        x = self.ITEM_2.clone()

        providers_dict_list: List[Dict[str, Any]] = [{
            "name":
            "CoolSat",
            "roles": ["producer", "licensor"],
            "url":
            "https://cool-sat.com/",
        }]
        providers_object_list = [
            Provider.from_dict(d) for d in providers_dict_list
        ]

        example_providers_dict_list: List[Dict[str, Any]] = [
            {
                "name": "ExampleProvider_1",
                "roles": ["example_role_1", "example_role_2"],
                "url": "https://exampleprovider1.com/",
            },
            {
                "name": "ExampleProvider_2",
                "roles": ["example_role_1", "example_role_2"],
                "url": "https://exampleprovider2.com/",
            },
        ]
        example_providers_object_list = [
            Provider.from_dict(d) for d in example_providers_dict_list
        ]

        for i in range(len(utils.get_opt(x.common_metadata.providers))):
            p1 = utils.get_opt(x.common_metadata.providers)[i]
            p2 = providers_object_list[i]
            self.assertIsInstance(p1, Provider)
            self.assertIsInstance(p2, Provider)
            self.assertDictEqual(p1.to_dict(), p2.to_dict())

            pd1 = x.properties["providers"][i]
            pd2 = providers_dict_list[i]
            self.assertIsInstance(pd1, dict)
            self.assertIsInstance(pd2, dict)
            self.assertDictEqual(pd1, pd2)

        x.common_metadata.providers = example_providers_object_list

        for i in range(len(x.common_metadata.providers)):
            p1 = x.common_metadata.providers[i]
            p2 = example_providers_object_list[i]
            self.assertIsInstance(p1, Provider)
            self.assertIsInstance(p2, Provider)
            self.assertDictEqual(p1.to_dict(), p2.to_dict())

            pd1 = x.properties["providers"][i]
            pd2 = example_providers_dict_list[i]
            self.assertIsInstance(pd1, dict)
            self.assertIsInstance(pd2, dict)
            self.assertDictEqual(pd1, pd2)
예제 #3
0
 def provider(self):
     """
     Attributes for Data provider
     """
     if not self.mappings.has_provider:
         return
     return Provider(self.mappings.PROVIDER_NAME,
                     self.mappings.PROVIDER_DESCRIPTION,
                     self.mappings.PROVIDER_ROLES)
예제 #4
0
    def test_to_from_dict(self) -> None:
        provider_dict = {
            "name": "Remote Data, Inc",
            "description": "Producers of awesome spatiotemporal assets",
            "roles": ["producer", "processor"],
            "url": "http://remotedata.io",
            "extension:field": "some value",
        }
        expected_extra_fields = {"extension:field": provider_dict["extension:field"]}

        provider = Provider.from_dict(provider_dict)

        self.assertEqual(provider_dict["name"], provider.name)
        self.assertEqual(provider_dict["description"], provider.description)
        self.assertEqual(provider_dict["roles"], provider.roles)
        self.assertEqual(provider_dict["url"], provider.url)
        self.assertDictEqual(expected_extra_fields, provider.extra_fields)

        self.assertDictEqual(provider_dict, provider.to_dict())
예제 #5
0
    Link,
    Provider,
    SpatialExtent,
    TemporalExtent,
)

SPOT_SENSOR = {"S4": "SPOT 4", "S5": "SPOT 5"}

GeobaseCatalog = Catalog(
    id="Geobase", description="STAC Catalog for Geobase", title=None, stac_extensions=None
)

SpotProviders = [
    Provider(
        "Government of Canada",
        "Natural Resources Canada Centre for Topographic Information",
        ["licensor", "processor"],
        "www.geobase.ca",
    ),
    Provider("Sparkgeo", "*****@*****.**", ["processor", "host"], "www.sparkgeo.com"),
    Provider(
        "PCI Geomatics", "*****@*****.**", ["processor", "host"], "www.pcigeomatics.com"
    ),
]

SpotExtents = Extent(
    SpatialExtent([[0.0, 0.0, 0.0, 0.0]]),
    TemporalExtent(
        [
            [
                datetime.strptime("2005-01-01", "%Y-%m-%d"),
                datetime.strptime("2010-01-01", "%Y-%m-%d"),
예제 #6
0
# flake8: noqa

from pyproj import CRS
from pystac import Provider

USGS_3DEP_ID = "usgs-3dep"
THREEDEP_EPSG = 5498
THREEDEP_CRS = CRS.from_epsg(THREEDEP_EPSG)
PRODUCTS = ["1", "13"]
LICENSE = "PDDL-1.0"

DESCRIPTION = """The USGS 3D Elevation Program (3DEP) Datasets from The National Map are the primary elevation data product produced and distributed by the USGS. The 3DEP program provides a variety of resolution raster elevation data of the conterminous United States, Alaska, Hawaii, and the island territories. Some of the data sets such as the 1/3rd arc-second and 1 arc-second data set are derived from diverse source data sets that are processed to a specification with a consistent resolution, coordinate system, elevation units, and horizontal and vertical datums.  These seamless DEMs were referred to as the National Elevation Dataset (NED) from about 2000 through 2015 at which time they became the seamless DEM layers under the 3DEP program and the NED name and system were retired. Other 3DEP products include one-meter DEMs produced exclusively from high resolution light detection and ranging (lidar) source data and five-meter DEMs in Alaska as well as various source datasets including the lidar point cloud and interferometric synthetic aperture radar (Ifsar) digital surface models and intensity images. All 3DEP products are public domain. The 3DEP program is the logical result of the maturation of the long-standing USGS elevation program, which for many years concentrated on production of topographic map quadrangle-based digital elevation models. The 3DEP data  serves as the elevation layer of The National Map, and provides basic elevation information for earth science studies and mapping applications in the United States.

The seamless DEM layers under the 3DEP program are a multi-resolution dataset that is updated continuously to integrate newly available, improved elevation source data. Seamless DEM data layers under the 3DEP program  are available nationally at grid spacings of 1 arc-second (approximately 30 meters) for the conterminous United States, and at 1/3, 1/9 arc-seconds  (approximately 10 and 3 meters, respectively) and 1 meter for parts of the United States. Most seamless DEM data for Alaska is available at 2-arc-second (about 60 meters) grid spacing, where only lower resolution source data exist. Part of Alaska is available at the 1/3 arc-second, 1 arc-second and 5 meter resolution. Efforts are continuing to have full coverage of the 5 meter elevation data over Alaska in the next couple of years.
"""

USGS_PROVIDER = Provider(
    name="USGS",
    roles=["producer", "processor", "host"],
    url="https://www.usgs.gov/core-science-systems/ngp/3dep")

USGS_FTP_SERVER = "rockyftp.cr.usgs.gov"
USGS_FTP_BASE = f"ftp://{USGS_FTP_SERVER}/vdelivery/Datasets/Staged/Elevation"
AWS_BUCKET = "prd-tnm"
AWS_PREFIX = "StagedProducts/Elevation"
AWS_BASE = f"https://{AWS_BUCKET}.s3.amazonaws.com/{AWS_PREFIX}"

DEFAULT_BASE = AWS_BASE