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

Feature Request: Save meta as json instead of pickle #184

Closed
2320sharon opened this issue Aug 22, 2023 · 7 comments
Closed

Feature Request: Save meta as json instead of pickle #184

2320sharon opened this issue Aug 22, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request V2 for version 2 of coastseg

Comments

@2320sharon
Copy link
Collaborator

Modify the coastsat script to save pickle to save json file instead.

@2320sharon 2320sharon added the enhancement New feature or request label Aug 22, 2023
@2320sharon 2320sharon self-assigned this Aug 22, 2023
@2320sharon
Copy link
Collaborator Author

In the event this can't be easily modified within coastsat_package, then create a script to do this.

@2320sharon 2320sharon added the V2 for version 2 of coastseg label Aug 24, 2023
@dbuscombe-usgs
Copy link
Member

This is related to image registration (and therefore #133)

The issue is that the georeference accuracy (m) value is in the pkl metadata. This is not human readable and has issues with serialization and backwards compatiable. So it is not easy to get the georeference accuracy out to use it for reporting and AQ/AC

@2320sharon
Copy link
Collaborator Author

2320sharon commented Sep 20, 2023

After examining the coastsat_package code I have verified that it doesn't ever read from the pickled metadata files, which mean we can safely change it to json without fear of it breaking something else. I've tested saving the data as a json file using the file_utilities.write_to_json function and it works great after changing the datetime imports

from datetime import date, datetime

I should be able to have this change integrated by next week

@dbuscombe-usgs
Copy link
Member

Really great. Having all the relevant metadata in json means we can move on image registration. The basic idea is that we want to register the S2 imagery to Landsat imagery.

My basic thinking is to try to adopt the workflow used here as I detail here

I think it would work on each S2 image by finding the nearest-in-time Landsat image and performing a co-registration, with the Landsat scene being treated as the reference scene. The georeference accuracy (m) value from the json metadata file would be used when assigning a georeference accuracy to each S2 scene, which would be the landsat georef acc and the s2 coreg error summed in quadrature. Then we'd have to come up with a way to write that s2 georef acc back to the json file.

In the coastseg workflow, it would occur after the image downloading, if s2 images had been downloaded. We could either replace each S2 image with the registered image, or preferably, come up with a way to copy the original image into a new filename, then write out the new S2 image to the original filename.

I will try to sketch this out this workflow more fully with code, as my contribution to #133

@dbuscombe-usgs
Copy link
Member

We can discuss further. It is not urgent

@2320sharon
Copy link
Collaborator Author

2320sharon commented Sep 21, 2023

This helps a lot with the image co-registration feature coming down the pipeline.
I think we should be able to rename the un registered S2 imagery by appending "unregistered" to the filenames. That way for most operations we can deal with the registered image.

I'll do a bit of digging into the co-registration
workflow you shared so we can come up with some ideas tomorrow.

@2320sharon
Copy link
Collaborator Author

Coastsat_package version 0.1.18 saves the metadata file as a json instead of a pickle. This issue has been resolved in
v1.0.0dev7 and will be officially incorporated in version 1.1.0

2320sharon added a commit that referenced this issue Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request V2 for version 2 of coastseg
Projects
None yet
Development

No branches or pull requests

2 participants