- This is alpha level software under development.
- Please contact Ken Mankoff <[email protected]> before using.
Iosifescu Enescu, I., Bavay, M., Plattner, G.-K. (2020). Sharing and reusing meteorological data. WMO Data Conference 2020 - Earth System Data Exchange in the 21st Century (Virtual Conference).
The NEAD file format is documented at https://github.com/GEUS-PROMICE/NEAD
pip install git+https://github.com/GEUS-PROMICE/pyNEAD.git
Takes a set of NEAD file attributes, field names and field attributes and builds an text header file
Takes a set of NEAD file attributes, field names and field attributes and builds a [configparser](https://docs.python.org/3/library/configparser.html) object that can be used directly by write_nead
Read a NEAD file:
import nead
ds = nead.read("sample.csv")
print(ds)
Ignore all the metadata and work with a Pandas dataframe:
import nead
ds = nead.read("sample.csv", index_col=0)
ds.to_dataframe()
timestamp | TA | RH | VW | ISWR |
---|---|---|---|---|
2010-06-22 12:00:00 | 2 | 52 | 1.2 | 320 |
2010-06-22 13:00:00 | 3 | 60 | 2.4 | 340 |
2010-06-22 14:00:00 | 2.8 | 56 | 2 | 330 |
Convert to MKS units and also pass arguments to the Pandas read_csv command:
import nead
ds = nead.read("sample.csv", MKS=True, index_col=0)
print(ds)
You can access the per-variable properties or the NEAD header properties in the .attrs
dictionary.
Details about one variable:
import nead
ds = nead.read("sample.csv", index_col=0)
print(ds['TA'])
<xarray.DataArray 'TA' (timestamp: 3)> array([2. , 3. , 2.8]) Coordinates: * timestamp (timestamp) datetime64[ns] 2010-06-22T12:00:00 ... 2010-06-22T... Attributes: add_value: 273.15 scale_factor: 1.0
Access the attributes dictionary
print(ds['TA'].attrs)
{'add_value': 273.15, 'scale_factor': 1.0}
Access the global attributes:
for k in ds.attrs.keys():
print(k, " : ", ds.attrs[k])
station_id : test_station latitude : 46.5 longitude : 9.8 altitude : 1500 nodata : -999 timezone : 1 field_delimiter : ,