Skip to content

Commit

Permalink
Merge pull request #40 from initze/053_dev
Browse files Browse the repository at this point in the history
053 dev
  • Loading branch information
initze authored Dec 11, 2024
2 parents 503c162 + 39fbb2b commit 0725163
Show file tree
Hide file tree
Showing 27 changed files with 477 additions and 357 deletions.
13 changes: 0 additions & 13 deletions environment.yml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/example_daily_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: Ingmar Nitze
"""

from noaaplotter.noaaplotter import NOAAPlotter
from src.noaaplotter import NOAAPlotter
import logging

def main():
Expand Down
2 changes: 1 addition & 1 deletion examples/example_daily_series_winter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author: Ingmar Nitze
"""

from noaaplotter.noaaplotter import NOAAPlotter
from src.noaaplotter import NOAAPlotter
import logging

def main():
Expand Down
2 changes: 1 addition & 1 deletion examples/example_monthly_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
author: Ingmar Nitze
"""

from noaaplotter.noaaplotter import NOAAPlotter
from src.noaaplotter import NOAAPlotter
import logging

def main():
Expand Down
1 change: 0 additions & 1 deletion noaaplotter/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from noaaplotter import *
95 changes: 0 additions & 95 deletions noaaplotter/download_utils.py

This file was deleted.

16 changes: 8 additions & 8 deletions noaaplotter/noaaplotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
# version: 2021-09-06

import numpy as np
from matplotlib import dates

########################
from matplotlib import pyplot as plt, dates
import matplotlib.dates as mdates

from .dataset import NOAAPlotterDailyClimateDataset as DS_daily
from .dataset import NOAAPlotterDailySummariesDataset as Dataset
from .dataset import NOAAPlotterMonthlyClimateDataset as DS_monthly
from .plot_utils import *
from .utils import *
from matplotlib import pyplot as plt

from noaaplotter.utils.dataset import NOAAPlotterDailyClimateDataset as DS_daily
from noaaplotter.utils.dataset import NOAAPlotterDailySummariesDataset as Dataset
from noaaplotter.utils.dataset import NOAAPlotterMonthlyClimateDataset as DS_monthly
from noaaplotter.utils.plot_utils import *
from noaaplotter.utils.utils import *

pd.plotting.register_matplotlib_converters()
numeric_only = True
Expand Down
Binary file not shown.
Binary file not shown.
96 changes: 96 additions & 0 deletions noaaplotter/scripts/download_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Imports
import argparse

from noaaplotter.utils.download_utils import download_from_noaa


def main():
"""
Main Function
:return:
"""
##### Parse arguments #####
parser = argparse.ArgumentParser(description="Parse arguments.")

parser.add_argument(
"-o",
dest="output_file",
type=str,
required=True,
default="data/data.csv",
help="csv file to save results",
)

parser.add_argument(
"-t", dest="token", type=str, required=False, default="", help="NOAA API token"
)

parser.add_argument(
"-sid",
dest="station_id",
type=str,
required=False,
default="",
help='NOAA Station ID, e.g. "GHCND:USW00026616" for Kotzebue, only if loading through NOAA API',
)

parser.add_argument(
"-loc",
dest="loc_name",
type=str,
required=False,
default="",
help="Location name",
)

parser.add_argument(
"-dt",
dest="datatypes",
type=list,
required=False,
default=["TMIN", "TMAX", "PRCP", "SNOW"],
)

parser.add_argument(
"-start",
dest="start_date",
type=str,
required=True,
help='start date of plot ("yyyy-mm-dd")',
)

parser.add_argument(
"-end",
dest="end_date",
type=str,
required=True,
help='end date of plot ("yyyy-mm-dd")',
)

parser.add_argument(
"-n_jobs",
dest="n_jobs",
type=int,
required=False,
default=1,
help="number of parallel processes",
)

args = parser.parse_args()

download_from_noaa(
output_file=args.output_file,
start_date=args.start_date,
end_date=args.end_date,
datatypes=args.datatypes,
noaa_api_token=args.token,
loc_name=args.loc_name,
station_id=args.station_id,
n_jobs=args.n_jobs,
)


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import argparse
import os

from noaaplotter.download_utils import download_era5_from_gee
from src.download_utils import download_era5_from_gee


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas as pd
import tqdm
from joblib import delayed, Parallel
from noaaplotter.utils import dl_noaa_api
from noaaplotter.utils. import dl_noaa_api
import ee
import geemap

Expand Down
File renamed without changes.
File renamed without changes.
Empty file added noaaplotter/utils/__init__.py
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Loading

0 comments on commit 0725163

Please sign in to comment.