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

eo-learn 1.5.0 migration guide #733

Open
zigaLuksic opened this issue Aug 30, 2023 · 0 comments
Open

eo-learn 1.5.0 migration guide #733

zigaLuksic opened this issue Aug 30, 2023 · 0 comments

Comments

@zigaLuksic
Copy link
Collaborator

zigaLuksic commented Aug 30, 2023

This ticket contains information on how to migrate to eo-learn 1.5.0.

How do I make a clean install of eo-learn?

For versions of eo-learn higher than 1.5.0, please referr to the installation section of eo-learn.

I am getting weird warnings about outdated eo-learn packages, how do I fix this?

Previous versions of eo-learn consisted of multiple sub-module installations, while now we have switched to a single package installation. If you've been using an older version of eo-learn and have now updated to eo-learn>=1.5.0, there is a risk of clashing dependencies, so it is recommended to clean up your working environment.

There are two options:

  1. Start with a fresh environment and install eo-learn
  2. Clean up your environment and re-install eo-learn

Option 1. is straight-forward, you can referr to the installation section of eo-learn.

Option 2. is a bit trickier, since you need to find all deprecated installations of submodules and uninstall them with pip. On Linux/Mac OS you can achieve this with the following bash snippet:

pip list | grep 'eo-learn-' | awk '{print $1}' | xargs pip uninstall -y

Explanation:

  • pip list lists all python packages in your current environment
  • grep 'eo-learn-' selects only the packages which fit the name template of eo-learn-
  • awk '{print $1}' selects the names of the packages and omits the versions
  • xargs pip uninstall -y collects the names and provides them to pip uninstall to remove them

After running the command above, check if the output of pip list | grep 'eo-learn-' is empty before continuing.

If the output is empty, feel free to re-install eo-learn according to the installation section, otherwise you can manually remove the remaining packages.

I can't access BBOX and TIMESTAMPS features like I used to

In the past, the Timestamps and BBox information of the EOPatch was also accessible via features (FeatureType.TIMESTAMPS and FeatureType.BBOX). This has now been removed. The information is still available in the EOPatch, but can now only be accessed via attributes.

from eolearn.core import EOPatch

eop = EOPatch.load("<path_to_eopatch>")
my_bbox = eop.bbox
my_timestamps = eop.timestamps

The BBox information is now also a requirement for an EOPatch, meaning that it cannot be None and has to be set when the EOPatch is initialized.

The meaning of the Timestamps information has also been updated. Timestamps can be one of the following:

  • list of datetime.datetime objects
  • an empty list ([])
  • None

The timestamps can legitimitely be None, assuming there are no temporal features in the EOPatch. If there are temporal features present, the timestamps should correspond to the temporal dimension of these features. Timestamps can also be an empty list, meaning that the temporal dimension is present, but the size of the temporal dimension is zero (e.g., all timestamps filtered out).

I'm experiencing issues with timestamps not being loaded from/saved to the EOPatch

Due to some changes with regards to timestamps described in the section above, it is possible you are experiencing issues with saving or loading timestamps from the EOPatch.

In case you are saving a full EOPatch, or if at least on of the selected features to be saved is a temporal feature, the timestamsps will automatically be saved to disk. This will not be the case if you are saving only timeless features. However, if you still wish to save the timestamps to disk in this case, you need to set the save_timestamps parameter to True, like so:

save_task = SaveTask(path='<path_to_eopatch>', features=<only_timeless_features>, save_timestamps=True)
save_task(eop)

# alternatively
# eop.save(path='<path_to_eopatch>', features=<only_timeless_features>, save_timestamps=True)

Similarly for loading, if you are loading the full EOPatch, or if the selected features to be loaded contain a temporal feature, the timestamps will automatically be loaded into the EOPatch. To force loading of timestamps in case when only timeless features are being loaded, you can achieve so by setting the load_timestamps parameter to True, like so:

load_task = LoadTask(path='<path_to_eopatch>', features=<only_timeless_features>, load_timestamps=True)
eop = load_task()

# alternatively
# eop = EOPatch.load(path='<path_to_eopatch>', features=<only_timeless_features>, load_timestamps=True)

Issues with importing one or more EOTasks from eo-learn

It's possible that you have been using some tasks from eo-learn in the past which have now been removed from the repository. We have decided that these tasks are too specific to remain in eo-learn, because we want the package to be light, as opposed to it being a vast collection of all possible tasks and their combinations.

In light of this, the tasks have been moved to eo-learn-examples/extra-tasks.

Some requirements are still missing after installing eo-learn

In some cases it seems that older versions of pip have trouble parsing all the dependencies in the pyproject.toml file. In this case, make sure you are using the latest version of pip by upgrading it:

pip install pip --upgrade

After that, try re-installing eo-learn again according to the installation section.

@zigaLuksic zigaLuksic added help wanted Extra attention is needed question Further information is requested and removed help wanted Extra attention is needed question Further information is requested labels Aug 30, 2023
@zigaLuksic zigaLuksic pinned this issue Aug 30, 2023
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

No branches or pull requests

1 participant