Skip to content

Commit

Permalink
add netcdf_rw handler
Browse files Browse the repository at this point in the history
  • Loading branch information
heikoklein committed Jun 9, 2024
1 parent 95caccb commit 95d86e2
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
tmp_netcdf_rw/

# Translations
*.mo
Expand Down Expand Up @@ -159,4 +160,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

.vscode/
.vscode/
12 changes: 7 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[metadata]
name = pyaro_readers
version = 0.0.8
version = 0.0.9.dev0
author = MET Norway
description = implementations of pyaerocom reading plugings using pyaro as interface
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Operating System :: OS Independent
Development Status :: 3 - Alpha
Expand All @@ -19,9 +19,9 @@ classifiers =
url = https://github.com/metno/pyaro-readers

[options]
python_version = >=3.9
python_version = >=3.10
install_requires =
pyaro >= 0.0.8
pyaro >= 0.0.10
geocoder_reverse_natural_earth >= 0.0.2
netCDF4
requests
Expand All @@ -48,9 +48,11 @@ pyaro.timeseries =
aeronetsunreader = pyaro_readers.aeronetsunreader:AeronetSunTimeseriesEngine
aeronetsdareader = pyaro_readers.aeronetsdareader:AeronetSdaTimeseriesEngine
ascii2netcdf = pyaro_readers.ascii2netcdf:Ascii2NetcdfTimeseriesEngine
nilupmfebas = pyaro_readers.nilupmfebas:EbasPmfTimeseriesEngine
netcdf_rw = pyaro_readers.netcdf_rw:Netcdf_RWTimeseriesEngine
harp = pyaro_readers.harpreader:AeronetHARPEngine
nilupmfabsorption = pyaro_readers.nilupmfabsorptionreader:NILUPMFAbsorptionTimeseriesEngine
nilupmfebas = pyaro_readers.nilupmfebas:EbasPmfTimeseriesEngine



[tox:tox]
Expand Down
11 changes: 6 additions & 5 deletions src/pyaro_readers/ascii2netcdf/Ascii2NetcdfTimeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ def _get_data_from_ncfile(self, varname, file, data):
if not epdl in nc.variables:
return
vdata = np.ma.filled(nc[epdl][:], np.nan)
if nc[epdl].units != data.units:
logger.warning(
f"units-change for {varname} in {file}: {nc[epdl].units} != {data.units}"
)
if "units" in nc[epdl].ncattrs():
if nc[epdl].units != data.units:
logger.warning(
f"units-change for {varname} in {file}: {nc[epdl].units} != {data.units}"
)

# get all arrays into same size, time fastes moving, i.e. [station][time]
dstruct = {}
Expand Down Expand Up @@ -203,7 +204,7 @@ def _get_data_from_ncfile(self, varname, file, data):
for key in dstruct.keys():
dstruct[key] = dstruct[key][idx]

dstruct["flags"] = dstruct["data"].astype("i4")
dstruct["flags"] = np.zeros(len(dstruct["data"]), "i4")
dstruct["flags"][:] = Flag.VALID

data.append(
Expand Down
Loading

0 comments on commit 95d86e2

Please sign in to comment.