Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement area calculation for footprint of 3D objects #378

Merged
merged 49 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
cd3dfaa
Reorganise imports
w-k-jones Dec 3, 2023
8a13960
Reorganise imports
w-k-jones Dec 3, 2023
f2086c8
Restructure analysis module
w-k-jones Dec 3, 2023
a0c2ed9
Move distance, velocity and area functions to analysis.spatial
w-k-jones Dec 3, 2023
8f3b6e9
Move distance, velocity and area functions to analysis.spatial
w-k-jones Dec 3, 2023
b2f92ca
Rename init file in analysis to fix import issues
w-k-jones Dec 3, 2023
fb3731a
Update setup.py to automatically find package names
w-k-jones Dec 3, 2023
e353f93
Reorganise imports in setup.py
w-k-jones Dec 3, 2023
00c1c38
Add collapse_axis keyword to get_statistics, allowing one or more axe…
w-k-jones Dec 4, 2023
029eccd
Add collapse_dims keyword to get_statistics_from_mask, allowing one o…
w-k-jones Dec 4, 2023
100f2a6
Update calculate_area to use bulk statistics
w-k-jones Dec 4, 2023
7d16627
Change order of input checks in get_statistics to raise correct error…
w-k-jones Dec 4, 2023
1f56e2d
Reorganise imports and remove unused
w-k-jones Dec 4, 2023
361a1f3
Remove broadcasting warning
w-k-jones Dec 4, 2023
4a8f049
Add test for calculate_area with 1D lat/lon coords
w-k-jones Dec 4, 2023
68f2f54
Add tests for area calculation using 1D and 2D lat/lon coords
w-k-jones Dec 4, 2023
35313bf
Merge branch 'RC_v1.5.x' of https://github.com/climate-processes/toba…
w-k-jones Dec 4, 2023
929483f
Update pylint workflow to trigger on pull_request_target
w-k-jones Dec 4, 2023
e49dfff
Update docstring
w-k-jones Dec 4, 2023
3bc9ebe
Fix wrong ordering of x/y coords in calculate_area
w-k-jones Feb 19, 2024
2403c8c
merge the latest version of the RTD back-integration branch into the …
fsenf Mar 1, 2024
7fdb65c
bufix in Idealized-Case-1 notebook:
fsenf Mar 1, 2024
9b1298a
Update analysis package srtucture, separate cell and feature analysis…
w-k-jones Mar 1, 2024
b208274
Resolve import errors
w-k-jones Mar 1, 2024
6088505
Merge changes from RC_v1.5.x
w-k-jones Mar 1, 2024
17f32a4
Reformatting
w-k-jones Mar 1, 2024
d2f704f
Update formatting check to show version of black that is used
w-k-jones Mar 1, 2024
91871bf
Reformat with black version 22.10
w-k-jones Mar 1, 2024
4cf994f
Resolve merge conflicts
w-k-jones Mar 1, 2024
b9d084e
Merge branch 'fsenf-bugfix-area-calculation' into 3d_area_calculation
w-k-jones Mar 1, 2024
7380442
Rerun idealised case notebook
w-k-jones Mar 1, 2024
26334c9
Add xarray_to_iris decorator to calculate_areas, remove explicit conv…
w-k-jones Mar 2, 2024
66d664c
Rename mask to segment_labels and correct description of segmentation…
w-k-jones Mar 2, 2024
b77d21b
Reformatting
w-k-jones Mar 2, 2024
3bc47ca
fix issues with decorators
freemansw1 Mar 13, 2024
99b1bf8
Fix merge conflicts from RC_v1.5.x
w-k-jones Mar 13, 2024
a49a692
Merge changes from freemansw1/fix_1.5.x_issues
w-k-jones Mar 13, 2024
01c324e
Add new conversion function for iris cubes to handle error with integ…
w-k-jones Mar 13, 2024
7f31002
Formatting
w-k-jones Mar 13, 2024
7d393b4
Update API reference docs for analysis package and add all utils subm…
w-k-jones Mar 13, 2024
9a6b560
Add tests for decorators
w-k-jones Mar 14, 2024
ba68e2a
Add tests for calculate_distance and calculate_velocity_individual
w-k-jones Mar 14, 2024
db09d7e
Add test for calculate_velocity
w-k-jones Mar 14, 2024
242d0de
Add tests for calculate_nearestneighbordistance
w-k-jones Mar 14, 2024
313f024
Add tests for lat/lon area and exception handling in calculate_area
w-k-jones Mar 14, 2024
683aff0
Fix coordinate/dim naming clash
w-k-jones Mar 14, 2024
388d123
Fix test catching wrong exception
w-k-jones Mar 14, 2024
6563569
Fix wrong coordinate name in calculate_area
w-k-jones Mar 14, 2024
a5f126e
Clarify tests for invalid lat/lon and add test for 3D lat/lon
w-k-jones Mar 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/check_formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
shell: bash -l {0}
run:
mamba install --quiet --yes --file requirements.txt black &&
black tobac --check --diff
black --version &&
black tobac --check --diff
45 changes: 40 additions & 5 deletions doc/tobac.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ Submodules
tobac.analysis module
---------------------

