coordinate precision for IOC stations
I have checked out the latest searvey repository (tag v0.2.1) - it works great, thank you! For the IOC stations, the coordinates are given with a lower precision (2 or 3 decimal places) but sometimes the stations have better coordinates in the details page of the IOC website. Would it be possible to get high precision coordinates for IOC? I understand that this would require additional requests, so maybe as a code option?
It should be possible to do this using the same API method that was mentioned here: https://github.com/oceanmodeling/searvey/issues/47#issuecomment-1276779871
{
"Code": "alac2",
"Location": "Alicante2",
"country": "ESP",
"type": "SW",
"DCP_ID": null,
"WMO": null,
"XMtInt": 10,
"Lat": 38.3388889,
"Lon": -0.4813889,
"Har": null,
"GlossID": null,
"OT12Code": null,
"Example": null,
"UTCOffset": 0,
"OperatorID": null,
"status": 1,
"status_description": null,
"localoperator": 159,
"performanceoperator1": null,
"performanceoperator2": null,
"performanceoperator3": null,
"date_created": "2019-12-07 10:20:22.277",
"url": null,
"code": "alac2",
"sensorid": 2551,
"statday": "2023-01-20 06:15:00",
"observations": 124,
"first": "2023-01-19 09:30:00",
"last": "2023-01-20 06:10:00",
"updatedata": 8,
"timestampdata": 7,
"timestampupdate": 0,
"sensor": "rad",
"rate": 10,
"samples": 1,
"units": "M",
"i": null,
"offset": null,
"timeorder": 1,
"lasttime": "2023-01-21 22:30:00.000",
"lastupdate": "2023-01-21 22:39:34.000",
"lastvalue": 2.126,
"connect": "SW",
"lat": 38.339,
"lon": -0.481,
"countryname": "Spain"
}
Might be resolved by https://github.com/oceanmodeling/searvey/pull/100
#100 has been superseded by #125, but in that one we didn't touch the metadata at all. So this is still an issue.
Something like this seems to be sufficient, though:
def get_meta() -> gpd.GeoDataFrame:
meta_web = searvey.get_ioc_stations().drop(columns=["lon", "lat"])
meta_api = (
pd.read_json("http://www.ioc-sealevelmonitoring.org/service.php?query=stationlist&showall=all")
.drop_duplicates()
.drop(columns=["lon", "lat"])
.rename(columns={"Code": "ioc_code", "Lon": "lon", "Lat": "lat"})
)
merged = pd.merge(
meta_web,
meta_api[["ioc_code", "lon", "lat"]].drop_duplicates(),
on=["ioc_code"],
)
updated = merged.assign(geometry=gpd.points_from_xy(merged.lon, merged.lat, crs="EPSG:4326"))
return updated