Skip to content

Commit

Permalink
Merge pull request #14 from metno/10-update-aeronetsunreader-with-lat…
Browse files Browse the repository at this point in the history
…er-pyaro-developments

10 update aeronetsunreader with later pyaro developments
  • Loading branch information
jgriesfeller authored Dec 13, 2023
2 parents 1a48771 + e995952 commit 0e7d8d5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 64 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If a zip file URL is provided, only the 1st file in there is used (since the
Aeronet provided zip contains all data in a single file)

## Usage
### aeronetsunreader
```python
import pyaro.timeseries
TEST_URL = "https://pyaerocom.met.no/pyaro-suppl/testdata/aeronetsun_testdata.csv"
Expand All @@ -37,3 +38,27 @@ ts.data('AOD_550nm')['altitudes']
ts.data('AOD_550nm')['values']

```
### geocoder_reverse_natural_earth
geocoder_reverse_natural_earth is small helper to identify country codes for obs networks that don't mention the
countrycode of a station in their location data
```python
from geocoder_reverse_natural_earth import (
Geocoder_Reverse_NE,
Geocoder_Reverse_Exception,
)
geo = Geocoder_Reverse_NE()
print(geo.lookup(60, 10)["ISO_A2_EH"])
lat = 78.2361926
lon = 15.3692614
try:
geo.lookup(lat, lon)
except Geocoder_Reverse_Exception as grex:
dummy = geo.lookup_nearest(lat, lon)
if dummy is None:
print(f"error: {lat},{lon}")
else:
print(dummy["ISO_A2_EH"])



```
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from urllib.request import urlopen
from zipfile import BadZipFile, ZipFile

from geocoder_reverse_natural_earth import Geocoder_Reverse_NE
from geocoder_reverse_natural_earth import (
Geocoder_Reverse_NE,
Geocoder_Reverse_Exception,
)
import numpy as np
import requests
from pyaro.timeseries import (
AutoFilterReaderEngine,
Data,
Engine,
Flag,
NpStructuredData,
Station,
Expand Down Expand Up @@ -122,7 +124,7 @@ def __init__(
if fill_country_flag:
try:
country = gcd.lookup(lat, lon)["ISO_A2_EH"]
except:
except Geocoder_Reverse_Exception:
country = "NN"
else:
country = "NN"
Expand Down
61 changes: 0 additions & 61 deletions tests/test_CSVTimeSeriesReader.py

This file was deleted.

0 comments on commit 0e7d8d5

Please sign in to comment.