Skip to content
New issue

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

coordinate precision for IOC stations #57

Open
carolakaiser opened this issue Jan 21, 2023 · 3 comments
Open

coordinate precision for IOC stations #57

carolakaiser opened this issue Jan 21, 2023 · 3 comments

Comments

@carolakaiser
Copy link
Contributor

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?

@pmav99
Copy link
Member

pmav99 commented Jan 21, 2023

It should be possible to do this using the same API method that was mentioned here: #47 (comment)

{
  "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"
}

@pmav99
Copy link
Member

pmav99 commented Aug 28, 2023

Might be resolved by #100

@pmav99
Copy link
Member

pmav99 commented Jun 26, 2024

#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants