We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I would like geemap to have a function that allows getting dates from an ee.ImageCollection. I tried it this way.
geemap
ee.ImageCollection
import ee import geemap from datetime import datetime try: ee.Initialize() except Exception as e: ee.Authenticate() ee.Initialize() # Function def ic_get_dates(imgcol): def iter_func(image, newlist): date = ee.Number.parse(image.date().format("YYYYMMddHHmmss")); newlist = ee.List(newlist); return ee.List(newlist.add(date).sort()) date_ee = imgcol.iterate(iter_func, ee.List([])) date_list = list(ee.List(date_ee).reduce(ee.Reducer.frequencyHistogram()).getInfo().keys()) def date_gee(date): return str(datetime.strptime(date, '%Y%m%d%H%M%S')).replace(" ", "T") return list(map(date_gee, date_list)) # IC ic = ee.ImageCollection("NOAA/GOES/16/MCMIPF") \ .filterDate("2020-08-18T17:00:00", "2020-08-18T18:00:00") # Get dates dates = ic_get_dates(ic) print(dates) # ['2020-08-18T17:00:20', '2020-08-18T17:10:20', '2020-08-18T17:20:20', '2020-08-18T17:30:20', '2020-08-18T17:40:20', '2020-08-18T17:50:20']
The text was updated successfully, but these errors were encountered:
Add func for getting image collection dates #216
e150505
The function can be simplified as two lines. See geemap.image_dates()
geemap.image_dates()
def image_dates(img_col, date_format='YYYY-MM-dd'): dates = img_col.aggregate_array('system:time_start') new_dates = dates.map(lambda d: ee.Date(d).format(date_format)) return new_dates
Sorry, something went wrong.
giswqs
No branches or pull requests
Description
I would like
geemap
to have a function that allows getting dates from anee.ImageCollection
. I tried it this way.What I Did
The text was updated successfully, but these errors were encountered: