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

Combining these gives an error: all & not_ & date_between #286

Open
EmileSonneveld opened this issue Apr 25, 2024 · 1 comment
Open

Combining these gives an error: all & not_ & date_between #286

EmileSonneveld opened this issue Apr 25, 2024 · 1 comment

Comments

@EmileSonneveld
Copy link
Contributor

begin_date = "2020-01-01"
end_date = "2020-01-10"
dates_to_remove = ["2020-01-04", "2020-01-05", "2020-01-06", "2020-01-08"]  # Example dates to remove

bbox = [5.0, 51.2, 5.1, 51.3]

s2_bands = eoconn.load_collection(
    "SENTINEL2_L2A",
    temporal_extent=[begin_date, end_date],
    spatial_extent=dict(zip(["west", "south", "east", "north"], bbox)),
    bands=["B04", "B08"],
    max_cloud_cover=20,
)

condition = lambda x: eop.all(
    [
        eop.not_(
            x = eop.date_between(
                x=x,
                min=f"{timestep}T00:00:00Z",
                max=eop.date_shift(date=f"{timestep}T00:00:00Z", value=1, unit='day')
            )  
        )

        for timestep in dates_to_remove
        
    ]
)

s2_bands = s2_bands.filter_labels(condition=condition, dimension="t")
s2_bands.execute_batch()

Error:
[500] Internal: Server error: java.lang.ClassCastException: class java.time.ZonedDateTime cannot be cast to class scala.collection.Seq (java.time.ZonedDateTime is in module java.base of loader 'bootstrap'; scala.collection.Seq is in unnamed module of loader 'app') (ref: r-240424fdf86e43d6afa509d56fc58bb3)

cc @HansVRP

@EmileSonneveld
Copy link
Contributor Author

A workaround is to invert the date intervals, to avoid using not_

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