Recent breaking change to ee.Date method?
bw4sz opened this issue · 4 comments
bw4sz commented
Environment Information
Please run the following code on your computer and share the output with us so that we can better debug your issue:
(DeepTreeAttention) [b.weinstein@c0305a-s37 DeepTreeAttention]$ python
Python 3.11.3 (main, May 15 2023, 15:45:52) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import geemap
>>> geemap.Report()
--------------------------------------------------------------------------------
Date: Mon Sep 18 04:42:21 2023 EDT
OS : Linux
CPU(s) : 32
Machine : x86_64
Architecture : 64bit
RAM : 188.0 GiB
Environment : Python
File system : ext4
Python 3.11.3 (main, May 15 2023, 15:45:52) [GCC 11.2.0]
geemap : 0.26.0
ee : 0.1.369
ipyleaflet : 0.17.4
folium : 0.14.0
jupyterlab : Module not found
notebook : Module not found
ipyevents : 2.0.1
geopandas : 0.13.2
Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303
for Intel(R) 64 architecture applications
--------
Description
I've been away from geemap for a couple months. When I came back, I found that the ee.Date function is not a module anymore, but a class object? It was useful for converting numeric years into earth engine dates.
As in
https://developers.google.com/earth-engine/apidocs/ee-date-fromymd
https://geemap.org/common/#geemap.common.annual_NAIP
>>> import ee
>>> year = 2022
>>> start_date = ee.Date.fromYMD(year, 1, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Date' has no attribute 'fromYMD'
>>> from ee import Date
>>> Date
<class 'ee.ee_date.Date'>
>>> Date.fromYMD
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Date' has no attribute 'fromYMD'
schwehr commented
Should work. Make sure you have the latest release of the EE python client library.
I'm seeing this:
import ee
ee.Initialize() # I think you might be missing this?
print(ee.Date.fromYMD(2023, 1, 1).getInfo())
# Gives:
{'type': 'Date', 'value': 1672531200000}
giswqs commented
schwehr commented
Missing ee.Initialize()
?