.. automodule:: tobac.analysis
tobac.analysis.cell_analysis module
---------------------

.. automodule:: tobac.analysis.cell_analysis
:members:
:undoc-members:
:show-inheritance:

tobac.analysis.feature_analysis module
---------------------

.. automodule:: tobac.analysis.feature_analysis
:members:
:undoc-members:
:show-inheritance:

tobac.analysis.spatial module
---------------------

.. automodule:: tobac.analysis.spatial
:members:
:undoc-members:
:show-inheritance:
Expand Down Expand Up @@ -71,18 +90,26 @@ tobac.tracking module
tobac.utils modules
------------------

tobac.utils.general module
tobac.utils.bulk_statistics module
------------------

.. automodule:: tobac.utils.general
.. automodule:: tobac.utils.bulk_statistics
:members:
:undoc-members:
:show-inheritance:

tobac.utils.bulk_statistics module
tobac.utils.decorators module
------------------

.. automodule:: tobac.utils.bulk_statistics
.. automodule:: tobac.utils.decorators
:members:
:undoc-members:
:show-inheritance:

tobac.utils.general module
------------------

.. automodule:: tobac.utils.general
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -95,6 +122,14 @@ tobac.utils.mask module
:undoc-members:
:show-inheritance:

tobac.utils.periodic_boundaries module
------------------

.. automodule:: tobac.utils.periodic_boundaries
:members:
:undoc-members:
:show-inheritance:


tobac.wrapper module
--------------------
Expand Down
489 changes: 96 additions & 393 deletions examples/Basics/Idealized-Case-1_Tracking-of-a-Test-Blob-in-2D.ipynb

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from setuptools import setup

"""
This code is from the python documentation and is
designed to read in the version number.
See: https://packaging.python.org/en/latest/guides/single-sourcing-package-version/
"""

from setuptools import setup
from pathlib import Path


Expand Down Expand Up @@ -37,6 +37,14 @@ def get_requirements(requirements_filename):
return requirements


def get_packages(package_name):
package = Path(package_name)
packages = [
str(path.parent).replace("/", ".") for path in package.rglob("__init__.py")
]
return packages


PACKAGE_NAME = "tobac"

# See classifiers list at: https://pypi.org/classifiers/
Expand Down Expand Up @@ -86,7 +94,7 @@ def get_requirements(requirements_filename):
"peter.marinescu@colostate.edu",
],
license="BSD-3-Clause License",
packages=[PACKAGE_NAME, PACKAGE_NAME + ".utils", PACKAGE_NAME + ".utils.internal"],
packages=get_packages(PACKAGE_NAME),
install_requires=get_requirements("requirements.txt"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a good change. I've been caught by this more than a few times.

test_requires=["pytest"],
zip_safe=False,
Expand Down
42 changes: 24 additions & 18 deletions tobac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,53 @@
plot_mask_cell_track_follow,
plot_mask_cell_track_static,
plot_mask_cell_track_static_timeseries,
)
from .plotting import (
plot_lifetime_histogram,
plot_lifetime_histogram_bar,
plot_histogram_cellwise,
plot_histogram_featurewise,
)
from .plotting import plot_mask_cell_track_3Dstatic, plot_mask_cell_track_2D3Dstatic
from .plotting import (
plot_mask_cell_track_3Dstatic,
plot_mask_cell_track_2D3Dstatic,
plot_mask_cell_individual_static,
plot_mask_cell_individual_3Dstatic,
animation_mask_field,
make_map,
map_tracks,
)
from .plotting import animation_mask_field
from .plotting import make_map, map_tracks
from .analysis import (
from tobac.analysis.cell_analysis import (
cell_statistics,
cog_cell,
lifetime_histogram,
histogram_featurewise,
histogram_cellwise,
)
from .analysis import calculate_velocity, calculate_distance, calculate_area
from .analysis import calculate_nearestneighbordistance
from .analysis import (
velocity_histogram,
calculate_overlap,
)
from tobac.analysis.feature_analysis import (
histogram_featurewise,
calculate_nearestneighbordistance,
nearestneighbordistance_histogram,
area_histogram,
)
from .analysis import calculate_overlap
from .utils import (
from tobac.analysis.spatial import (
calculate_velocity,
calculate_distance,
calculate_area,
)
from .utils.mask import (
mask_cell,
mask_cell_surface,
mask_cube_cell,
mask_cube_untracked,
mask_cube,
column_mask_from2D,
mask_features,
mask_features_surface,
mask_cube_features,
)
from .utils.general import (
get_bounding_box,
add_coordinates,
get_spacings,
)
from .utils import mask_features, mask_features_surface, mask_cube_features

from .utils import add_coordinates, get_spacings
from .feature_detection import feature_detection_multithreshold
from .tracking import linking_trackpy
from .wrapper import maketrack
Expand Down
Loading
Loading