polartoolkit
polartoolkit copied to clipboard
Indentation error in subplots tutorial
Bug: Indentation error in subplots tutorial using .maps.plot_grid.
>>> for i, (k, v) in enumerate(layers.items()):
... # for the first grid, need orgin_shift to be default
... if i == 0:
... fig = maps.plot_grd(
... v["grid"],
... title=k,
... region=plot_region,
... coast=True,
... )
... # plot a shapefile
... fig.plot(
... data=fetch.sample_shp(name="Roosevelt_Island"),
... pen="2p,magenta",
... label="Roosevelt Island Transect",
... )
... # add legend
... fig.legend(position="JTR+jTR", box="+gwhite+p1p")
...
>>> # for the end of each row (mulitples of the number of columns) need to
>>> # shift origin down and back to beginning
>>> elif i % subplot_dimensions[1] == 0:
File "<stdin>", line 1
elif i % subplot_dimensions[1] == 0:
IndentationError: unexpected indent
>>> fig = maps.plot_grd(
File "<stdin>", line 1
fig = maps.plot_grd(
IndentationError: unexpected indent
>>> v["grid"],
File "<stdin>", line 1
v["grid"],
IndentationError: unexpected indent
>>> title=k,
File "<stdin>", line 1
title=k,
IndentationError: unexpected indent
>>> fig=fig,conda env create -f environment.yml
File "<stdin>", line 1
fig=fig,
IndentationError: unexpected indent
>>> origin_shift="both_shift",
File "<stdin>", line 1
origin_shift="both_shift",
IndentationError: unexpected indent
>>> xshift_amount=-(subplot_dimensions[0]), # gives -2, shifts plot back by 2
File "<stdin>", line 1
xshift_amount=-(subplot_dimensions[0]), # gives -2, shifts plot back by 2
IndentationError: unexpected indent
>>> yshift_amount=-1, # shift new row down by 1
File "<stdin>", line 1
yshift_amount=-1, # shift new row down by 1
IndentationError: unexpected indent
>>> region=plot_region,
File "<stdin>", line 1
region=plot_region,
IndentationError: unexpected indent
>>> coast=True,
File "<stdin>", line 1
coast=True,
IndentationError: unexpected indent
>>> )
File "<stdin>", line 1
)
IndentationError: unexpected indent
>>> # plot a shapefile
>>> fig.plot(
File "<stdin>", line 1
fig.plot(
IndentationError: unexpected indent
>>> data=fetch.sample_shp(name="Roosevelt_Island"),
File "<stdin>", line 1
data=fetch.sample_shp(name="Roosevelt_Island"),
IndentationError: unexpected indent
>>> pen="2p,magenta",
File "<stdin>", line 1
pen="2p,magenta",
IndentationError: unexpected indent
>>> label="Roosevelt Island Transect",
File "<stdin>", line 1
label="Roosevelt Island Transect",
IndentationError: unexpected indent
>>> )
File "<stdin>", line 1
)
IndentationError: unexpected indent
>>> # add legend
>>> fig.legend(position="JTR+jTR", box="+gwhite+p1p")
File "<stdin>", line 1
fig.legend(position="JTR+jTR", box="+gwhite+p1p")
IndentationError: unexpected indent
>>>
>>> # for the rest of the grids, just shift to the right like normal
>>> else:
File "<stdin>", line 1
else:
IndentationError: unexpected indent
>>> fig = maps.plot_grd(
File "<stdin>", line 1
fig = maps.plot_grd(
IndentationError: unexpected indent
>>> v["grid"],
File "<stdin>", line 1
v["grid"],
IndentationError: unexpected indent
>>> title=k,
File "<stdin>", line 1
title=k,
IndentationError: unexpected indent
>>> fig=fig,
File "<stdin>", line 1
fig=fig,
IndentationError: unexpected indent
>>> origin_shift="xshift",
File "<stdin>", line 1
origin_shift="xshift",
IndentationError: unexpected indent
>>> region=plot_region,
File "<stdin>", line 1
region=plot_region,
IndentationError: unexpected indent
>>> coast=True,
File "<stdin>", line 1
coast=True,
IndentationError: unexpected indent
>>> )
File "<stdin>", line 1
)
IndentationError: unexpected indent
>>> # plot a shapefile
>>> fig.plot(
File "<stdin>", line 1
fig.plot(
IndentationError: unexpected indent
>>> data=fetch.sample_shp(name="Roosevelt_Island"),
File "<stdin>", line 1
data=fetch.sample_shp(name="Roosevelt_Island"),
IndentationError: unexpected indent
>>> pen="2p,magenta",
File "<stdin>", line 1
pen="2p,magenta",
IndentationError: unexpected indent`
>>> label="Roosevelt Island Transect",
File "<stdin>", line 1
label="Roosevelt Island Transect",
IndentationError: unexpected indent
>>> )
File "<stdin>", line 1
)
IndentationError: unexpected indent
>>> # add legend
>>> fig.legend(position="JTR+jTR", box="+gwhite+p1p")
File "<stdin>", line 1
fig.legend(position="JTR+jTR", box="+gwhite+p1p")
IndentationError: unexpected indent
polartoolkits installation set up as follows, and run from CLI:
# Construct environment from yml file
conda env create -f environment.yml
# Install from local repo copy
git clone [email protected]:PennyHow/polartoolkit.git
cd polartoolkit/
pip install .
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines.
I tested this and seems the issue is only that there is a blank line between the if elif and else statements. It seems this blank line is no issue in a .ipynb or a .py but doesn't work in the terminal. Will be fixed with #212
No worries. If Jupiter/pycharm/spyder...etc. is the preferred IDE for running the examples then maybe just add a line at the beginning of the tutorials stating this as a recommendation.