Skip to content

Commit 0474b61

Browse files
committed
Fixed merge conflict
2 parents 27b5e74 + 5ee75b3 commit 0474b61

File tree

77 files changed

+1840
-525
lines changed

Some content is hidden

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

77 files changed

+1840
-525
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ tests/proxy/.tox/*
1616
.cache
1717
.eggs/
1818
htmlcov/*
19+
venv
1920

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ language: python
33
python:
44
- "3.7"
55
- "3.8"
6+
- "3.9-dev"
67
script: tox
78
after_success:
89
- coveralls
@@ -34,13 +35,17 @@ jobs:
3435
script: bash tests/local_installation_test.sh
3536
- <<: *local_installation_test
3637
python: "3.8"
38+
- <<: *local_installation_test
39+
python: "3.9-dev"
3740

3841
- &coverage
3942
stage: "Coverage"
4043
python: "3.7"
4144
script: coverage run --rcfile=.coveragerc setup.py test -s tests.unit
4245
- <<: *coverage
4346
python: "3.8"
47+
- <<: *coverage
48+
python: "3.9-dev"
4449

4550
- stage: "Build docs"
4651
script: cd sphinx && make clean && make html
@@ -51,6 +56,8 @@ jobs:
5156
script: bash deploy/deploy_to_pypi.sh
5257
- <<: *deploy_to_pypi
5358
python: "3.8"
59+
- <<: *deploy_to_pypi
60+
python: "3.9-dev"
5461

5562
- &pypi_installation_test
5663
stage: "PyPI Installation Test"
@@ -59,3 +66,5 @@ jobs:
5966
script: bash tests/pypi_installation_test.sh
6067
- <<: *pypi_installation_test
6168
python: "3.8"
69+
- <<: *pypi_installation_test
70+
python: "3.9-dev"

CONTRIBUTORS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ Contributors will be shown in alphabetical order
55

66
Code
77
----
8+
* [ahertz](https://github.com/ahertz)
89
* [alechewitt](https://github.com/alechewitt)
910
* [camponez](https://github.com/camponez)
11+
* [Darumin](https://github.com/Darumin)
1012
* [dev-iks](https://github.com/dev-iks)
1113
* [dphildebrandt](https://github.com/dphildebrandt)
1214
* [dstmar](https://github.com/dstmar)
1315
* [edenhaus](https://github.com/edenhaus)
1416
* [eumiro](https://github.com/eumiro)
1517
* [ggstuart](https://github.com/ggstuart)
18+
* [irahorecka](https://github.com/irahorecka)
1619
* [jwmelvin](https://github.com/jwmelvin)
1720
* [lardconcepts](https://github.com/lardconcepts)
1821
* [liato](https://github.com/liato)
1922
* [LukasBoersma](https://github.com/LukasBoersma)
23+
* [MatthiasLohr](https://github.com/MatthiasLohr)
2024
* [Misiu](https://github.com/Misiu)
2125
* [Noid](https://github.com/n0id)
2226
* [titilambert](https://github.com/titilambert)
@@ -26,9 +30,11 @@ Code
2630

2731
Docs
2832
----
33+
* [Crozzers](https://github.com/Crozzers)
2934
* [EJEP](https://github.com/EJEP)
3035
* [Franzqat](https://github.com/franzqat)
3136
* [Harmon758](https://github.com/Harmon758)
37+
* [joe-meyer](https://github.com/joe-meyer)
3238

3339
Testing
3440
-------
@@ -40,6 +46,7 @@ Testing
4046
Packaging and Distribution
4147
--------------------------
4248
* [Diapente](https://github.com/Diapente)
49+
* [onkelbeh](https://github.com/onkelbeh)
4350
* [Simone-Zabberoni](https://github.com/Simone-Zabberoni)
4451

4552
Wiki

Pipfile.lock

Lines changed: 177 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ With PyOWM you can integrate into your code any of the following OpenWeatherMap
3232
- **Stations API v3.0**, allowing to create and manage meteostation and publish local weather measurements
3333
- **Weather Alerts API v3.0**, allowing to set triggers on weather conditions and areas and poll for spawned alerts
3434
- **Image tiles** for several map layers provided by OWM
35+
- **Geocoding API v1.0** allowing to perform direct/reverse geocoding
36+
37+
38+
## In case of trouble...
39+
Please **read the [FAQ](https://pyowm.readthedocs.io/en/latest/v3/faq.html)** before filing a new issue on GitHub! There are many common issues, therefore a fix for your issue might come easier than you think
3540

3641
## Get started
3742

@@ -107,11 +112,6 @@ The library software API documentation is available on [Read the Docs](https://p
107112
The [Code recipes](https://pyowm.readthedocs.io/en/latest/v3/code-recipes.html) section comes in handy!
108113

109114

110-
## Help - PyOWM is giving me errors!
111-
Please read the [FAQ](https://pyowm.readthedocs.io/en/latest/v3/faq.html) section of the documentation before filing a new issue on GitHub!
112-
113-
There are many common issues, therefore a fix for your issue might come easier than you think
114-
115115
## Community & Contributing
116116

117117
Here are [some cool projects](https://github.com/csparpa/pyowm/wiki/Community-Projects-using-PyOWM) that use PyOWM

pyowm/agroapi10/agro_manager.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ def create_polygon(self, geopolygon, name=None):
5151
"""
5252
assert geopolygon is not None
5353
assert isinstance(geopolygon, GeoPolygon)
54-
data = dict()
55-
data['geo_json'] = {
56-
"type": "Feature",
57-
"properties": {},
58-
"geometry": geopolygon.to_dict()
54+
data = {
55+
'geo_json': {
56+
"type": "Feature",
57+
"properties": {},
58+
"geometry": geopolygon.to_dict(),
59+
}
5960
}
61+
6062
if name is not None:
6163
data['name'] = name
6264
status, payload = self.http_client.post(
@@ -144,12 +146,14 @@ def soil_data(self, polygon):
144146
params={'appid': self.API_key,
145147
'polyid': polyd},
146148
headers={'Content-Type': 'application/json'})
147-
the_dict = dict()
148-
the_dict['reference_time'] = data['dt']
149-
the_dict['surface_temp'] = data['t0']
150-
the_dict['ten_cm_temp'] = data['t10']
151-
the_dict['moisture'] = data['moisture']
152-
the_dict['polygon_id'] = polyd
149+
the_dict = {
150+
'reference_time': data['dt'],
151+
'surface_temp': data['t0'],
152+
'ten_cm_temp': data['t10'],
153+
'moisture': data['moisture'],
154+
'polygon_id': polyd,
155+
}
156+
153157
return Soil.from_dict(the_dict)
154158

155159
# Satellite Imagery subset methods
@@ -271,7 +275,7 @@ def download_satellite_image(self, metaimage, x=None, y=None, zoom=None, palette
271275
params = dict(paletteid=palette)
272276
else:
273277
palette = PaletteEnum.GREEN
274-
params = dict()
278+
params = {}
275279
# polygon PNG
276280
if isinstance(metaimage, MetaPNGImage):
277281
prepared_url = metaimage.url
@@ -309,7 +313,7 @@ def stats_for_satellite_image(self, metaimage):
309313
:type metaimage: a `pyowm.agroapi10.imagery.MetaImage` subtype
310314
:return: dict
311315
"""
312-
if metaimage.preset != PresetEnum.EVI and metaimage.preset != PresetEnum.NDVI:
316+
if metaimage.preset not in [PresetEnum.EVI, PresetEnum.NDVI]:
313317
raise ValueError("Unsupported image preset: should be EVI or NDVI")
314318
if metaimage.stats_url is None:
315319
raise ValueError("URL for image statistics is not defined")

pyowm/agroapi10/imagery.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ def __init__(self, url, preset, satellite_name, acquisition_time,
4747
assert isinstance(acquisition_time, int)
4848
assert acquisition_time >= 0, 'acquisition_time cannot be negative'
4949
self._acquisition_time = acquisition_time
50-
assert isinstance(valid_data_percentage, float) or isinstance(valid_data_percentage, int)
50+
assert isinstance(valid_data_percentage, (float, int))
5151
assert valid_data_percentage >= 0., 'valid_data_percentage cannot be negative'
5252
self.valid_data_percentage = valid_data_percentage
53-
assert isinstance(cloud_coverage_percentage, float) or isinstance(cloud_coverage_percentage, int)
53+
assert isinstance(cloud_coverage_percentage, (float, int))
5454
assert cloud_coverage_percentage >= 0., 'cloud_coverage_percentage cannot be negative'
5555
self.cloud_coverage_percentage = cloud_coverage_percentage
56-
assert isinstance(sun_azimuth, float) or isinstance(sun_azimuth, int)
56+
assert isinstance(sun_azimuth, (float, int))
5757
assert sun_azimuth >= 0. and sun_azimuth <= 360., 'sun_azimuth must be between 0 and 360 degrees'
5858
self.sun_azimuth = sun_azimuth
59-
assert isinstance(sun_elevation, float) or isinstance(sun_elevation, int)
59+
assert isinstance(sun_elevation, (float, int))
6060
assert sun_elevation >= 0. and sun_elevation <= 90., 'sun_elevation must be between 0 and 90 degrees'
6161
self.sun_elevation = sun_elevation
6262
self.polygon_id = polygon_id
@@ -122,7 +122,7 @@ class SatelliteImage:
122122
def __init__(self, metadata, data, downloaded_on=None, palette=None):
123123
assert isinstance(metadata, MetaImage)
124124
self.metadata = metadata
125-
assert isinstance(data, Image) or isinstance(data, Tile)
125+
assert isinstance(data, (Image, Tile))
126126
self.data = data
127127
if downloaded_on is not None:
128128
assert isinstance(downloaded_on, int)

pyowm/agroapi10/polygon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, id, name=None, geopolygon=None, center=None, area=None, user_
3535
if center is not None:
3636
assert isinstance(center, GeoPoint), 'Polygon center must be a valid geopoint type'
3737
if area is not None:
38-
assert isinstance(area, float) or isinstance(area, int), 'Area must be a numeric type'
38+
assert isinstance(area, (float, int)), 'Area must be a numeric type'
3939
assert area >= 0, 'Area must not be negative'
4040
self.id = id
4141
self.name = name

pyowm/agroapi10/search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, polygon_id, list_of_dict, query_timestamp):
3737
self.query_timestamp = query_timestamp
3838

3939
# parse raw data
40-
result = list()
40+
result = []
4141
for the_dict in list_of_dict:
4242
# common metadata
4343
acquisition_time = the_dict.get('dt', None)
@@ -180,7 +180,7 @@ def with_img_type(self, image_type):
180180

181181
def with_preset(self, preset):
182182
"""
183-
Returns the seach results having the specified preset
183+
Returns the search results having the specified preset
184184
185185
:param preset: the desired image preset (valid values are provided by the
186186
`pyowm.agroapi10.enums.PresetEnum` enum)

pyowm/agroapi10/soil.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ def __init__(self, reference_time, surface_temp, ten_cm_temp, moisture, polygon_
3030
raise ValueError("reference_time must be greater than 0")
3131
self._reference_time = reference_time
3232
assert surface_temp is not None
33-
assert isinstance(surface_temp, float) or isinstance(surface_temp, int), 'surface_temp must be a number'
33+
assert isinstance(surface_temp, (float, int)), 'surface_temp must be a number'
3434
self._surface_temp = surface_temp
3535
assert ten_cm_temp is not None
36-
assert isinstance(ten_cm_temp, float) or isinstance(ten_cm_temp, int), 'ten_cm_temp must be a number'
36+
assert isinstance(ten_cm_temp, (float, int)), 'ten_cm_temp must be a number'
3737
self._ten_cm_temp = ten_cm_temp
3838
assert moisture is not None
39-
assert isinstance(moisture, float) or isinstance(moisture, int), 'moisture must be a number'
39+
assert isinstance(moisture, (float, int)), 'moisture must be a number'
4040
if moisture < 0.:
4141
raise ValueError("moisture must be greater than 0")
4242
self.moisture = moisture

0 commit comments

Comments
 (0)