Skip to content

Commit

Permalink
remove clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Jurgen Griesfeller committed May 23, 2024
1 parent 7fe0e2f commit 6eadb08
Showing 1 changed file with 9 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import csv
from io import BytesIO
from urllib.parse import urlparse
from urllib.request import urlopen
from zipfile import BadZipFile, ZipFile
from pathlib import Path
import datetime

from geocoder_reverse_natural_earth import Geocoder_Reverse_NE

import numpy as np
import requests
from pyaro.timeseries import (
AutoFilterReaderEngine,
Data,
Expand All @@ -19,28 +14,6 @@
)
from tqdm import tqdm

# default URL
# BASE_URL = "https://secondary-data-archive.nilu.no/ebas/gen.h8ds-8596/EIMPs_winter2017-2018_data.zip"
# BASE_URL = "/lustre/storeB/project/fou/kl/emep/People/danielh/projects/pyaerocom/obs/nilu_pmf/cameo_2024/EIMPs_winter2017-2018_data/"
# ABSORB_FOLDER = "EIMPs_winter_2017_2018_absorption/"
# LEVO_FOLDER = "EIMPs_winter_2017_2018_ECOC_Levo/"
# METADATA_FILE = "Sites_EBC-campaign.xlsx"
# number of lines to read before the reading is handed to Pythobn's csv reader
HEADER_LINE_NO = 7
DELIMITER = ","
#
# NAN_VAL = -999.0
# update progress bar every N lines...
# PG_UPDATE_LINES = 100
# main variables to store
# LAT_NAME = "Station latitude"
# LON_NAME = "Station longitude"
# ALT_NAME = "Station altitude"
# STAT_CODE = "Station code"
# STAT_NAME = "Station name"
# DATE_NAME = "Date(dd:mm:yyyy)"
# TIME_NAME: str = "Time(hh:mm:ss)"

BABAS_BB_NAME = "Babs_bb"
BABAS_FF_NAME = "Babs_ff"
EBC_BB_NAME = "eBC_bb"
Expand Down Expand Up @@ -79,15 +52,13 @@

FILL_COUNTRY_FLAG = True

TS_TYPE_DIFFS = {
"daily": np.timedelta64(12, "h"),
"instantaneous": np.timedelta64(0, "s"),
"points": np.timedelta64(0, "s"),
"monthly": np.timedelta64(15, "D"),
}


class NILUPMFAbsorptionReader(AutoFilterReaderEngine.AutoFilterReader):
"""reading class for NILU PMF absortion data (campeign)
WARNING: although the data is in NASA AMES format, it's not in EBAS
NASA AMES format and therefore can't be read with the standard EBAS reader
"""

def __init__(
self,
filename,
Expand Down Expand Up @@ -187,9 +158,7 @@ def _process_open_file(
float(x) if abs(float(x) - NAN_CODE) > NAN_EPS else np.nan
for x in line.split()
]
starttime = startdate + datetime.timedelta(
hours=int(line_entries[0] * 24)
) # startdate + datetime.timedelta(hours=line_entries[0])
starttime = startdate + datetime.timedelta(hours=int(line_entries[0] * 24))
endtime = startdate + datetime.timedelta(hours=int(line_entries[0] * 24))

for key in data_indecies:
Expand Down Expand Up @@ -239,7 +208,9 @@ def open(self, filename, *args, **kwargs) -> NILUPMFAbsorptionReader:
return self.reader_class()(filename, *args, **kwargs)

def description(self):
return "Simple reader of Nilu PMF-files using the pyaro infrastructure"
return (
"Simple reader of Nilu PMF absortion files using the pyaro infrastructure"
)

def url(self):
return "https://github.com/metno/pyaro-readers"

0 comments on commit 6eadb08

Please sign in to comment.