ecmwf / earthkit-data

A format-agnostic Python interface for geospatial data
Apache License 2.0
56 stars 13 forks source link

Fix datelists containing 5 items in retrievals #305

Closed sandorkertesz closed 7 months ago

sandorkertesz commented 7 months ago

The following mars retrieval fails:

ds = earthkit.data.from_source("mars",
                                   {
                                   "class":"ea",
                                   "stream":"oper",
                                   "param":'2t',
                                   "expver": 1,
                                   "type":"an",
                                   "levtype":"sfc", 
                                   "area":[-28.0,26.0,-31.0,30.0], 
                                   "grid":[0.25,0.25],    
                                   "date": "2016-07-23/to/2016-07-27",
                                   "time":[str(i) for i in list(range(0,24))],
                                   }
                                  )

AttributeError: 'datetime.datetime' object has no attribute 'lower'

This only happens when we have exactly 5 dates! E.g.

"date": "2016-07-23/to/2016-07-28"

works fine.