Skip to content

add read_tif method #8

@brendancol

Description

@brendancol

Let's consider adding https://pypi.org/project/tifffile/ as a dependency for tif io.

  • add read_tif to readers.py which mirrors xr.open_rasterio

DEM data is stored as COG on S3

url = 'https://esip-pangeo-uswest2.s3-us-west-2.amazonaws.com/sciencebase/Southern_California_Topobathy_DEM_1m_cog.tif'
da = xr.open_rasterio(url)
da
<xarray.DataArray (band: 1, y: 225217, x: 316120)>
[71195598040 values with dtype=float32]
Coordinates:
  * band     (band) int64 1
  * y        (y) float64 3.825e+06 3.825e+06 3.825e+06 ... 3.6e+06 3.6e+06
  * x        (x) float64 1.795e+05 1.795e+05 1.795e+05 ... 4.956e+05 4.956e+05
Attributes:
    transform:   (1.0, 0.0, 179523.99999999822, 0.0, -1.0, 3824832.0)
    crs:         +init=epsg:26911
    res:         (1.0, 1.0)
    is_tiled:    1
    nodatavals:  (-3.4028230607370965e+38,)
    scales:      (1.0,)
    offsets:     (0.0,)
Check out the overviews:

src = rasterio.open(url, 'r')
[src.overviews(i) for i in src.indexes]
[[4, 8, 16, 32, 64, 128, 256, 512, 1023]]

taken from: https://nbviewer.jupyter.org/gist/rsignell-usgs/0f96bb9c0ca34a5dd0fc8131a7bbae1c

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions