Skip to content

Commit 73213a5

Browse files
committed
Merge branch 'bugfix-docs' into develop
2 parents ec7c802 + 6ca0d83 commit 73213a5

File tree

126 files changed

+634
-427
lines changed

Some content is hidden

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

126 files changed

+634
-427
lines changed

.github/workflows/basemap-for-manylinux.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,65 @@ jobs:
349349
name: coverage
350350
path: ${{ env.PKGDIR }}/htmlcov
351351

352+
docs:
353+
needs: test
354+
runs-on: ubuntu-latest
355+
container: "pylegacy/python:3.8-debian-9"
356+
steps:
357+
-
358+
name: Download checkout
359+
uses: actions/download-artifact@v1
360+
with:
361+
name: checkout
362+
path: .
363+
-
364+
name: Install doc requirements
365+
run: |
366+
cd ${{ env.PKGDIR }}
367+
pip install -r requirements-doc.txt
368+
-
369+
name: Download build artifacts
370+
uses: actions/download-artifact@v1
371+
with:
372+
name: artifacts-build-x64-3.8
373+
path: ${{ env.PKGDIR }}/dist
374+
-
375+
name: Install package
376+
run: |
377+
cd ${{ env.PKGDIR }}
378+
pip install dist/*-manylinux1*.whl
379+
-
380+
name: Run sphinx
381+
run: |
382+
cd ${{ env.PKGDIR }}
383+
python -m sphinx doc/source public
384+
-
385+
name: Upload docs artifacts
386+
uses: actions/upload-artifact@v1
387+
with:
388+
name: docs
389+
path: ${{ env.PKGDIR }}/public
390+
-
391+
name: Upload github-pages artifact
392+
uses: actions/upload-pages-artifact@v2
393+
with:
394+
name: github-pages
395+
path: ${{ env.PKGDIR }}/public
396+
397+
pages:
398+
needs: docs
399+
runs-on: ubuntu-latest
400+
environment:
401+
name: github-pages
402+
url: ${{ steps.deployment.outputs.page_url }}
403+
permissions:
404+
pages: write
405+
id-token: write
406+
steps:
407+
- name: Deploy github-pages
408+
uses: actions/deploy-pages@v2
409+
id: deployment
410+
352411
upload:
353412
strategy:
354413
matrix:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ https://semver.org/spec/v2.0.0.html
3838
- Upgrade upper limit for `furo` to 2023.9.11.
3939
- Move dependency on `netCDF4` to `requirements-doc.txt`.
4040
- Set dependency on `cftime` explicitly in `requirements-doc.txt`.
41+
- Set dependency on `scipy` explicitly in `requirements-doc.txt`.
4142
- Update lint dependencies:
4243
- Downgrade upper limit for `flake8` to 6.2.
4344
- Upgrade upper limit for `astropy` to 3.1.

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Basic requirements are the following:
1616
Optional requirements include:
1717

1818
* [OWSLib](https://github.com/geopython/OWSLib). It is needed for the
19-
`Basemap.wmsimage` function.
19+
method `Basemap.wmsimage`.
2020

2121
* [Pillow](https://github.com/python-pillow/Pillow). It is needed for
2222
the methods `Basemap.bluemarble`, `Basemap.etopo`,
@@ -25,7 +25,7 @@ Optional requirements include:
2525
## Installation
2626

2727
The `basemap-data` and `basemap-data-hires` packages are available in
28-
PyPI and can be installed with [`pip`](https:/pip.pypa.io/):
28+
PyPI and can be installed with [`pip`](https://pip.pypa.io/):
2929
```sh
3030
python -m pip install basemap-data
3131
python -m pip install basemap-data-hires
@@ -37,7 +37,8 @@ available in PyPI (architectures x86 and x64, Python 2.7 and 3.5+):
3737
python -m pip install basemap
3838
```
3939

40-
Otherwise, you will need to install `basemap` from source as follows:
40+
Otherwise, you will need to install `basemap` from its source hosted
41+
on GitHub as indicated in the following steps:
4142

4243
1. Install pre-requisite Python modules:
4344
- [cython](https://github.com/cython/cython)
@@ -51,7 +52,8 @@ Otherwise, you will need to install `basemap` from source as follows:
5152
```
5253

5354
3. Build the [GEOS](https://github.com/libgeos/geos) library. You may
54-
use the helper provided in `utils`, i.e.
55+
use the helper provided in `utils`, (please note that you need
56+
[`CMake`](https://cmake.org/) and a working C compiler in advance):
5557
```sh
5658
export GEOS_DIR=<your desired location>
5759
python -c "import utils; utils.GeosLibrary('3.6.5').build(installdir='${GEOS_DIR}')"
@@ -70,11 +72,10 @@ Otherwise, you will need to install `basemap` from source as follows:
7072
to build Cython extensions (e.g. on Debian-like systems, you should
7173
have the package `python-dev` installed).
7274

73-
5. Check that the package installed correctly by executing:
75+
5. Check that the package was installed correctly by executing:
7476
```sh
7577
python -c "from mpl_toolkits.basemap import Basemap"
7678
```
77-
You can also test the examples available in the `examples` folder.
7879

7980
## License
8081

@@ -98,7 +99,7 @@ https://spdx.org/licenses/LGPL-3.0-or-later.html
9899

99100
## Documentation
100101

101-
See https://matplotlib.github.io/basemap/
102+
See https://matplotlib.org/basemap/
102103

103104
See scripts in `examples` directory for example usage.
104105

examples/geos_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def get_input(prompt):
2020
# plot land-sea mask.
2121
# land red, oceans blue.
2222
# lakes=True means plot inland lakes with ocean color.
23+
m.drawmapboundary()
2324
m.drawlsmask(land_color='red',ocean_color='blue',lakes=True)
2425
# draw parallels and meridians.
2526
m.drawparallels(np.arange(-90.,120.,30.))
2627
m.drawmeridians(np.arange(0.,420.,60.))
27-
m.drawmapboundary()
2828
plt.title('Geostationary Map Centered on Lon=%s' % (lon_0))
2929

3030
# map with continents drawn and filled.

examples/geos_demo_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
m = Basemap(projection='geos', lon_0=lon_0, satellite_height=satellite_height,
4040
resolution='l', llcrnrlon=ll_lon, llcrnrlat=ll_lat, urcrnrlon=ur_lon, urcrnrlat=ur_lat)
4141
# add data
42-
m.imshow(data, cmap=plt.cm.gray, interpolation='nearest')
42+
m.imshow(data[::-1], cmap=plt.cm.gray, interpolation='nearest')
4343
plt.clim(0, 255)
4444
# draw coastlines.
4545
m.drawcoastlines(linewidth=0.5, color=overlay_color)

examples/hurrtracks.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
from __future__ import (absolute_import, division, print_function)
2-
31
"""
42
draw Atlantic Hurricane Tracks for storms that reached Cat 4 or 5.
53
part of the track for which storm is cat 4 or 5 is shown red.
64
ESRI shapefile data from http://nationalatlas.gov/mld/huralll.html
75
"""
6+
import os
87
import numpy as np
98
import matplotlib.pyplot as plt
10-
from mpl_toolkits.basemap import Basemap as Basemap
11-
# Lambert Conformal Conic maplt.
9+
from mpl_toolkits.basemap import Basemap
10+
# Lambert Conformal Conic map.
1211
m = Basemap(llcrnrlon=-100.,llcrnrlat=0.,urcrnrlon=-20.,urcrnrlat=57.,
1312
projection='lcc',lat_1=20.,lat_2=40.,lon_0=-60.,
1413
resolution ='l',area_thresh=1000.)
1514
# create figure.
1615
fig=plt.figure()
1716
# read shapefile.
1817
shp_info = m.readshapefile('huralll020','hurrtracks',drawbounds=False)
19-
print(shp_info)
2018
# find names of storms that reached Cat 4.
2119
names = []
2220
for shapedict in m.hurrtracks_info:
@@ -25,8 +23,6 @@
2523
if cat in ['H4','H5'] and name not in names:
2624
# only use named storms.
2725
if name != 'NOT NAMED': names.append(name)
28-
print(names)
29-
print(len(names))
3026
# plot tracks of those storms.
3127
for shapedict,shape in zip(m.hurrtracks_info,m.hurrtracks):
3228
name = shapedict['NAME']

examples/ortho_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def get_input(prompt):
2222
# land coral, oceans aqua.
2323
# lakes=True means plot inland lakes with ocean color.
2424
# resolution = 5 (default) means use 5 min dataset (can use 2.5)
25+
m.drawmapboundary()
2526
m.drawcoastlines()
2627
m.drawlsmask(land_color='coral',ocean_color='aqua', lakes=True,\
2728
resolution=resolution,grid=grid)
2829
# draw parallels and meridians.
2930
m.drawparallels(np.arange(-90.,120.,30.))
3031
m.drawmeridians(np.arange(0.,420.,60.))
31-
m.drawmapboundary()
3232
plt.title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
3333

3434
# map with continents drawn and filled (continent filling fails for

examples/plotcities.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
from __future__ import (absolute_import, division, print_function)
22

3-
from matplotlib.mlab import prctile_rank
3+
import numpy as np
44
import matplotlib.pyplot as plt
55
from mpl_toolkits.basemap import Basemap as Basemap
6+
prctile_rank = lambda x, p: np.searchsorted(np.percentile(x, np.atleast_1d(p)), x)
67

78
# cities colored by population rank.
89

910
m = Basemap()
1011
shp_info = m.readshapefile('cities','cities')
11-
x, y = zip(*m.cities)
12-
pop = []
13-
for item in m.cities_info:
12+
x, y, pop = [], [], []
13+
for item, (x_i, y_i) in zip(m.cities_info, m.cities):
1414
population = item['POPULATION']
15-
if population < 0: continue # population missing
16-
pop.append(population)
17-
popranks = prctile_rank(pop,100)
15+
if population >= 0:
16+
pop.append(population)
17+
x.append(x_i)
18+
y.append(y_i)
19+
popranks = prctile_rank(pop,np.linspace(0, 100, 101))
1820
colors = []
1921
for rank in popranks:
2022
colors.append(plt.cm.jet(float(rank)/100.))

examples/plothighsandlows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def main():
2727
"""Main function."""
2828

2929
# Plot 00 UTC today.
30-
url = "http://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs%Y%m%d/gfs_0p25_00z"
30+
url = "http://nomads.ncep.noaa.gov/dods/gfs_0p50/gfs%Y%m%d/gfs_0p50_00z"
3131
date = dt.datetime.now()
3232

3333
# Open OPeNDAP dataset.

examples/plotozone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
toplot = np.ma.masked_values(o3[0, 0], 0.) * 1000.
6868
bounds = np.percentile(toplot.compressed().ravel(), np.linspace(5, 95, 9).tolist())
69-
ptch = m.pcolor(X, Y, toplot, cmap = WhGrYlBu, norm = plt.matplotlib.colors.BoundaryNorm(bounds, 20), vmin = bounds[0], vmax = bounds[-1])
69+
ptch = m.pcolor(X, Y, toplot, cmap = WhGrYlBu, norm = plt.matplotlib.colors.BoundaryNorm(bounds, 20))
7070

7171
# Add a colorbar using proportional spacing, but
7272
# colors based on 10 distinct bins

0 commit comments

Comments
 (0)