Skip to content

scratch work to assign spatial:transform when creating geozarr metadata#36

Draft
kylebarron wants to merge 4 commits intomainfrom
kyle/example-set-spatial-transform-geozarr-multiscale
Draft

scratch work to assign spatial:transform when creating geozarr metadata#36
kylebarron wants to merge 4 commits intomainfrom
kyle/example-set-spatial-transform-geozarr-multiscale

Conversation

@kylebarron
Copy link
Copy Markdown
Member

Just creating a draft branch/PR to keep track of my changes to assign spatial:transform onto multiscales metadata

Comment on lines +33 to +34
scale_factor_x = overview.transform.a / geotiff.transform.a
scale_factor_y = overview.transform.e / geotiff.transform.e
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change from the example on main. I think it's best to always calculate the scale factor in terms of both x and y, in case it differs. It does differ in some cases (such as in an NAIP sample image I use often) due to pixel rounding for overviews.

Comment on lines +47 to +51
multiscales_attrs["multiscales"]["layout"][0]["spatial:transform"] = list(geotiff.transform)
for item, overview in zip(
multiscales_attrs["multiscales"]["layout"][1:], geotiff.overviews, strict=True
):
item["spatial:transform"] = list(overview.transform)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After multiscales metadata has been created, this assigns spatial:transform onto each level

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.

1 participant