Skip to content

Parsing coordinates #55

@norlandrhagen

Description

@norlandrhagen

Hey there!

I'm trying to combine some tiffs with open_virtual_mfdataset, but when reading these ESA tiffs, they don't have any coordinate information or CRS. Is there any functionality for inferring CRS from the tiff?

import obstore
from virtualizarr import open_virtual_dataset
from virtualizarr.registry import ObjectStoreRegistry
from virtual_tiff import VirtualTIFF

bucket_url = "s3://esa-worldcover/"
file_url = f"{bucket_url}v100/2020/map/ESA_WorldCover_10m_2020_v100_N24W075_Map.tif"

s3_store = obstore.store.from_url(bucket_url, region="eu-central-1", skip_signature=True)
registry = ObjectStoreRegistry({bucket_url: s3_store})

ds = open_virtual_dataset(
    url=file_url,
    registry=registry,
    parser=VirtualTIFF(ifd=0) 
)
ds
<xarray.Dataset> Size: 1GB
Dimensions:  (y: 36000, x: 36000)
Dimensions without coordinates: y, x
Data variables:
    0        (y, x) uint8 1GB ManifestArray<shape=(36000, 36000), dtype=uint8...

vs rioxarray:

import rioxarray

ds = xr.open_dataset(file_url,engine='rasterio')
print(ds)
<xarray.Dataset> Size: 5GB
Dimensions:      (band: 1, x: 36000, y: 36000)
Coordinates:
  * band         (band) int64 8B 1
  * x            (x) float64 288kB -75.0 -75.0 -75.0 -75.0 ... -72.0 -72.0 -72.0
  * y            (y) float64 288kB 27.0 27.0 27.0 27.0 ... 24.0 24.0 24.0 24.0
    spatial_ref  int64 8B ...
Data variables:
    band_data    (band, y, x) float32 5GB ...

Metadata

Metadata

Assignees

No one assigned

    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