Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Development

* Placeholder

0.3.25
-------
* Adding international capability to EEWeather (international.py), plus testing & new samples.

0.3.24
------

Expand Down
23 changes: 11 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ RUN groupadd --gid 1000 node \
# gpg keys listed at https://github.com/nodejs/node#release-team
RUN set -ex \
&& for key in \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
4ED778F539E3634C779C87C6D7062848A1AB005C \
141F07595B7B3FFE74309A937405533BE57C7D57 \
74F12602B6F1C4E913FAA37AD3A89613643B6201 \
DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
56730D5401028683275BD23C23EFEFE93C4CFFFE \
77984A986EBC2AA786BC0F66B01FBB92821C587A \
; do \
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
108F52B48DB57BB0CC439B2997B01419BD92F80A \
; do \
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key";\
done

ENV NODE_VERSION 10.0.0
Expand All @@ -34,7 +33,7 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& curl -SLO --compressed "https://nodejs.org/dist/v10.0.0/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
Expand Down
7 changes: 7 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
API Docs
========

International
-------

.. autofunction:: eeweather.get_weather_intl

.. autofunction:: eeweather.get_weather_intervals_for_similar_sites

Ranking
-------

Expand Down
4 changes: 3 additions & 1 deletion eeweather/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
"""

Copyright 2018 Open Energy Efficiency, Inc.
Copyright 2023 Open Energy Efficiency, Inc and the Society for
the Reduction of Carbon, Ltd (T/A Carbon Co-op).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -102,6 +103,7 @@
load_cached_cz2010_hourly_temp_data,
)
from .visualization import plot_station_mapping, plot_station_mappings
from .international import *


def get_version():
Expand Down
12 changes: 6 additions & 6 deletions eeweather/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def _download_primary_sources():


def _load_isd_station_metadata(download_path):
""" Collect metadata for US isd stations.
"""
"""Collect metadata for US isd stations."""
from shapely.geometry import Point

# load ISD history which contains metadata
Expand All @@ -183,7 +182,9 @@ def _load_isd_station_metadata(download_path):
isAus = isd_history.CTRY == "AS"

metadata = {}
for usaf_station, group in isd_history[hasGEO & hasUSAF & (isUS | isAus)].groupby("USAF"):
for usaf_station, group in isd_history[hasGEO & hasUSAF & (isUS | isAus)].groupby(
"USAF"
):
# find most recent
recent = group.loc[group.END.idxmax()]
wban_stations = list(group.WBAN)
Expand All @@ -206,8 +207,7 @@ def _load_isd_station_metadata(download_path):


def _load_isd_file_metadata(download_path, isd_station_metadata):
""" Collect data counts for isd files.
"""
"""Collect data counts for isd files."""

isd_inventory = pd.read_csv(
os.path.join(download_path, "isd-inventory.csv"), dtype=str
Expand Down Expand Up @@ -1137,7 +1137,7 @@ def build_metadata_db(
ba_climate_zone_geometry=True,
ca_climate_zone_geometry=True,
):
""" Build database of metadata from primary sources.
"""Build database of metadata from primary sources.

Downloads primary sources, clears existing DB, and rebuilds from scratch.

Expand Down
20 changes: 11 additions & 9 deletions eeweather/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EEWeatherError(Exception):


class UnrecognizedUSAFIDError(EEWeatherError):
""" Raised when an unrecognized USAF station id is encountered.
"""Raised when an unrecognized USAF station id is encountered.

Attributes
----------
Expand All @@ -45,7 +45,7 @@ def __init__(self, value):


class UnrecognizedZCTAError(EEWeatherError):
""" Raised when an unrecognized ZCTA is encountered.
"""Raised when an unrecognized ZCTA is encountered.

Attributes
----------
Expand All @@ -57,13 +57,15 @@ class UnrecognizedZCTAError(EEWeatherError):

def __init__(self, value):
self.value = value
self.message = 'The value "{}" was not recognized as a valid ZCTA identifier.'.format(
value
self.message = (
'The value "{}" was not recognized as a valid ZCTA identifier.'.format(
value
)
)


class ISDDataNotAvailableError(EEWeatherError):
""" Raised when ISD data is not available for a particular station and year.
"""Raised when ISD data is not available for a particular station and year.

Attributes
----------
Expand All @@ -84,7 +86,7 @@ def __init__(self, usaf_id, year):


class GSODDataNotAvailableError(EEWeatherError):
""" Raised when GSOD data is not available for a particular station and year.
"""Raised when GSOD data is not available for a particular station and year.

Attributes
----------
Expand All @@ -101,7 +103,7 @@ def __init__(self, usaf_id, year):


class TMY3DataNotAvailableError(EEWeatherError):
""" Raised when TMY3 data is not available for a particular station.
"""Raised when TMY3 data is not available for a particular station.

Attributes
----------
Expand All @@ -117,7 +119,7 @@ def __init__(self, usaf_id):


class CZ2010DataNotAvailableError(EEWeatherError):
""" Raised when CZ2010 data is not available for a particular station.
"""Raised when CZ2010 data is not available for a particular station.

Attributes
----------
Expand All @@ -133,7 +135,7 @@ def __init__(self, usaf_id):


class NonUTCTimezoneInfoError(EEWeatherError):
""" Raised when input start and end date aren't explicitly defined
"""Raised when input start and end date aren't explicitly defined
to have a UTC timezone.

Attributes
Expand Down
4 changes: 2 additions & 2 deletions eeweather/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def climate_zone_geometry(self):


def get_lat_long_climate_zones(latitude, longitude):
""" Get climate zones that contain lat/long coordinates.
"""Get climate zones that contain lat/long coordinates.

Parameters
----------
Expand Down Expand Up @@ -162,7 +162,7 @@ def get_lat_long_climate_zones(latitude, longitude):


def get_zcta_metadata(zcta):
""" Get metadata about a ZIP Code Tabulation Area (ZCTA).
"""Get metadata about a ZIP Code Tabulation Area (ZCTA).

Parameters
----------
Expand Down
Loading