Skip to content

Commit

Permalink
fix refs
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Oct 30, 2024
1 parent d8db216 commit 025d8a3
Show file tree
Hide file tree
Showing 24 changed files with 515 additions and 15,381 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ ENV/
.vscode

nlcd_2011.tif

docs/generated/
docs/apidocs/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

[![Continuous Integration](https://github.com/pysal/tobler/actions/workflows/unittests.yml/badge.svg)](https://github.com/pysal/tobler/actions/workflows/unittests.yml)
[![codecov](https://codecov.io/gh/pysal/tobler/branch/master/graph/badge.svg?token=XO4SilfBEb)](https://codecov.io/gh/pysal/tobler)![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tobler)
[![codecov](https://codecov.io/gh/pysal/tobler/branch/main/graph/badge.svg?token=XO4SilfBEb)](https://codecov.io/gh/pysal/tobler)![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tobler)
![PyPI](https://img.shields.io/pypi/v/tobler)
![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/tobler)
![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/pysal/tobler/latest)
Expand Down Expand Up @@ -62,7 +62,7 @@ If you have any suggestion, feature request, or bug report, please open a new [i

## License

The project is licensed under the [BSD license](https://github.com/pysal/tobler/blob/master/LICENSE.txt).
The project is licensed under the [BSD license](https://github.com/pysal/tobler/blob/main/LICENSE.txt).

## Funding

Expand Down
8 changes: 7 additions & 1 deletion ci/311.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ dependencies:
- numpydoc
- nbsphinx
- joblib
- astropy
- astropy
- nbsphinx_link
- myst-parser
- autodoc2
- nbsphinx_link
- pip:
- nbsphinx_link>=1.3.1 # not on conda yet
880 changes: 440 additions & 440 deletions docs/_static/references.bib

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# Bib Variables
bibtex_default_style = 'alpha'
bibtex_reference_style ="author_year"
bibtex_bibfiles = ["_static/references.bib"]


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand All @@ -132,7 +138,7 @@
# Path should be relative to the ``_static`` files directory.
# html_logo = "_static/images/CGS_logo.jpg"
# html_logo = "_static/images/CGS_logo_green.png"
html_logo = "figs/tobler.svg"
html_logo = "figs/tobler_long.svg"
html_favicon = "figs/tobler.ico"


Expand Down Expand Up @@ -302,7 +308,3 @@
'cluster', 'of', 'or', 'if', 'using', 'otherwise', 'required',
'from'}

# Bib Variables
bibtex_default_style = 'plain'
bibtex_reference_style ="author_year"
bibtex_bibfiles = ['references.bib']
4 changes: 0 additions & 4 deletions docs/myst.md

This file was deleted.

9 changes: 0 additions & 9 deletions docs/myst_summary.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
References
==========

.. bibliography:: references.bib
.. bibliography:: _static/references.bib
:all:
4 changes: 3 additions & 1 deletion tobler/area_weighted/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from .area_interpolate import _area_interpolate_binning as area_interpolate
from .area_interpolate import area_interpolate
from .area_interpolate import _area_tables_binning
from .area_join import area_join
from .area_interpolate_dask import area_interpolate_dask

__all__ = [area_interpolate, area_join, area_interpolate_dask]
34 changes: 22 additions & 12 deletions tobler/area_weighted/area_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from tobler.util.util import _check_crs, _inf_check, _nan_check

__all__ = ['area_interpolate']

def _chunk_dfs(geoms_to_chunk, geoms_full, n_jobs):
chunk_size = geoms_to_chunk.shape[0] // n_jobs + 1
Expand Down Expand Up @@ -203,7 +204,7 @@ def _area_tables_binning(source_df, target_df, spatial_index):
return table


def _area_interpolate_binning(
def area_interpolate(
source_df,
target_df,
extensive_variables=None,
Expand All @@ -221,36 +222,47 @@ def _area_interpolate_binning(
Parameters
----------
source_df : geopandas.GeoDataFrame
target_df : geopandas.GeoDataFrame
extensive_variables : list
[Optional. Default=None] Columns in dataframes for extensive variables
intensive_variables : list
[Optional. Default=None] Columns in dataframes for intensive variables
table : scipy.sparse.csr_matrix
[Optional. Default=None] Area allocation source-target correspondence
table. If not provided, it will be built from `source_df` and
`target_df` using `tobler.area_interpolate._area_tables_binning`
allocate_total : boolean
[Optional. Default=True] True if total value of source area should be
allocated. False if denominator is area of i. Note that the two cases
would be identical when the area of the source polygon is exhausted by
intersections. See Notes for more details.
spatial_index : str
[Optional. Default="auto"] Spatial index to use to build the
allocation of area from source to target tables. It currently support
the following values:
- "source": build the spatial index on `source_df`
- "target": build the spatial index on `target_df`
- "auto": attempts to guess the most efficient alternative.
Currently, this option uses the largest table to build the
index, and performs a `bulk_query` on the shorter table.
- "source": build the spatial index on `source_df`
- "target": build the spatial index on `target_df`
- "auto": attempts to guess the most efficient alternative.
Currently, this option uses the largest table to build the
index, and performs a `bulk_query` on the shorter table.
This argument is ignored if n_jobs>1 (or n_jobs=-1).
n_jobs : int
[Optional. Default=1] Number of processes to run in parallel to
generate the area allocation. If -1, this is set to the number of CPUs
available. If `table` is passed, this is ignored.
categorical_variables : list
[Optional. Default=None] Columns in dataframes for categorical variables
categorical_frequency : Boolean
[Optional. Default=True] If True, `estimates` returns the frequency of each
value in a categorical variable in every polygon of `target_df` (proportion of
Expand Down Expand Up @@ -278,18 +290,16 @@ def _area_interpolate_binning(
an extensive attribute, then setting allocate_total=False will use the
following weights:
.. math::
v_j = \\sum_i v_i w_{i,j}
$$v_j = \\sum_i v_i w_{i,j}$$
w_{i,j} = a_{i,j} / a_i
$$w_{i,j} = a_{i,j} / a_i$$
where a_i is the total area of source polygon i.
For an intensive variable, the estimate at target polygon j is:
.. math::
v_j = \\sum_i v_i w_{i,j}
$$v_j = \\sum_i v_i w_{i,j}$$
w_{i,j} = a_{i,j} / \\sum_k a_{k,j}
$$w_{i,j} = a_{i,j} / \\sum_k a_{k,j}$$
For categorical variables, the estimate returns ratio of presence of each
unique category.
Expand Down
6 changes: 4 additions & 2 deletions tobler/area_weighted/area_interpolate_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
Area Weighted Interpolation, out-of-core and parallel through Dask
"""

import pandas
import geopandas
import numpy as np
from .area_interpolate import _area_interpolate_binning as area_interpolate
import pandas

from .area_interpolate import area_interpolate

__all__ = ['area_interpolate_dask']

def area_interpolate_dask(
source_dgdf,
Expand Down
4 changes: 3 additions & 1 deletion tobler/area_weighted/area_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

__author__ = "Martin Fleischmann <[email protected]>"

__all__ = ["area_join"]


def area_join(source_df, target_df, variables):
"""
Expand All @@ -22,7 +24,7 @@ def area_join(source_df, target_df, variables):
-------
joined : geopandas.GeoDataFrame
target_df GeoDataFrame with joined variables as additional columns
"""
if not pd.api.types.is_list_like(variables):
variables = [variables]
Expand Down
4 changes: 3 additions & 1 deletion tobler/dasymetric/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .masked_area_interpolate import masked_area_interpolate
from .raster_tools import extract_raster_features, _fast_append_profile_in_gdf
from .raster_tools import extract_raster_features, _fast_append_profile_in_gdf

__all__ = ["masked_area_interpolate"]
2 changes: 2 additions & 0 deletions tobler/dasymetric/masked_area_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from ..area_weighted import area_interpolate
from .raster_tools import extract_raster_features

__all__ = ["masked_area_interpolate"]


def masked_area_interpolate(
source_df,
Expand Down
2 changes: 2 additions & 0 deletions tobler/dasymetric/raster_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

GPD_10 = Version(gpd.__version__) >= Version("1.0.0dev")

__all__ = ["extract_raster_features"]


def _chunk_dfs(geoms_to_chunk, n_jobs):
chunk_size = geoms_to_chunk.shape[0] // n_jobs + 1
Expand Down
2 changes: 2 additions & 0 deletions tobler/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .glm import glm

__all__ = ['glm']
7 changes: 5 additions & 2 deletions tobler/model/glm.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""Model-based methods for areal interpolation."""

import numpy as np
import statsmodels.formula.api as smf
from statsmodels.genmod.families import Gaussian, NegativeBinomial, Poisson
from ..util.util import _check_presence_of_crs

from ..dasymetric import _fast_append_profile_in_gdf
import numpy as np
from ..util.util import _check_presence_of_crs

__all__ = ["glm"]


def glm(
Expand Down
2 changes: 2 additions & 0 deletions tobler/pycno/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .pycno import pycno_interpolate

__all__ = ['pycno_interpolate']
3 changes: 2 additions & 1 deletion tobler/pycno/pycno.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Pycnophylactic Interpolation (contributed by @danlewis85)."""
# https://github.com/danlewis85/pycno/

import geopandas as gpd
import numpy as np
import pandas as pd
import rasterio
Expand All @@ -24,6 +23,8 @@
from pandas import DataFrame
from rasterio.features import rasterize

__all__ = ["pycno_interpolate"]


def pycno(
gdf, value_field, cellsize, r=0.2, handle_null=True, converge=3, verbose=True
Expand Down
4 changes: 3 additions & 1 deletion tobler/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .util import *
from .util import *

__all__ = ['h3fy', 'circumradius']
2 changes: 2 additions & 0 deletions tobler/util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

GPD_10 = Version(geopandas.__version__) >= Version("1.0.0dev")

__all__ = ["h3fy", "circumradius"]


def circumradius(resolution):
"""Find the circumradius of an h3 hexagon at given resolution.
Expand Down
24 changes: 0 additions & 24 deletions tools/changelog_0.3.0.md

This file was deleted.

Loading

0 comments on commit 025d8a3

Please sign in to comment.