Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor / Update #5

Merged
merged 9 commits into from
Aug 26, 2020
Merged

Refactor / Update #5

merged 9 commits into from
Aug 26, 2020

Conversation

vincentsarago
Copy link
Member

This is yet to be ready, and depends on cogeotiff/rio-tiler#225

@vincentsarago vincentsarago self-assigned this Aug 15, 2020
@vincentsarago
Copy link
Member Author

early notes:

  • switched to rio_tiler.io.base.MultiAssetsReader with a custom class MultiBandReader which merge metadata (to aligned with metadata from COGReader)
    -bands -> assets: bandskeyword has be renamed assets (aligned with MultiAssetsReader`).
  • new assets names for submodules (e.g for landsat assets are now names "B1", "B2"... instead of "1", "2")
  • on each class init we are fetching either metadata or reference file to get some info about the scene (e.g MTL file for Landsat)
   with AWSPDS_L8Reader("LC08_L1TP_016037_20170813_20170814_01_RT") as landsat:
        assert landsat.minzoom == 7
        assert landsat.maxzoom == 12
        assert len(landsat.bounds) == 4
        assert landsat.assets == (
            "B1",
            "B2",
            "B3",
            "B4",
            "B5",
            "B6",
            "B7",
            "B8",
            "B9",
            "B10",
            "B11",
            "BQA",
        )

        metadata = landsat.info(assets="B5")
        assert len(metadata["band_metadata"]) == 1
        assert metadata["band_descriptions"] == [(1, "B5")]

        stats = landsat.stats(assets="B1")
        assert stats["B1"]["pc"] == [1206, 6957]

        metadata = landsat.metadata(assets=("B1", "B2"))
        assert metadata["statistics"]["B1"]["pc"] == [1206, 6957]
        assert metadata["band_descriptions"] == [(1, "B1"), (2, "B2")]

        tile_z = 8
        tile_x = 71
        tile_y = 102
        data, mask = landsat.tile(tile_x, tile_y, tile_z, assets=("B4", "B3", "B2"))
        assert data.shape == (3, 256, 256)
        assert data.dtype == numpy.uint16
        assert mask.shape == (256, 256)

@vincentsarago
Copy link
Member Author

vincentsarago commented Aug 15, 2020

TO DO:

  • Validate Class Names (AWSPDS_S1CReader, AWSPDS_S2L1CReader, AWSPDS_S2L2AReader,
    AWSPDS_L8Reader)
  • Validate Class Names (sentine.aws.S1CReader, sentine.aws.S2L1CReader, sentine.aws.S2L2AReader, sentine.aws.S2L2ACOGReader,
  • add top level helper function for sentinel (with sentinel({sentinel 1 or sentinel 2}) as sentinel ...)
  • README
  • Notebook

@vincentsarago vincentsarago changed the title [WIP] Refactor / Update Refactor / Update Aug 25, 2020
@vincentsarago vincentsarago marked this pull request as ready for review August 25, 2020 15:32
@vincentsarago vincentsarago merged commit d51d8b4 into master Aug 26, 2020
@vincentsarago vincentsarago deleted the newVersion branch August 27, 2020 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants