diff --git a/.github/workflows/check_formatting.yml b/.github/workflows/check_formatting.yml index 967f3a7e..0d89ad93 100644 --- a/.github/workflows/check_formatting.yml +++ b/.github/workflows/check_formatting.yml @@ -5,10 +5,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - name: Set up conda + uses: conda-incubator/setup-miniconda@v2 with: - python-version: '3.8' - - run: pip install . - - run: pip install black==22.6.0 - - run: black tobac --check - + miniforge-version: latest + miniforge-variant: mambaforge + channel-priority: strict + channels: conda-forge + show-channel-urls: true + use-only-tar-bz2: true + + - name: Install dependencies and check formatting + shell: bash -l {0} + run: + mamba install --quiet --yes --file requirements.txt black && + black tobac --check diff --git a/dev_requirements.txt b/dev_requirements.txt new file mode 100644 index 00000000..f9cf126e --- /dev/null +++ b/dev_requirements.txt @@ -0,0 +1,15 @@ +# Python dependencies +numpy +scipy +scikit-image +scikit-learn +pandas +matplotlib +iris +xarray +cartopy +trackpy +pre-commit +black +pytest + diff --git a/doc/conf.py b/doc/conf.py index 2b8c717a..0f5e48ea 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -34,6 +34,7 @@ # allow dropdowns collapse_navigation = False + # Include our custom CSS (currently for special table config) def setup(app): app.add_css_file("theme_overrides.css") diff --git a/example_requirements.txt b/example_requirements.txt new file mode 100644 index 00000000..04ec0ad1 --- /dev/null +++ b/example_requirements.txt @@ -0,0 +1,15 @@ +# Python dependencies +numpy +scipy +scikit-image +scikit-learn +pandas +matplotlib +iris +xarray +cartopy +trackpy +jupyter +notebook +pytables +pyart \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c8ff9242..2f79a67c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,4 +9,3 @@ iris xarray cartopy trackpy -pre-commit diff --git a/setup.py b/setup.py index 67510aff..e01547e0 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,20 @@ def get_version(pkg_name): raise RuntimeError("Unable to find version string.") +def get_requirements(requirements_filename): + requirements_file = Path(__file__).parent / requirements_filename + assert requirements_file.exists() + with open(requirements_file) as f: + requirements = [ + line.strip() for line in f.readlines() if not line.startswith("#") + ] + # Iris has a different name on PyPI... + if "iris" in requirements: + requirements.remove("iris") + requirements.append("scitools-iris") + return requirements + + PACKAGE_NAME = "tobac" # See classifiers list at: https://pypi.org/classifiers/ @@ -67,24 +81,13 @@ def get_version(pkg_name): "max.heikenfeld@physics.ox.ac.uk", "william.jones@physics.ox.ac.uk", "senf@tropos.de", - "sean.freeman@colostate.edu", + "sean.freeman@uah.edu", "julia.kukulies@gu.se", "peter.marinescu@colostate.edu", ], license="BSD-3-Clause License", packages=[PACKAGE_NAME, PACKAGE_NAME + ".utils"], - install_requires=[ - "numpy", - "scipy", - "scikit-image", - "scikit-learn", - "pandas", - "matplotlib", - "xarray", - "trackpy", - ], - test_requires=[ - "pytest", - ], + install_requires=get_requirements("requirements.txt"), + test_requires=["pytest"], zip_safe=False, ) diff --git a/tobac/analysis.py b/tobac/analysis.py index b596c3ad..15e2545f 100644 --- a/tobac/analysis.py +++ b/tobac/analysis.py @@ -245,7 +245,6 @@ def cell_statistics( cube_masked = mask_cube_cell(cube, mask_cell_i, cell, track_i) coords_remove = [] for coordinate in cube_masked.coords(dim_coords=False): - if coordinate.name() not in dimensions: for dim in dimensions: if set(cube_masked.coord_dims(coordinate)).intersection( diff --git a/tobac/plotting.py b/tobac/plotting.py index 01e83f73..ed9ce7df 100644 --- a/tobac/plotting.py +++ b/tobac/plotting.py @@ -356,7 +356,6 @@ def plot_tracks_mask_field( if np.any( ~np.isnan(field.data) ): # check if field to plot is not only nan, which causes error: - plot_field = iplt.contourf( field, coords=["longitude", "latitude"], @@ -584,7 +583,6 @@ def plot_mask_cell_track_follow( track_cell = track[track["cell"] == cell] for i_row, row in track_cell.iterrows(): - constraint_time = Constraint(time=row["time"]) constraint_x = Constraint( projection_x_coordinate=lambda cell: row["projection_x_coordinate"] - width @@ -838,7 +836,6 @@ def plot_mask_cell_individual_follow( ) if cog is not None: - for i_row, row in cog.iterrows(): cell = row["cell"] @@ -857,7 +854,6 @@ def plot_mask_cell_individual_follow( ) if features is not None: - for i_row, row in features.iterrows(): color = "purple" axes.plot( @@ -934,7 +930,6 @@ def plot_mask_cell_track_static( ) time_cell = time[slice(i_start, i_end)] for time_i in time_cell: - # for i_row,row in track_cell.iterrows(): # time_i=row['time'] # constraint_time = Constraint(time=row['time']) @@ -1208,7 +1203,6 @@ def plot_mask_cell_individual_static( linewidth=1, ) if cog is not None: - for i_row, row in cog.iterrows(): cell = row["cell"] @@ -1227,7 +1221,6 @@ def plot_mask_cell_individual_static( ) if features is not None: - for i_row, row in features.iterrows(): color = "purple" axes.plot( @@ -1307,7 +1300,6 @@ def plot_mask_cell_track_2D3Dstatic( ) time_cell = time[slice(i_start, i_end)] for time_i in time_cell: - # for i_row,row in track_cell.iterrows(): # time_i=row['time'] # constraint_time = Constraint(time=row['time']) @@ -1485,7 +1477,6 @@ def plot_mask_cell_track_3Dstatic( ) time_cell = time[slice(i_start, i_end)] for time_i in time_cell: - # for i_row,row in track_cell.iterrows(): # time_i=row['time'] # constraint_time = Constraint(time=row['time']) @@ -1857,7 +1848,6 @@ def plot_mask_cell_track_static_timeseries( ) time_cell = time[slice(i_start, i_end)] for time_i in time_cell: - constraint_time = Constraint(time=time_i) constraint_x = Constraint( projection_x_coordinate=lambda cell: x_min < cell < x_max diff --git a/tobac/wrapper.py b/tobac/wrapper.py index 138063af..af367fdc 100644 --- a/tobac/wrapper.py +++ b/tobac/wrapper.py @@ -12,7 +12,6 @@ def tracking_wrapper( parameters_tracking=None, parameters_segmentation=None, ): - from .feature_detection import feature_detection_multithreshold from .tracking import linking_trackpy from .segmentation import segmentation_3D, segmentation_2D