I've just upgraded to icoscp-0.2.0 (from 0.1.17) and for now I am still using the legacy station.get() function. In general this is working, but when I try for the site "RGL" using the following:
from icoscp_core.icos import bootstrap
from icoscp import cpauth
from icoscp.station import station
cookie_token = ...
meta, data = bootstrap.fromCookieToken(cookie_token)
cpauth.init_by(data.auth)
stat = station.get(stationId="RGL")
I get the following error:
TypeError Traceback (most recent call last)
Cell In[9], line 1
----> 1 stat = station.get(stationId="RGL")
File ~/.conda/envs/openghg_dev_env/lib/python3.12/site-packages/icoscp/station/station.py:588, in get(stationId, station_df)
586 if not stn[stn.project.str.upper() == "ICOS"].empty:
587 if stn.lat.any():
--> 588 my_stn.lat = float(stn.lat[stn.project.str.upper() == 'ICOS'])
589 if stn.lat.any():
590 my_stn.lon = float(stn.lon[stn.project.str.upper() == 'ICOS'])
File ~/.conda/envs/openghg_dev_env/lib/python3.12/site-packages/pandas/core/series.py:248, in _coerce_method.<locals>.wrapper(self)
240 warnings.warn(
241 f"Calling {converter.__name__} on a single element Series is "
242 "deprecated and will raise a TypeError in the future. "
(...)
245 stacklevel=find_stack_level(),
246 )
247 return converter(self.iloc[0])
--> 248 raise TypeError(f"cannot convert the series to {converter}")
TypeError: cannot convert the series to <class 'float'>
If I print "stn" just before this I find that it has 4 identical entries:
uri id name \
234 http://meta.icos-cp.eu/resources/stations/AS_RGL RGL Ridge Hill
235 http://meta.icos-cp.eu/resources/stations/AS_RGL RGL Ridge Hill
236 http://meta.icos-cp.eu/resources/stations/AS_RGL RGL Ridge Hill
237 http://meta.icos-cp.eu/resources/stations/AS_RGL RGL Ridge Hill
icosClass country lat lon elevation \
234 2 GB 51.9975 -2.5399 207.0
235 2 GB 51.9975 -2.5399 207.0
236 2 GB 51.9975 -2.5399 207.0
237 2 GB 51.9975 -2.5399 207.0
stationTheme firstName lastName \
234 http://meta.icos-cp.eu/ontologies/cpmeta/AS Kieran Stanley
235 http://meta.icos-cp.eu/ontologies/cpmeta/AS Kieran Stanley
236 http://meta.icos-cp.eu/ontologies/cpmeta/AS Kieran Stanley
237 http://meta.icos-cp.eu/ontologies/cpmeta/AS Kieran Stanley
email siteType project theme
234 k.m.stanley@bristol.ac.uk tall tower ICOS AS
235 k.m.stanley@bristol.ac.uk tall tower ICOS AS
236 k.m.stanley@bristol.ac.uk tall tower ICOS AS
237 k.m.stanley@bristol.ac.uk tall tower ICOS AS
This doesn't seem to happen for other sites - is this a RGL-specific bug or am I doing something foolish?
I've just upgraded to icoscp-0.2.0 (from 0.1.17) and for now I am still using the legacy station.get() function. In general this is working, but when I try for the site "RGL" using the following:
I get the following error:
If I print "stn" just before this I find that it has 4 identical entries:
This doesn't seem to happen for other sites - is this a RGL-specific bug or am I doing something foolish?