Open betolink opened 6 months ago
Because of the leap years, would it be possible to use mm-dd?
results = earthaccess.search_data(
short_name=["HLSL30"],
point=(-82.19,27.91),
cloud_cover=(0,20),
temporal=("2014", "2024", ("06-30","07-30")), # this is not being passed to CMR but this is the current notation
)
And that brings me to another thing!
I do not know how consistent you want to be with the results from the portal but it is important to set also hh:mm:ss in the temporal search.
The first instance gives the same results as in the portal.
The question of the date to
: whether it is included or if it is up to that date but without it in earthaccess
may be confusing for the user. Perhaps that would be an additional setting. Or setting the exact time is the quickest way? Anyway, that is something to specify in the documentation I assume.
>>> granules = earthaccess.search_data(
... short_name="ECO_L2T_LSTE",
... temporal = ("2023-01-01", "2024-01-01-23:59:59"),
... point =(-83.08301,42.34026),
... count=-1,
... version="002"
... )
Granules found: 409
>>>
>>> granules = earthaccess.search_data(
... short_name="ECO_L2T_LSTE",
... temporal = ("2023-01-01", "2024-01-01"),
... point =(-83.08301,42.34026),
... count=-1,
... version="002"
... )
Granules found: 406
I think we should try to follow the conventions from the portal, actually I think this behavior (bug) was already reported by @amfriesz in #190
Ok, that is exactly the thing! Sorry, should have checked all the issues before, but it just came to my mind when I was writing the comment since I had been exploring the search parameters yesterday:)
No worries! I think we should fix that and implement the recurrent search even if we are off by a day in leap years. In the case of COGs we can have a very streamlined workflow with xarray:
results = earthaccess.search_data(
short_name=["HLSL30"],
point=(-82.19,27.91),
cloud_cover=(0,20),
temporal=("2014", "2024", ("06-30","07-30")),
)
fo = earthaccess.open(results, bands=["B01", "B02"])
ds = xr.open_mfdataset(fo, engine="rioxarray")
summer_mean = ds.clip(polygon).mean("time")
A common search pattern is a seasonal search, e.g. Landsat scenes from July for the last 10 years. This is supported by CMR(although is not well documented) and will allow us to search without having to use for loops.
Will return all HLS scenes from July for the last 10 years with max cloud coverage of 20%. I think this is very useful, however the
182, 212
range is not straight forward to calculate, maybe we need to parse a date and use it with caution as leap years will have a different offset.