Skip to content

Commit 0247d05

Browse files
authored
Merge pull request #150 from xylar/simplify_docs
Simplify and update the documentation
2 parents fedc860 + 61d44a1 commit 0247d05

File tree

7 files changed

+69
-35
lines changed

7 files changed

+69
-35
lines changed

docs/api.rst

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. currentmodule:: geometric_features
2+
13
#############
24
API reference
35
#############
@@ -9,8 +11,6 @@ the documentation.
911
Command-line scripts
1012
====================
1113

12-
.. currentmodule:: geometric_features.__main__
13-
1414
.. autosummary::
1515
:toctree: generated/
1616

@@ -28,22 +28,46 @@ Command-line scripts
2828
Python package
2929
==============
3030

31-
.. currentmodule:: geometric_features.geometric_features
31+
Reading Geometric Features
32+
--------------------------
3233

3334
.. autosummary::
3435
:toctree: generated/
3536

3637
GeometricFeatures
3738
GeometricFeatures.read
39+
40+
Splitting new data into Geometric Features
41+
------------------------------------------
42+
43+
.. autosummary::
44+
:toctree: generated/
45+
3846
GeometricFeatures.split
47+
write_feature_names_and_tags
3948

40-
.. currentmodule:: geometric_features.feature_collection
49+
Reading a Feature Collection
50+
----------------------------
4151

4252
.. autosummary::
4353
:toctree: generated/
4454

4555
read_feature_collection
56+
57+
Creating a Feature Collection
58+
-----------------------------
59+
60+
.. autosummary::
61+
:toctree: generated/
62+
4663
FeatureCollection
64+
65+
Manipulating a Feature Collection
66+
---------------------------------
67+
68+
.. autosummary::
69+
:toctree: generated/
70+
4771
FeatureCollection.add_feature
4872
FeatureCollection.merge
4973
FeatureCollection.tag

docs/feature_collection.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Reading in Features
1111
-------------------
1212

1313
A ``FeatureCollection`` can be read from a file with the function
14-
:func:`geometric_features.feature_collection.read_feature_collection`:
14+
:func:`geometric_features.read_feature_collection`:
1515

1616
.. code-block:: python
1717
@@ -23,7 +23,7 @@ Add a Feature
2323
-------------
2424

2525
To add a single feature to a ``FeatureColleciton``, use
26-
:meth:`geometric_features.feature_collection.FeatureCollection.add_feature`:
26+
:meth:`geometric_features.FeatureCollection.add_feature`:
2727

2828
.. code-block:: python
2929
@@ -35,7 +35,7 @@ Merging Features
3535
----------------
3636

3737
A ``FeatureCollection`` ``fc2`` can be merged into another colleciton ``fc1``
38-
with :meth:`geometric_features.feature_collection.FeatureCollection.merge`:
38+
with :meth:`geometric_features.FeatureCollection.merge`:
3939

4040
.. code-block:: python
4141
@@ -48,7 +48,7 @@ Plotting Features
4848
-----------------
4949

5050
A ``FeatureCollection`` can be plotted on a given map projeciton with
51-
:meth:`geometric_features.feature_collection.FeatureCollection.plot`:
51+
:meth:`geometric_features.FeatureCollection.plot`:
5252

5353
.. code-block:: python
5454
@@ -63,7 +63,7 @@ Tag Features
6363
------------
6464

6565
All the features in a ``FeatureCollection`` can be tagged with one or more tags
66-
using :meth:`geometric_features.feature_collection.FeatureCollection.tag`:
66+
using :meth:`geometric_features.FeatureCollection.tag`:
6767

6868
.. code-block:: python
6969
@@ -78,7 +78,7 @@ Writing out Features
7878
--------------------
7979

8080
To write out a ``FeatureCollection`` to a ``geojson`` file, call
81-
:meth:`geometric_features.feature_collection.FeatureCollection.to_geojson`
81+
:meth:`geometric_features.FeatureCollection.to_geojson`
8282

8383
.. code-block:: python
8484
@@ -88,7 +88,7 @@ Set a Group Name
8888
----------------
8989

