You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above code, any tag under the ENVI namespace is stripped when the file is written back out. This data reads in just fine, but since the tag structure is flattened on read, that context is then lost on write. So headers like wavelengths, wavelength units, acquisition time, etc are lost.
Expected Output
I would expect a subsequent to_raster call to look exactly the same as the data passed in.
A simple solution would be to store an attribute indicating what fields were read from the ENVI namespace and then automatically include those tags on write. The gotcha however is if someone were to add additional attributes or band information they wanted included in the ENVI header they'd need a way to indicate that.
One potential solution would be to not flatten the tag structure for general metadata at all. So if a user wanted to include data in the ENVI namespace they could do so this way:
Activity
AndrewGuenther commentedon Feb 9, 2023
A simple solution would be to store an attribute indicating what fields were read from the ENVI namespace and then automatically include those tags on write. The gotcha however is if someone were to add additional attributes or band information they wanted included in the ENVI header they'd need a way to indicate that.
Tracking of the read headers would probably go here:
https://github.com/corteva/rioxarray/blob/master/rioxarray/_io.py#L713-L725
One potential solution would be to not flatten the tag structure for general metadata at all. So if a user wanted to include data in the ENVI namespace they could do so this way:
Per band information is a bit more difficult...
snowman2 commentedon Feb 10, 2023
Tag writing is here
snowman2 commentedon Feb 10, 2023
When there are multiple bands, the
band_tagskey can be added as a list of dicts.