OK, I sorted things out to a degree.

To summarize, here's problematic things for me as a Windows user:

- When you clone from git and conda install ocw, and it leads to the
confusing situation I was in where the example is using the old conda ocw
package.
- The example seems to depend on "proj4" but that's not installed as an ocw
dependency.
- matplotlib 2.2.2 mpl_toolkits/axes_grid1 has a bug where it won't produce
an n*m grid of plots. This appears to be fixed in later versions [1].

Here's some suggested improvements:

-- conda install ocw --only-deps
-- conda install proj4 (* perhaps this should be an ocw dependency since
the example seems to depend on it?)
-- set PYTHONPATH to include the climate directory cloned from git

I changed ocw/plotter.py:732 to pass ngrids=None to work around this
problem in mpl_toolkits/axes_grid1 and I now have some beautiful plots of
Africa. Updrading to matplotlib 3.0 unfortunately isn't a simple fix,
apparently matplotlib.cbook removed is_scalar which mpl_toolkits.basemap
depends on. I guess I'll follow up with matplotlib.

[1]
https://github.com/matplotlib/matplotlib/blob/98a0821b069ad75ad4b555ad15471dd6ffd14ae9/lib/mpl_toolkits/axes_grid1/axes_grid.py#L173

On Mon, Oct 8, 2018 at 11:58 AM Dominic Cooney <dominic.coo...@gmail.com>
wrote:

> Per the wiki's Getting Started page's [1] request, here's some trouble I
> ran into as a Windows user getting started.
>
> First, it seems necessary to conda install proj4 in addition to ocw
> (perhaps that should be a dependency?) otherwise mpl_toolkits.basemap can't
> find epsg and this error results:
>
> C:\Users\coons\Documents\climate>python
> examples\simple_model_to_model_bias.py
> Traceback (most recent call last):
>   File "examples\simple_model_to_model_bias.py", line 53, in <module>
>     import ocw.data_source.local as local
>   File "C:\Program Files (x86)\Microsoft Visual
> Studio\Shared\Anaconda3_64\lib\site-packages\ocw\data_source\local.py",
> line 26, in <module>
>     from ocw.dataset import Dataset
>   File "C:\Program Files (x86)\Microsoft Visual
> Studio\Shared\Anaconda3_64\lib\site-packages\ocw\dataset.py", line 34, in
> <module>
>     import ocw.utils as utils
>   File "C:\Program Files (x86)\Microsoft Visual
> Studio\Shared\Anaconda3_64\lib\site-packages\ocw\utils.py", line 26, in
> <module>
>     from mpl_toolkits.basemap import shiftgrid, Basemap
>   File "C:\Program Files (x86)\Microsoft Visual
> Studio\Shared\Anaconda3_64\lib\site-packages\mpl_toolkits\basemap\__init__.py",
> line 146, in <module>
>     epsgf = open(os.path.join(pyproj.pyproj_datadir,'epsg'))
> FileNotFoundError: [Errno 2] No such file or directory: 'epsg'
>
> Second, it seems axes_grid1/axes_grid.py has this curious condition:
>
>         if ngrids is None:
>             ngrids = self._nrows * self._ncols
>         else:
>              if not 0 <= ngrids < self._nrows * self._ncols:
>                 raise Exception
>
> This exception happens (see below); that comparison looks off-by-one
> (ngrids <= self._nrows * self._ncols).
>
> I'd love to help out, is there a pointer to how to develop with some local
> packages, eg a local fork of axes_grid1, instead of conda versions? Maybe
> the sample just rotted a bit. Is there a unit test for the sample?
>
> Here's that exception stacktrace, FWIW:
>
> Generating a contour map using ocw.plotter.draw_contour_map()
> Traceback (most recent call last):
>   File "simple_model_to_model_bias.py", line 164, in <module>
>     subtitles=sub_titles)
>   File "C:\Program Files (x86)\Microsoft Visual
> Studio\Shared\Anaconda3_64\lib\site-packages\ocw\plotter.py", line 734, in
> draw_contour_map
>     cbar_pad='0%'
>   File "C:\Program Files (x86)\Microsoft Visual
> Studio\Shared\Anaconda3_64\lib\site-packages\mpl_toolkits\axes_grid1\axes_grid.py",
> line 489, in __init__
>     raise Exception
> Exception
>
> All for now,
>
> dpc
>
> [1] https://cwiki.apache.org/confluence/display/CLIMATE/Getting+Started
>

Reply via email to