9090
To set the ``groupName`` property of a ``FeatureCollection``, call
91-
:meth:`geometric_features.feature_collection.FeatureCollection.set_group_name`.
91+
:meth:`geometric_features.FeatureCollection.set_group_name`.
9292

9393
.. code-block:: python
9494
@@ -105,7 +105,7 @@ Combine Features
105105

106106
Features in a ``FeatureCollection`` can be combined (fused together into a
107107
single feature) using
108-
:meth:`geometric_features.feature_collection.FeatureCollection.combine`:
108+
:meth:`geometric_features.FeatureCollection.combine`:
109109

110110
.. code-block:: python
111111
@@ -117,7 +117,7 @@ Difference Features
117117

118118
Features in a ``FeatureCollection`` can be masked with one or more masking
119119
features from another ``FeatureCollection`` using
120-
:meth:`geometric_features.feature_collection.FeatureCollection.difference`:
120+
:meth:`geometric_features.FeatureCollection.difference`:
121121

122122
.. code-block:: python
123123
@@ -132,7 +132,7 @@ Simplify Features
132132
Sometimes, features are made up of segments or polygons with tiny edges that
133133
add little relevant detail to the features but make the files describing them
134134
needlessly large. In such cases, the features can be simplified by calling
135-
:meth:`geometric_features.feature_collection.FeatureCollection.simplify` with
135+
:meth:`geometric_features.FeatureCollection.simplify` with
136136
and appropriate length scale (in degrees latitude/longitude) over which the
137137
feature may be modified to make it simpler. If a length scale of zero is
138138
used, the feature will be simplified without any modification tot he shape
@@ -153,7 +153,7 @@ provides a bit of a hack for removing a tiny sliver of the feature around the
153153
antimeridian so that the resulting shape remians between -180 and 180 degrees
154154
longitude.
155155

156-
:meth:`geometric_features.feature_collection.FeatureCollection.fix_antimeridian`
156+
:meth:`geometric_features.FeatureCollection.fix_antimeridian`
157157

158158
.. code-block:: python
159159

docs/geometric_data.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@ Geometric Data
55

66
The the overarching purpose of ``geometric_features`` is to facilitate access
77
to and manipulation of the geometric data in the repository. This data is
8-
currently divided across 5 components, ``bedmap2``, ``iceshelves``,
9-
``landice``, ``natural_earth``, and ``ocean``.
8+
currently divided across 6 components, ``bedmachine``, ``bedmap2``,
9+
``iceshelves``, ``landice``, ``natural_earth``, and ``ocean``.
1010

1111
Components
1212
----------
1313

14-
bedmap2
15-
^^^^^^^
14+
bedmachine and bedmap2
15+
^^^^^^^^^^^^^^^^^^^^^^
1616

17-
This component defines two "coastlines" between the Antarctic continent and
18-
the ocean. One exclues the cavity under ice shelves while the other includes
19-
them. The dataset used to define these coastlines is Bedmap2
20-
(`Fretwell et al. 2016`_).
17+
These components each define two "coastlines" between the Antarctic continent
18+
and the ocean. One excludes the cavity under ice shelves while the other
19+
includes them. The ``bedmachine`` component uses the BedMachine Antarctica
20+
dataset
21+
(`Morlighem et al. 2020 <https://www.nature.com/articles/s41561-019-0510-8>`_)
22+
to define the coastlines, while the ``bedmap2`` dataset is based on Bedmap2
23+
(`Fretwell et al. 2016 <http://www.the-cryosphere.net/7/375/2013/>`_).
2124

2225
iceshelves
2326
^^^^^^^^^^
@@ -176,7 +179,7 @@ Here are two simple examples of features from the repository:
176179
]
177180
}
178181
179-
.. _`Fretwell et al. 2016`: http://www.the-cryosphere.net/7/375/2013/
182+
180183
.. _`IMBIE1 Basins`: http://imbie.org/imbie-2016/drainage-basins/
181184
.. _`Natural Earth`: http://www.naturalearthdata.com/
182185
.. _`International Hydrographic Organisation`: http://www.marineregions.org/downloads.php#iho

