aditya-grover / climate-learn

Source code for ClimateLearn
MIT License
302 stars 49 forks source link

Save predictions as an `nc` file at test time #111

Open patel-zeel opened 1 year ago

patel-zeel commented 1 year ago

Is your feature request related to a problem? Please describe. The feature request is motivated by the following problems:

Describe the solution you'd like A possible way could be to use a flow similar to cl.utils.visualize_at_index function.

https://github.com/aditya-grover/climate-learn/blob/1a46b08e75ded7dde2d41867d01cfbe5d0d68c2c/src/climate_learn/utils/visualize.py#L10-L12

There could be a function cl.utils.save_nc which may look like:

def save_nc(mm, dm, in_transform, out_transform, variable, src, save_dir):
    ...

This function can save the predictions in exactly the same format as the data nc files with lat, lon and time co-ordinates. It should be able to retrieve lat, lon, time from data module dm.

Willingness to work on a PR I'll be happy to work on a PR to make this happen!

Additional context This feature may also be useful to climate researchers who want to produce a time-lapse video of predictions with other libraries with additional geolayers similar to these examples in geemap library.

las_vegas

jasonjewik commented 1 year ago

Hi @patel-zeel, thank you for the suggestion. Because of travel, I will not be able to work on this for the next month. However, a feature like what you have suggested about saving latitude, longitude, and time is on the horizon for ClimateLearn. You can read more about my plans for the future of the library on this Google Doc. I plan to make a more formal post about these proposals when I return from my trip. In the meantime, I would very much appreciate you opening a PR to resolve this issue.