+
+
+
+
+
+
+In [17]:
+
+
+
+
+
+import requests
+import pandas as pd
+import hvplot.pandas
+import json
+import holoviews as hv
+
+hv.extension('bokeh')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+In [12]:
+
+
+
+
+
+# Define the base URL for the API
+base_url = "https://webcritech.jrc.ec.europa.eu/SeaLevelsDb/api/Group/"
+
+# Fetch the list of providers
+providers_response = requests.get(base_url)
+providers_data = json.loads(providers_response.text) # Parse the JSON response
+providers_data
+
+
+
+
+
+
+
+
+Out[12]:
+
+
+[{'Id': 38, + 'Name': 'BIG', + 'Color': '19, 157, 55', + 'DevicesCount': 10, + 'Devices': None}, + {'Id': 3, + 'Name': 'BOM', + 'Color': '0, 0, 255', + 'DevicesCount': 3, + 'Devices': None}, + {'Id': 2, + 'Name': 'DART Pacific', + 'Color': '255, 0, 0', + 'DevicesCount': 72, + 'Devices': None}, + {'Id': 34, + 'Name': 'DMI', + 'Color': '0, 0, 200', + 'DevicesCount': 1, + 'Devices': None}, + {'Id': 31, + 'Name': 'FMI', + 'Color': '22, 133, 88', + 'DevicesCount': 1, + 'Devices': None}, + {'Id': 24, + 'Name': 'Greece', + 'Color': '0, 0, 128', + 'DevicesCount': 12, + 'Devices': None}, + {'Id': 32, + 'Name': 'Ign', + 'Color': '0, 128, 255', + 'DevicesCount': 10, + 'Devices': None}, + {'Id': 20, + 'Name': 'ISPRA', + 'Color': '0, 255, 120', + 'DevicesCount': 40, + 'Devices': None}, + {'Id': 29, + 'Name': 'LNEC', + 'Color': '128, 29, 49', + 'DevicesCount': 10, + 'Devices': None}, + {'Id': 27, + 'Name': 'NL', + 'Color': '255, 201, 14', + 'DevicesCount': 3, + 'Devices': None}, + {'Id': 35, + 'Name': 'NOAA', + 'Color': '0, 0, 255', + 'DevicesCount': 318, + 'Devices': None}, + {'Id': 5, + 'Name': 'PT TD', + 'Color': '0, 255, 0', + 'DevicesCount': 4, + 'Devices': None}, + {'Id': 14, + 'Name': 'Setubal', + 'Color': '0, 0, 244', + 'DevicesCount': 4, + 'Devices': None}, + {'Id': 8, + 'Name': 'TAD', + 'Color': '0, 0, 128', + 'DevicesCount': 12, + 'Devices': None}, + {'Id': 6, + 'Name': 'TD UNESCO', + 'Color': '255, 128, 0', + 'DevicesCount': 667, + 'Devices': None}, + {'Id': 21, + 'Name': 'UNIFI', + 'Color': '80, 255, 167', + 'DevicesCount': 2, + 'Devices': None}]+
+
+
+
+
+
+
+In [62]:
+
+
+
+
+
+# Initialize a list to hold all station data
+all_stations_data = []
+
+# Loop through the list of providers and fetch their stations
+for provider in providers_data:
+ provider_name = provider['Name']
+ stations_url = base_url + provider_name + "/Devices"
+ stations_response = requests.get(stations_url)
+ stations_data = json.loads(stations_response.text) # Parse the JSON response
+
+ # Loop through each station and extract data
+ for device in stations_data:
+ station_data = {
+ 'Provider': provider_name,
+ 'Id': device['Id'],
+ 'Name': device['Name'],
+ 'lat': device['Lat'],
+ 'lon': device['Lon'],
+ 'LastAccessStatus': device['CurrentStatus']['LastAccessStatus'],
+ 'LastDate': device['CurrentStatus']['LastDate'],
+ 'State': device['CurrentStatus']['State'],
+ 'SyncStatus': device['CurrentStatus']['SyncStatus'],
+ 'FileType': device['FileType'],
+ 'GroupId': device['GroupId'],
+ 'MovAvgNp': device['MovAvgNp'],
+ 'Notes': device.get('Notes'), # Use .get() to handle missing keys
+ 'Source': device['Source']
+ # Add other fields as necessary
+ }
+ all_stations_data.append(station_data)
+
+df = pd.DataFrame(all_stations_data)
+df
+
+
+
+
+
+
+
+
+Out[62]:
+
+
+
+
+
+
+
+
++ | Provider | +Id | +Name | +lat | +lon | +LastAccessStatus | +LastDate | +State | +SyncStatus | +FileType | +GroupId | +MovAvgNp | +Notes | +Source | +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | +BIG | +2896 | +Indonesia - Tolitoli (Central Sulawesi) | +1.050620 | +120.800049 | +ERR: NO DATA TYPE | +2020-01-23T15:10:00Z | +active | +ready | +BIG | +38 | +2 | +None | +http://tides.big.go.id:8888/kacrut/0051TLTL02/... | +
1 | +BIG | +2897 | +Indonesia - Mamuju (Western Sulawesi) | +-2.666982 | +118.893349 | +ERR: NO DATA TYPE | +2020-01-23T15:20:00Z | +active | +ready | +BIG | +38 | +2 | +None | +http://tides.big.go.id:8888/kacrut/0009MMJU02/... | +
2 | +BIG | +2898 | +Indonesia - Pantolan (Western Sulawesi) | +-0.711140 | +119.856155 | +ERR: NO DATA TYPE | +2020-01-23T15:20:00Z | +active | +ready | +BIG | +38 | +2 | +None | +http://tides.big.go.id:8888/kacrut/0036PTLN02/... | +
3 | +BIG | +2899 | +Indonesia - Kota Agung (Lampung) | +-5.500444 | +104.619362 | +ERR: NO DATA TYPE | +2020-01-23T15:20:00Z | +active | +ready | +BIG | +38 | +2 | +None | +http://tides.big.go.id:8888/kacrut/0080KTAG01/... | +
4 | +BIG | +2900 | +Indonesia - Krui (Lampung) | +-5.183500 | +103.933052 | +ERR: NO DATA TYPE | +2020-01-23T15:20:00Z | +active | +ready | +BIG | +38 | +2 | +None | +http://tides.big.go.id:8888/kacrut/0100KRUI01/... | +
... | +... | +... | +... | +... | +... | +... | +... | +... | +... | +... | +... | +... | +... | +... | +
1313 | +TD UNESCO | +2569 | +Ireland - New Ballyglass pier Belmullet | +54.252998 | +-9.890000 | +OK | +2024-09-16T13:00:00Z | +active | +ready | +GLOSSxml | +6 | +2 | +None | +http://www.ioc-sealevelmonitoring.org/service.... | +
1314 | +TD UNESCO | +2915 | +Philippines - Currimao_Prs | +18.017000 | +120.483002 | +OK | +2024-09-11T12:43:00Z | +active | +ready | +GLOSSxml | +6 | +2 | +None | +http://www.ioc-sealevelmonitoring.org/service.... | +
1315 | +UNIFI | +1872 | +Italy - Stromboli Sciara del Fuoco (1min) | +38.798401 | +15.193100 | +OK | +2013-01-14T14:28:47Z | +active | +None | +UNIFI | +21 | +-1 | +None | +http://webcritech.jrc.ec.europa.eu/modelling/S... | +
1316 | +UNIFI | +1873 | +Italy - Stromboli Sciara del Fuoco (15 sec) | +38.798401 | +15.193100 | +OK | +2014-04-26T13:29:45Z | +active | +None | +TAD_T | +21 | +-1 | +None | +http://webcritech.jrc.ec.europa.eu/tad_server/... | +
1317 | +UNIFI | +1874 | +Italy - Stromboli Sciara del Fuoco (5 sec) | +38.798401 | +15.193100 | +OK | +2013-01-14T14:29:36Z | +inactive | +None | +UNIFI | +21 | +-1 | +None | +http://webcritech.jrc.ec.europa.eu/modelling/S... | +
1318 rows × 14 columns
+
+
+
+
+
+
+
+In [63]:
+
+
+
+
+
+df.groupby(['Provider','State']).count()[['Id']].hvplot.bar(
+ rot = 90,
+ logy = True,
+ ylim = [1, 2000],
+ grid = True
+).opts(
+ width = 1200,
+ height = 800,
+ title = "data availability"
+)
+
+
+
+
+
+
+
+
+
+
+
+Out[63]:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+In [66]:
+
+
+
+
+
+df.hvplot.points(
+ x = 'lon',
+ y='lat',
+ c = 'Provider',
+ line_color = 'k',
+ cmap = 'glasbey',
+ geo = True,
+ tiles="EsriImagery",
+).opts(
+ width = 1200,
+ height = 800
+)
+
+
+
+
+
+
+
+
+
+
+
+Out[66]:
+
+
+
+
+
+
+