geometric_features/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,12 @@
66
from geometric_features.feature_collection import FeatureCollection, \
77
read_feature_collection
88

9+
from geometric_features.__main__ import combine_features, difference_features, \
10+
fix_features_at_antimeridian, merge_features, plot_features, \
11+
set_group_name, split_features, simplify_features, tag_features
12+
13+
from geometric_features.utils import write_feature_names_and_tags
14+
15+
916
__version_info__ = (0, 1, 11)
1017
__version__ = '.'.join(str(vi) for vi in __version_info__)

geometric_features/feature_collection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def read_feature_collection(fileName):
3535
3636
Returns
3737
-------
38-
fc : ``FeatureCollection``
38+
fc : geometric_features.FeatureCollection
3939
The feature collection read in
4040
'''
4141
# Authors
@@ -121,7 +121,7 @@ def merge(self, other):
121121
122122
Parameters
123123
----------
124-
other : ``FeatureCollection``
124+
other : geometric_features.FeatureCollection
125125
The other feature collection
126126
'''
127127
# Authors
@@ -184,7 +184,7 @@ def combine(self, featureName):
184184
185185
Returns
186186
-------
187-
fc : ``FeatureCollection``
187+
fc : geometric_features.FeatureCollection
188188
A new feature collection with a single feature with the combined
189189
geometry
190190
@@ -242,15 +242,15 @@ def difference(self, maskingFC, show_progress=False):
242242
243243
Parameters
244244
----------
245-
maskingFC : ``FeatureCollection```
245+
maskingFC : geometric_features.FeatureCollection
246246
Another collection of one or more features to use as masks
247247
248248
show_progress : bool
249249
Show a progress bar
250250
251251
Returns
252252
-------
253-
fc : ``FeatureCollection``
253+
fc : geometric_features.FeatureCollection
254254
A new feature collection with a single feature with the geometry
255255
masked
256256
'''
@@ -321,7 +321,7 @@ def fix_antimeridian(self):
321321
322322
Returns
323323
-------
324-
fc : ``FeatureCollection``
324+
fc : geometric_features.FeatureCollection
325325
A new feature collection with the antimeridian handled correctly
326326
'''
327327
# Authors
@@ -355,7 +355,7 @@ def simplify(self, tolerance=0.0):
355355
356356
Returns
357357
-------
358-
fc : ``FeatureCollection``
358+
fc : geometric_features.FeatureCollection
359359
A new feature collection with simplified geometries
360360
'''
361361
# Authors

geometric_features/geometric_features.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def read(self, componentName, objectType, featureNames=None, tags=None,
100100
101101
Returns
102102
-------
103-
fc : ``FeatureCollection``
103+
fc : geometric_features.FeatureCollection
104104
The feature collection read in
105105
'''
106106
# Authors
@@ -125,7 +125,7 @@ def split(self, fc, destinationDir=None):
125125
126126
Parameters
127127
----------
128-
fc : ``FeatureCollection``
128+
fc : geometric_features.FeatureCollection
129129
The feature collection to split
130130
131131
destinationDir : str, optional
@@ -134,7 +134,7 @@ def split(self, fc, destinationDir=None):
134134
135135
Returns
136136
-------
137-
fc : ``FeatureCollection``
137+
fc : geometric_features.FeatureCollection
138138
The feature collection read in
139139
'''
140140
# Authors

geometric_features/test/test_set_group_name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_assign_groupname(self, componentName='ocean', objectType='region',
2222
2323
Parameters
2424
----------
25-
componentName : {'bedmap2', 'iceshelves', 'landice', 'natural_earth', 'ocean'}, optional
25+
componentName : {'bedmachine', 'bedmap2', 'iceshelves', 'landice', 'natural_earth', 'ocean'}, optional
2626
The component from which to retieve the feature
2727
2828
objectType : {'point', 'transect', 'region'}, optional

0 commit comments

Comments
 (0)