Skip to content

Commit a0f44f0

Browse files
author
Matt Bertrand
committed
Descriptions for processors; headers for files.
1 parent bafeb2e commit a0f44f0

44 files changed

Lines changed: 990 additions & 42 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dataqs/airnow/airnow.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1-
from __future__ import absolute_import
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
219

20+
from __future__ import absolute_import
321
from ftplib import FTP
422
import logging
523
import os
@@ -32,6 +50,31 @@ class AirNowGRIB2HourlyProcessor(GeoDataMosaicProcessor):
3250
"airnow_aqi_combined"]
3351
img_patterns = ["", "_pm25", "_combined"]
3452
layer_titles = ["Ozone", "PM25", "Combined Ozone & PM25"]
53+
description = """
54+
U.S. Environmental Protection Agency’s (EPA) nationwide, voluntary program,
55+
AirNow(www.airnow.gov), provides real-time air quality data and forecasts to
56+
protect public health across the United States, Canada, and parts of Mexico.
57+
AirNowreceives real-time ozone and PM2.5data from over 2,000 monitors and
58+
collects air quality forecasts for more than 300 cities.
59+
60+
As part of the Global Earth Observation System of Systems (GEOSS)
61+
(www.epa.gov/geoss) program, the AirNow API system broadens access to AirNowdata
62+
and data products. AirNow API produces data products in several standard data
63+
formats and makes them available via FTP and web services. This document
64+
describes the GRIB2 file formats.
65+
66+
All data provided by AirNow API are made possible by the efforts of more than
67+
120 local, state, tribal, provincial, and federal government agencies
68+
(www.airnow.gov/index.cfm?action=airnow.partnerslist). These data are not fully
69+
verified or validated and should be considered preliminary and subject to
70+
change. Data and information reported to AirNow from federal, state, local, and
71+
tribal agencies are for the express purpose of reporting and forecasting the
72+
Air Quality Index (AQI). As such, they should not be used to formulate or
73+
support regulation, trends, guidance, or any other government or public
74+
decision making. Official regulatory air quality data must be obtained from
75+
EPA’s Air Quality System (AQS) (www.epa.gov/ttn/airs/airsaqs). See the AirNow
76+
Data Exchange Guidelines at http://airnowapi.org/docs/DataUseGuidelines.pdf.
77+
"""
3578

3679
def download(self, auth_account=AIRNOW_ACCOUNT, days=1):
3780
"""
@@ -118,7 +161,8 @@ def run(self, days=1):
118161
with open(os.path.join(
119162
script_dir, 'resources/airnow.sld')) as sld:
120163
self.set_default_style(layer_name, layer_name, sld.read())
121-
self.update_geonode(layer_name, title=layer_title, store=layer_name)
164+
self.update_geonode(layer_name, title=layer_title,
165+
description=self.description, store=layer_name)
122166
self.truncate_gs_cache(layer_name)
123167
self.cleanup()
124168

dataqs/airnow/tasks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
from __future__ import absolute_import
221

322
from celery import shared_task

dataqs/airnow/tests.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
import glob
221
import zipfile
322
import os

dataqs/aqicn/aqicn.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
import json
221
import logging
322
import os
@@ -100,7 +119,7 @@ def __init__(self, table, cities):
100119
def handle_city(self, i, city):
101120
try:
102121
logger.debug('Scraping %d of %d cities - %s' % (
103-
i+1, len(self.cities), city['url']))
122+
i + 1, len(self.cities), city['url']))
104123
time.sleep(randint(1, self.max_wait))
105124
page = requests.get(city['url'], timeout=60, headers=REQ_HEADER)
106125
page.raise_for_status()
@@ -241,6 +260,8 @@ class AQICNProcessor(GeoDataProcessor):
241260
'uvi': 'Ultraviolet Index',
242261
'w': 'Wind Speed'
243262
}
263+
description = \
264+
'Air quality index data scraped from http://aqicn.org every 3 hours.'
244265

245266
def __init__(self, countries=None, cities=None):
246267
super(AQICNProcessor, self).__init__()
@@ -279,9 +300,9 @@ def split_list(self, num):
279300
""" Yield n successive lists from cities list.
280301
"""
281302
newn = int(1.0 * len(self.cities) / num + 0.5)
282-
for i in xrange(0, num-1):
283-
yield self.cities[i*newn:i*newn+newn]
284-
yield self.cities[num*newn-newn:]
303+
for i in xrange(0, num - 1):
304+
yield self.cities[i * newn:i * newn + newn]
305+
yield self.cities[num * newn - newn:]
285306

286307
def process(self):
287308
if not table_exists(self.prefix):
@@ -307,10 +328,12 @@ def run(self):
307328
self.set_default_style(layer_name, layer_name, sld.read())
308329
self.update_geonode(layer_name,
309330
title='Air Quality Index',
331+
description=self.description,
310332
store=datastore)
311333
self.truncate_gs_cache(layer_name)
312334
self.cleanup()
313335

336+
314337
if __name__ == '__main__':
315338
parser = AQICNProcessor()
316339
parser.run()

dataqs/aqicn/tasks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
from __future__ import absolute_import
221
from celery import shared_task
322
from dataqs.aqicn.aqicn import AQICNProcessor

dataqs/aqicn/tests.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
import json
221
import os
322
import datetime

dataqs/csv_helpers.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
import csv
221
import codecs
322
import cStringIO

dataqs/forecastio/forecastio_air.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
from __future__ import absolute_import
221

322
import logging
@@ -22,6 +41,13 @@ class ForecastIOAirTempProcessor(GeoDataMosaicProcessor):
2241
prefix = "forecast_io_airtemp"
2342
base_url = "http://maps.forecast.io/temperature/"
2443
layer_name = "forecast_io_airtemp"
44+
description = """Project Quicksilver is an experimental new data product
45+
that attempts to create the world's highest resolution real-time map of global
46+
(near-surface) air temperature.\n\n
47+
It is generated using the same source data models that power Forecast.io,
48+
combined with a sophisticated microclimate model that adjusts the temperatures
49+
based on the effects of elevation, terrain, proximity to water, foliage cover,
50+
and other factors.\n\nSource: http://blog.forecast.io/project-quicksilver/"""
2551

2652
def parse_name(self, img_date):
2753
imgstrtime = img_date.strftime("%Y-%m-%d %H:00")
@@ -94,6 +120,7 @@ def run(self, now=None):
94120
self.drop_old_daily_images(now, self.layer_name)
95121

96122
self.update_geonode(self.layer_name, title=self.parse_name(now),
123+
description=self.description,
97124
store=self.layer_name,
98125
bounds=('-180.0', '180.0',
99126
'-90.0', '90.0', 'EPSG:4326'))

dataqs/forecastio/tasks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
from __future__ import absolute_import
221

322
from celery import shared_task

dataqs/forecastio/tests.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
###############################################################################
5+
# Copyright Kitware Inc. and Epidemico Inc.
6+
#
7+
# Licensed under the Apache License, Version 2.0 ( the "License" );
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
###############################################################################
19+
120
import glob
221
import zipfile
322
import os

0 commit comments

Comments
 (0)