From 28a723edbe060c53eec572a022b04909549cadb0 Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Fri, 20 Dec 2024 12:06:33 -0800 Subject: [PATCH] Isort reorder imports --- contributors/list_contributors.py | 6 ++-- examples/setup_antarctic_basins.py | 8 +++--- examples/setup_extended_antarctic_basins.py | 8 +++--- examples/setup_ice_shelves.py | 8 +++--- examples/setup_ocean_critical_passages.py | 4 +-- examples/setup_ocean_land_coverage.py | 8 +++--- examples/setup_ocean_region_groups.py | 9 +++--- ...setup_ocean_standard_transport_sections.py | 5 ++-- .../antarctic_ocean_regions.py | 16 +++++------ .../arctic_ocean_regions_partI.py | 16 +++++------ .../arctic_ocean_regions_partII.py | 16 +++++------ .../extract_bedmachine_coastlines.py | 20 ++++++------- .../bedamp2_to_netcdf.py | 7 +++-- .../extract_bedmap2_ice_coverage.py | 16 ++++------- .../iceshelves/bedmap2_to_netcdf.py | 4 +-- .../iceshelves/ice_vel_to_bedmap2.py | 6 ++-- .../iceshelves/plot_streamline.py | 8 ++---- feature_creation_scripts/iceshelves/polar.py | 1 + .../iceshelves/write_basin_distances.py | 10 +++---- .../iceshelves/write_basin_images.py | 10 +++---- .../iceshelves/write_basin_numbers.py | 3 +- .../iceshelves/write_expanded_overlaps.py | 7 +++-- .../iceshelves/write_iceshelf_distance.py | 6 ++-- .../iceshelves/write_iceshelf_features.py | 28 ++++++++----------- .../iceshelves/write_iceshelf_numbers.py | 14 ++++------ .../ismip6_antarctic_ocean_regions.py | 18 ++++++------ .../basin_masks_to_geojson_regions.py | 12 ++++---- .../transport_transects/OSNAPsections.py | 5 ++-- .../flipOSNAP_renameArcticTransectsTag.py | 3 +- geometric_features/__main__.py | 9 +++--- geometric_features/aggregation/__init__.py | 13 ++++++--- .../aggregation/landice/__init__.py | 3 +- .../aggregation/ocean/__init__.py | 14 ++++++---- .../aggregation/ocean/moc_basins.py | 3 +- geometric_features/download.py | 10 +++---- geometric_features/feature_collection.py | 17 +++++------ geometric_features/geometric_features.py | 11 +++----- geometric_features/plot.py | 8 +++--- geometric_features/test/__init__.py | 4 +-- geometric_features/test/test_aggregation.py | 13 ++++++--- .../test/test_feature_collection.py | 7 +++-- .../test/test_geometric_features.py | 3 +- geometric_features/utils.py | 10 +++---- setup.py | 3 +- 44 files changed, 202 insertions(+), 208 deletions(-) diff --git a/contributors/list_contributors.py b/contributors/list_contributors.py index 0bd72ac8..22642371 100755 --- a/contributors/list_contributors.py +++ b/contributors/list_contributors.py @@ -7,11 +7,11 @@ 02/23/2019 """ -import os -import subprocess -import shutil import datetime +import os import re +import shutil +import subprocess def append_to_file(aline, afile): diff --git a/examples/setup_antarctic_basins.py b/examples/setup_antarctic_basins.py index 4ece173d..391239f1 100755 --- a/examples/setup_antarctic_basins.py +++ b/examples/setup_antarctic_basins.py @@ -4,13 +4,13 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals - -from geometric_features import GeometricFeatures +from __future__ import (absolute_import, division, print_function, + unicode_literals) import matplotlib.pyplot as plt +from geometric_features import GeometricFeatures + plot = True # create a GeometricFeatures object that points to a local cache of geometric diff --git a/examples/setup_extended_antarctic_basins.py b/examples/setup_extended_antarctic_basins.py index e19c97e7..9a6a30ed 100755 --- a/examples/setup_extended_antarctic_basins.py +++ b/examples/setup_extended_antarctic_basins.py @@ -5,13 +5,13 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals - -from geometric_features import GeometricFeatures, FeatureCollection +from __future__ import (absolute_import, division, print_function, + unicode_literals) import matplotlib.pyplot as plt +from geometric_features import FeatureCollection, GeometricFeatures + plot = True # create a GeometricFeatures object that points to a local cache of geometric diff --git a/examples/setup_ice_shelves.py b/examples/setup_ice_shelves.py index e52de1d2..607a90cf 100755 --- a/examples/setup_ice_shelves.py +++ b/examples/setup_ice_shelves.py @@ -4,13 +4,13 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals - -from geometric_features import GeometricFeatures, FeatureCollection +from __future__ import (absolute_import, division, print_function, + unicode_literals) import matplotlib.pyplot as plt +from geometric_features import FeatureCollection, GeometricFeatures + plot = True iceShelfNames = ['Abbot', diff --git a/examples/setup_ocean_critical_passages.py b/examples/setup_ocean_critical_passages.py index b14c7ef2..22a794a1 100755 --- a/examples/setup_ocean_critical_passages.py +++ b/examples/setup_ocean_critical_passages.py @@ -4,8 +4,8 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) from geometric_features import GeometricFeatures diff --git a/examples/setup_ocean_land_coverage.py b/examples/setup_ocean_land_coverage.py index 7ab883cf..621fc042 100755 --- a/examples/setup_ocean_land_coverage.py +++ b/examples/setup_ocean_land_coverage.py @@ -8,13 +8,13 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals - -from geometric_features import GeometricFeatures +from __future__ import (absolute_import, division, print_function, + unicode_literals) import matplotlib.pyplot as plt +from geometric_features import GeometricFeatures + plot = True withCavities = False diff --git a/examples/setup_ocean_region_groups.py b/examples/setup_ocean_region_groups.py index 7195dbbf..9a36dd97 100755 --- a/examples/setup_ocean_region_groups.py +++ b/examples/setup_ocean_region_groups.py @@ -12,14 +12,15 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) -import matplotlib.pyplot as plt import copy + +import matplotlib.pyplot as plt import shapely -from geometric_features import GeometricFeatures, FeatureCollection +from geometric_features import FeatureCollection, GeometricFeatures def build_ocean_basins(gf, plot): diff --git a/examples/setup_ocean_standard_transport_sections.py b/examples/setup_ocean_standard_transport_sections.py index 9f25b561..0f507ce9 100755 --- a/examples/setup_ocean_standard_transport_sections.py +++ b/examples/setup_ocean_standard_transport_sections.py @@ -5,12 +5,11 @@ """ # stuff to make scipts work for python 2 and python 3 -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) from geometric_features import GeometricFeatures - # create a GeometricFeatures object that points to a local cache of geometric # data and knows which branch of geometric_feature to use to download # missing data diff --git a/feature_creation_scripts/antarctic_ocean_regions/antarctic_ocean_regions.py b/feature_creation_scripts/antarctic_ocean_regions/antarctic_ocean_regions.py index 00fb6408..9f72cda2 100755 --- a/feature_creation_scripts/antarctic_ocean_regions/antarctic_ocean_regions.py +++ b/feature_creation_scripts/antarctic_ocean_regions/antarctic_ocean_regions.py @@ -1,18 +1,18 @@ #!/usr/bin/env python -import shapely -import numpy -import xarray import os -import matplotlib.pyplot as plt -import pyproj -import zipfile import shutil +import zipfile -from geometric_features import GeometricFeatures, FeatureCollection -from geometric_features.feature_collection import _round_coords +import matplotlib.pyplot as plt +import numpy +import pyproj +import shapely +import xarray +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.download import download_files +from geometric_features.feature_collection import _round_coords from geometric_features.utils import write_feature_names_and_tags diff --git a/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partI.py b/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partI.py index 66a8718b..f2f85a7a 100755 --- a/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partI.py +++ b/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partI.py @@ -1,19 +1,19 @@ #!/usr/bin/env python -import shapely -import numpy -import xarray -import os -import matplotlib.pyplot as plt -import pyproj import gzip +import os import shutil import tempfile -from geometric_features import GeometricFeatures, FeatureCollection -from geometric_features.feature_collection import _round_coords +import matplotlib.pyplot as plt +import numpy +import pyproj +import shapely +import xarray +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.download import download_files +from geometric_features.feature_collection import _round_coords from geometric_features.utils import write_feature_names_and_tags diff --git a/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partII.py b/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partII.py index ab66a25e..b4a2a319 100755 --- a/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partII.py +++ b/feature_creation_scripts/arctic_ocean_regions/arctic_ocean_regions_partII.py @@ -1,19 +1,19 @@ #!/usr/bin/env python -import shapely -import numpy -import xarray -import os -import matplotlib.pyplot as plt -import pyproj import gzip +import os import shutil import tempfile -from geometric_features import GeometricFeatures, FeatureCollection -from geometric_features.feature_collection import _round_coords +import matplotlib.pyplot as plt +import numpy +import pyproj +import shapely +import xarray +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.download import download_files +from geometric_features.feature_collection import _round_coords from geometric_features.utils import write_feature_names_and_tags diff --git a/feature_creation_scripts/extract_bedmachine_coastlines/extract_bedmachine_coastlines.py b/feature_creation_scripts/extract_bedmachine_coastlines/extract_bedmachine_coastlines.py index 6d654c71..7590f087 100755 --- a/feature_creation_scripts/extract_bedmachine_coastlines/extract_bedmachine_coastlines.py +++ b/feature_creation_scripts/extract_bedmachine_coastlines/extract_bedmachine_coastlines.py @@ -1,24 +1,22 @@ #!/usr/bin/env python import os -import xarray + +import matplotlib.pyplot as plt import numpy import pyproj -import matplotlib.pyplot as plt -from skimage import measure - +import skfmm +import xarray +from scipy.interpolate import interp1d +from scipy.ndimage.filters import gaussian_filter from shapely.geometry import Polygon, mapping from shapely.ops import unary_union +from skimage import measure -from geometric_features import FeatureCollection, GeometricFeatures, \ - read_feature_collection +from geometric_features import (FeatureCollection, GeometricFeatures, + read_feature_collection) from geometric_features.utils import write_feature_names_and_tags -import skfmm - -from scipy.ndimage.filters import gaussian_filter -from scipy.interpolate import interp1d - """ We do not have permission to automatically download or re-distribute the BedMachine Antarctica topography. To download the file, follow these diff --git a/feature_creation_scripts/extract_bedmap2_ice_coverage/bedamp2_to_netcdf.py b/feature_creation_scripts/extract_bedmap2_ice_coverage/bedamp2_to_netcdf.py index 0046c25d..54cd0aad 100644 --- a/feature_creation_scripts/extract_bedmap2_ice_coverage/bedamp2_to_netcdf.py +++ b/feature_creation_scripts/extract_bedmap2_ice_coverage/bedamp2_to_netcdf.py @@ -1,9 +1,10 @@ -from netCDF4 import Dataset -import numpy import os import matplotlib.pyplot as plt -from progressbar import ProgressBar, Percentage, Bar, ETA +import numpy +from netCDF4 import Dataset +from progressbar import ETA, Bar, Percentage, ProgressBar + """ This script converts the Bedmap2 binary dataset into a NetCDF file, including longitude and latitude fields. The Bedmap2 bindary dataset is available via diff --git a/feature_creation_scripts/extract_bedmap2_ice_coverage/extract_bedmap2_ice_coverage.py b/feature_creation_scripts/extract_bedmap2_ice_coverage/extract_bedmap2_ice_coverage.py index be2d04e7..b37c5506 100644 --- a/feature_creation_scripts/extract_bedmap2_ice_coverage/extract_bedmap2_ice_coverage.py +++ b/feature_creation_scripts/extract_bedmap2_ice_coverage/extract_bedmap2_ice_coverage.py @@ -1,20 +1,14 @@ -from netCDF4 import Dataset import numpy -from matplotlib import pyplot +import skfmm from matplotlib import _cntr as cntr - +from matplotlib import pyplot +from mpl_toolkits.basemap import interp as basemap_interp +from netCDF4 import Dataset +from scipy.ndimage.filters import gaussian_filter from shapely.geometry import Polygon, mapping from shapely.ops import unary_union - from utils.feature_write_utils import write_all_features - -import skfmm - -from scipy.ndimage.filters import gaussian_filter - -from mpl_toolkits.basemap import interp as basemap_interp - """ This script takes as input the Bedmap2 topography data produced by the bedmap2_to_netcdf.py script. It produces the feature file diff --git a/feature_creation_scripts/iceshelves/bedmap2_to_netcdf.py b/feature_creation_scripts/iceshelves/bedmap2_to_netcdf.py index 8b1ed19d..d095be62 100755 --- a/feature_creation_scripts/iceshelves/bedmap2_to_netcdf.py +++ b/feature_creation_scripts/iceshelves/bedmap2_to_netcdf.py @@ -1,9 +1,9 @@ #!/usr/bin/env python2 -from netCDF4 import Dataset import numpy +from netCDF4 import Dataset +from progressbar import ETA, Bar, Percentage, ProgressBar -from progressbar import ProgressBar, Percentage, Bar, ETA """ This script converts the Bedmap2 binary dataset into a NetCDF file, including longitude and latitude fields. The Bedmap2 bindary dataset is available via diff --git a/feature_creation_scripts/iceshelves/ice_vel_to_bedmap2.py b/feature_creation_scripts/iceshelves/ice_vel_to_bedmap2.py index fb98ada2..35818362 100755 --- a/feature_creation_scripts/iceshelves/ice_vel_to_bedmap2.py +++ b/feature_creation_scripts/iceshelves/ice_vel_to_bedmap2.py @@ -1,15 +1,13 @@ #!/usr/bin/env python +import matplotlib import numpy from netCDF4 import Dataset -import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt - -from mpl_toolkits.basemap import interp - import scipy.ndimage.filters as filters +from mpl_toolkits.basemap import interp inFileName = 'Bedmap2_ice_shelf_distance.nc' inFile = Dataset(inFileName,'r') diff --git a/feature_creation_scripts/iceshelves/plot_streamline.py b/feature_creation_scripts/iceshelves/plot_streamline.py index 6d2b0087..e7cc7a6f 100755 --- a/feature_creation_scripts/iceshelves/plot_streamline.py +++ b/feature_creation_scripts/iceshelves/plot_streamline.py @@ -1,19 +1,17 @@ #!/usr/bin/env python +import matplotlib import numpy from netCDF4 import Dataset -import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt - -from mpl_toolkits.basemap import interp - import scipy.integrate import scipy.ndimage.morphology as morphology - +from mpl_toolkits.basemap import interp from skimage import measure + def interpVel(p,t): np = len(p)/2 x = p[0:np] diff --git a/feature_creation_scripts/iceshelves/polar.py b/feature_creation_scripts/iceshelves/polar.py index 5a7cfdbb..9fddcb3b 100644 --- a/feature_creation_scripts/iceshelves/polar.py +++ b/feature_creation_scripts/iceshelves/polar.py @@ -1,5 +1,6 @@ import numpy + def toPolar(points): lons = numpy.pi*points[:,0]/180. lats = numpy.pi*points[:,1]/180. diff --git a/feature_creation_scripts/iceshelves/write_basin_distances.py b/feature_creation_scripts/iceshelves/write_basin_distances.py index f3b6fef9..2a92e1a7 100755 --- a/feature_creation_scripts/iceshelves/write_basin_distances.py +++ b/feature_creation_scripts/iceshelves/write_basin_distances.py @@ -1,17 +1,17 @@ #!/usr/bin/env python -import numpy -from netCDF4 import Dataset +import os +import matplotlib +import numpy import scipy.misc - import skfmm -import os +from netCDF4 import Dataset -import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt + def readBasinImage(name): basinImage = scipy.misc.imread('basins/%s.png'%name) data = 1.0 - numpy.array(basinImage[::-1,:,0],float)/255. diff --git a/feature_creation_scripts/iceshelves/write_basin_images.py b/feature_creation_scripts/iceshelves/write_basin_images.py index bffc034c..9244e636 100755 --- a/feature_creation_scripts/iceshelves/write_basin_images.py +++ b/feature_creation_scripts/iceshelves/write_basin_images.py @@ -1,18 +1,18 @@ #!/usr/bin/env python -import numpy import json import sys + +import matplotlib +import numpy +from descartes import PolygonPatch from netCDF4 import Dataset from shapely.geometry import shape -from descartes import PolygonPatch -import matplotlib matplotlib.use('Agg') -import matplotlib.pyplot as plt - import os.path +import matplotlib.pyplot as plt from polar import toPolar diff --git a/feature_creation_scripts/iceshelves/write_basin_numbers.py b/feature_creation_scripts/iceshelves/write_basin_numbers.py index c368cfd5..74977c78 100755 --- a/feature_creation_scripts/iceshelves/write_basin_numbers.py +++ b/feature_creation_scripts/iceshelves/write_basin_numbers.py @@ -1,13 +1,12 @@ #!/usr/bin/env python +import matplotlib import numpy from netCDF4 import Dataset -import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt - inFileName = 'Bedmap2_ice_shelf_distance.nc' basinFileName = 'Bedmap2_grid_basin_distances.nc' diff --git a/feature_creation_scripts/iceshelves/write_expanded_overlaps.py b/feature_creation_scripts/iceshelves/write_expanded_overlaps.py index e1032b9e..73516635 100755 --- a/feature_creation_scripts/iceshelves/write_expanded_overlaps.py +++ b/feature_creation_scripts/iceshelves/write_expanded_overlaps.py @@ -1,15 +1,16 @@ #!/usr/bin/env python -import numpy import csv -from netCDF4 import Dataset import matplotlib +import numpy +from netCDF4 import Dataset + matplotlib.use('Agg') import matplotlib.pyplot as plt - import skfmm + def getBoundinBox(mask): xIndices = numpy.nonzero(numpy.amax(mask,axis=0))[0] yIndices = numpy.nonzero(numpy.amax(mask,axis=1))[0] diff --git a/feature_creation_scripts/iceshelves/write_iceshelf_distance.py b/feature_creation_scripts/iceshelves/write_iceshelf_distance.py index 1a576dfc..3d7df3c4 100755 --- a/feature_creation_scripts/iceshelves/write_iceshelf_distance.py +++ b/feature_creation_scripts/iceshelves/write_iceshelf_distance.py @@ -1,14 +1,12 @@ #!/usr/bin/env python +import matplotlib import numpy -from netCDF4 import Dataset - import skfmm +from netCDF4 import Dataset -import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt - import scipy.ndimage.morphology as morphology inFileName = 'Bedmap2.nc' diff --git a/feature_creation_scripts/iceshelves/write_iceshelf_features.py b/feature_creation_scripts/iceshelves/write_iceshelf_features.py index f9e6d5bf..0db93cc4 100755 --- a/feature_creation_scripts/iceshelves/write_iceshelf_features.py +++ b/feature_creation_scripts/iceshelves/write_iceshelf_features.py @@ -1,34 +1,28 @@ #!/usr/bin/env python -import numpy -import json import csv +import json + +import matplotlib +import numpy +from descartes import PolygonPatch from netCDF4 import Dataset from shapely.geometry import Polygon, mapping, shape -from descartes import PolygonPatch -import matplotlib matplotlib.use('Agg') -import matplotlib.pyplot as plt -import matplotlib.patches -import matplotlib.colors - +import gc import os -from mpl_toolkits.basemap import interp - -from skimage import measure - +import matplotlib.colors +import matplotlib.patches +import matplotlib.pyplot as plt import scipy.misc - import skfmm - +from mpl_toolkits.basemap import interp from polar import fromPolar - +from skimage import measure from utils.feature_write_utils import write_all_features -import gc - overlapsFileName = 'extendedOverlaps.nc' shelfDistanceFileName = 'Bedmap2_ice_shelf_distance.nc' namesFileName = 'ice_shelf_lat_lon.csv' diff --git a/feature_creation_scripts/iceshelves/write_iceshelf_numbers.py b/feature_creation_scripts/iceshelves/write_iceshelf_numbers.py index c0e6063a..26df8efb 100755 --- a/feature_creation_scripts/iceshelves/write_iceshelf_numbers.py +++ b/feature_creation_scripts/iceshelves/write_iceshelf_numbers.py @@ -1,22 +1,18 @@ #!/usr/bin/env python -import numpy import csv -from netCDF4 import Dataset import matplotlib +import numpy +from netCDF4 import Dataset + matplotlib.use('Agg') import matplotlib.pyplot as plt - -from mpl_toolkits.basemap import interp - -from skimage import measure - import scipy.misc - import skfmm - +from mpl_toolkits.basemap import interp from polar import toPolar +from skimage import measure inFileName = 'Bedmap2_ice_shelf_distance.nc' outFileName = 'Bedmap2_ice_shelf_numbers.nc' diff --git a/feature_creation_scripts/ismip6_antarctic_ocean_regions/ismip6_antarctic_ocean_regions.py b/feature_creation_scripts/ismip6_antarctic_ocean_regions/ismip6_antarctic_ocean_regions.py index cc226fc0..56adbd8e 100755 --- a/feature_creation_scripts/ismip6_antarctic_ocean_regions/ismip6_antarctic_ocean_regions.py +++ b/feature_creation_scripts/ismip6_antarctic_ocean_regions/ismip6_antarctic_ocean_regions.py @@ -1,19 +1,19 @@ #!/usr/bin/env python -import shapely.geometry -import shapely.ops -import numpy -import xarray import os -import matplotlib.pyplot as plt -import pyproj -import zipfile import shutil +import zipfile -from geometric_features import GeometricFeatures, FeatureCollection -from geometric_features.feature_collection import _round_coords +import matplotlib.pyplot as plt +import numpy +import pyproj +import shapely.geometry +import shapely.ops +import xarray +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.download import download_files +from geometric_features.feature_collection import _round_coords from geometric_features.utils import write_feature_names_and_tags diff --git a/feature_creation_scripts/ismip6_landice_basins/basin_masks_to_geojson_regions.py b/feature_creation_scripts/ismip6_landice_basins/basin_masks_to_geojson_regions.py index 0ab8ab50..2145f2a5 100755 --- a/feature_creation_scripts/ismip6_landice_basins/basin_masks_to_geojson_regions.py +++ b/feature_creation_scripts/ismip6_landice_basins/basin_masks_to_geojson_regions.py @@ -6,17 +6,17 @@ # * pyproj import os -import numpy -import xarray -import pyproj -import matplotlib.pyplot as plt -from importlib.resources import path from configparser import ConfigParser, ExtendedInterpolation +from importlib.resources import path +import matplotlib.pyplot as plt +import numpy +import pyproj +import xarray from ismip6_ocean_forcing.bedmap2 import bedmap2_to_ismip6_grid from ismip6_ocean_forcing.imbie import make_imbie_masks -from geometric_features import GeometricFeatures, FeatureCollection +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.utils import write_feature_names_and_tags diff --git a/feature_creation_scripts/transport_transects/OSNAPsections.py b/feature_creation_scripts/transport_transects/OSNAPsections.py index 1aabb939..9973b379 100755 --- a/feature_creation_scripts/transport_transects/OSNAPsections.py +++ b/feature_creation_scripts/transport_transects/OSNAPsections.py @@ -1,10 +1,11 @@ #!/usr/bin/env python import csv -import matplotlib.pyplot as plt import shutil -from geometric_features import GeometricFeatures, FeatureCollection +import matplotlib.pyplot as plt + +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.utils import write_feature_names_and_tags diff --git a/feature_creation_scripts/transport_transects/flipOSNAP_renameArcticTransectsTag.py b/feature_creation_scripts/transport_transects/flipOSNAP_renameArcticTransectsTag.py index d2d38e9a..80776f0d 100644 --- a/feature_creation_scripts/transport_transects/flipOSNAP_renameArcticTransectsTag.py +++ b/feature_creation_scripts/transport_transects/flipOSNAP_renameArcticTransectsTag.py @@ -2,10 +2,9 @@ import shutil -from geometric_features import GeometricFeatures, FeatureCollection +from geometric_features import FeatureCollection, GeometricFeatures from geometric_features.utils import write_feature_names_and_tags - gf = GeometricFeatures(cacheLocation='../../geometric_data', remoteBranchOrTag='main') diff --git a/geometric_features/__main__.py b/geometric_features/__main__.py index e5caf911..b90e0d8f 100644 --- a/geometric_features/__main__.py +++ b/geometric_features/__main__.py @@ -1,12 +1,13 @@ -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) import argparse import os + import geometric_features from geometric_features import GeometricFeatures -from geometric_features.feature_collection import FeatureCollection, \ - read_feature_collection +from geometric_features.feature_collection import (FeatureCollection, + read_feature_collection) def combine_features(): diff --git a/geometric_features/aggregation/__init__.py b/geometric_features/aggregation/__init__.py index df09bf69..32e06b79 100644 --- a/geometric_features/aggregation/__init__.py +++ b/geometric_features/aggregation/__init__.py @@ -1,9 +1,14 @@ -from geometric_features.aggregation.ocean import basins, subbasins, \ - antarctic, ismip6_greenland, ice_shelves, ismip6, arctic as arctic_ocean, \ - transport, arctic_transport, moc from geometric_features.aggregation.landice import nasa_greenland +from geometric_features.aggregation.ocean import antarctic +from geometric_features.aggregation.ocean import arctic as arctic_ocean +from geometric_features.aggregation.ocean import (arctic_transport, basins, + ice_shelves, ismip6, + ismip6_greenland, moc, + subbasins, transport) from geometric_features.aggregation.seaice import arctic as arctic_seaice -from geometric_features.aggregation.seaice import qgreenland as qgreenland_seaice +from geometric_features.aggregation.seaice import \ + qgreenland as qgreenland_seaice + def get_aggregator_by_name(region_group): """ diff --git a/geometric_features/aggregation/landice/__init__.py b/geometric_features/aggregation/landice/__init__.py index 485cfe31..3c915c9a 100644 --- a/geometric_features/aggregation/landice/__init__.py +++ b/geometric_features/aggregation/landice/__init__.py @@ -1 +1,2 @@ -from geometric_features.aggregation.landice.nasa_greenland_extended import nasa_greenland +from geometric_features.aggregation.landice.nasa_greenland_extended import \ + nasa_greenland diff --git a/geometric_features/aggregation/ocean/__init__.py b/geometric_features/aggregation/ocean/__init__.py index 448a6f90..887313e2 100644 --- a/geometric_features/aggregation/ocean/__init__.py +++ b/geometric_features/aggregation/ocean/__init__.py @@ -1,10 +1,12 @@ -from geometric_features.aggregation.ocean.subbasin_regions import subbasins -from geometric_features.aggregation.ocean.ocean_basins import basins -from geometric_features.aggregation.ocean.arctic_regions import arctic from geometric_features.aggregation.ocean.antarctic_regions import antarctic +from geometric_features.aggregation.ocean.arctic_regions import arctic +from geometric_features.aggregation.ocean.arctic_transport_transects import \ + arctic_transport from geometric_features.aggregation.ocean.ice_shelf_regions import ice_shelves +from geometric_features.aggregation.ocean.ismip6_greenland_regions import \ + ismip6_greenland +from geometric_features.aggregation.ocean.ismip6_regions import ismip6 from geometric_features.aggregation.ocean.moc_basins import moc +from geometric_features.aggregation.ocean.ocean_basins import basins +from geometric_features.aggregation.ocean.subbasin_regions import subbasins from geometric_features.aggregation.ocean.transport_transects import transport -from geometric_features.aggregation.ocean.arctic_transport_transects import arctic_transport -from geometric_features.aggregation.ocean.ismip6_regions import ismip6 -from geometric_features.aggregation.ocean.ismip6_greenland_regions import ismip6_greenland diff --git a/geometric_features/aggregation/ocean/moc_basins.py b/geometric_features/aggregation/ocean/moc_basins.py index 9f2520c9..e612fbd9 100644 --- a/geometric_features/aggregation/ocean/moc_basins.py +++ b/geometric_features/aggregation/ocean/moc_basins.py @@ -1,6 +1,7 @@ +import copy + import shapely.geometry import shapely.ops -import copy from geometric_features import FeatureCollection diff --git a/geometric_features/download.py b/geometric_features/download.py index d0e1e2a3..52285664 100644 --- a/geometric_features/download.py +++ b/geometric_features/download.py @@ -1,12 +1,12 @@ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - +from __future__ import (absolute_import, division, print_function, + unicode_literals) import os -import requests -import progressbar from urllib.request import pathname2url +import progressbar +import requests + # From https://stackoverflow.com/a/1094933/7728169 def sizeof_fmt(num, suffix='B'): diff --git a/geometric_features/feature_collection.py b/geometric_features/feature_collection.py index 3512d44c..24483bbb 100644 --- a/geometric_features/feature_collection.py +++ b/geometric_features/feature_collection.py @@ -1,7 +1,8 @@ -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) import json + try: import matplotlib.pyplot as plt except ImportError: @@ -10,18 +11,18 @@ mpl.use('Agg', force=True) import matplotlib.pyplot as plt -import shapely.geometry -import shapely.ops +import copy + import cartopy import numpy as np import progressbar -import copy +import shapely.geometry +import shapely.ops +from geometric_features.plot import (build_projections, plot_base, + subdivide_geom) from geometric_features.utils import provenance_command -from geometric_features.plot import build_projections, subdivide_geom, \ - plot_base - def read_feature_collection(fileName): """ diff --git a/geometric_features/geometric_features.py b/geometric_features/geometric_features.py index 04516bae..4b9dfeaa 100644 --- a/geometric_features/geometric_features.py +++ b/geometric_features/geometric_features.py @@ -1,17 +1,14 @@ -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) import json import os - from importlib.resources import files as imp_res_files import geometric_features - -from geometric_features.feature_collection import FeatureCollection, \ - read_feature_collection - from geometric_features.download import download_files +from geometric_features.feature_collection import (FeatureCollection, + read_feature_collection) class GeometricFeatures(object): diff --git a/geometric_features/plot.py b/geometric_features/plot.py index 0aa14e9e..6b095cc5 100644 --- a/geometric_features/plot.py +++ b/geometric_features/plot.py @@ -1,10 +1,10 @@ -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) -import numpy as np -import matplotlib.pyplot as plt import cartopy.crs import cartopy.feature +import matplotlib.pyplot as plt +import numpy as np import shapely diff --git a/geometric_features/test/__init__.py b/geometric_features/test/__init__.py index 4cd11f75..bef37584 100644 --- a/geometric_features/test/__init__.py +++ b/geometric_features/test/__init__.py @@ -5,11 +5,11 @@ 03/16/2017 """ +import os +import shutil import warnings from contextlib import contextmanager -import os -import shutil from pytest import fixture try: diff --git a/geometric_features/test/test_aggregation.py b/geometric_features/test/test_aggregation.py index 9d955b7e..e77c0e47 100644 --- a/geometric_features/test/test_aggregation.py +++ b/geometric_features/test/test_aggregation.py @@ -1,10 +1,15 @@ import pytest -from geometric_features.test import TestCase, loaddatadir from geometric_features import GeometricFeatures -from geometric_features.aggregation import get_aggregator_by_name, basins, \ - subbasins, antarctic, ice_shelves, ismip6, arctic_ocean, transport, \ - arctic_transport, moc, arctic_seaice, qgreenland_seaice, nasa_greenland, ismip6_greenland +from geometric_features.aggregation import (antarctic, arctic_ocean, + arctic_seaice, arctic_transport, + basins, get_aggregator_by_name, + ice_shelves, ismip6, + ismip6_greenland, moc, + nasa_greenland, qgreenland_seaice, + subbasins, transport) +from geometric_features.test import TestCase, loaddatadir + @pytest.mark.usefixtures('loaddatadir') class TestAggregation(TestCase): diff --git a/geometric_features/test/test_feature_collection.py b/geometric_features/test/test_feature_collection.py index da3aa8ed..62f77d68 100644 --- a/geometric_features/test/test_feature_collection.py +++ b/geometric_features/test/test_feature_collection.py @@ -1,12 +1,13 @@ -import os import json +import os + import pytest import shapely import shapely.geometry +from geometric_features import (FeatureCollection, GeometricFeatures, + read_feature_collection) from geometric_features.test import TestCase, loaddatadir -from geometric_features import GeometricFeatures, FeatureCollection, \ - read_feature_collection @pytest.mark.usefixtures('loaddatadir') diff --git a/geometric_features/test/test_geometric_features.py b/geometric_features/test/test_geometric_features.py index a5cec2a5..a401bf43 100644 --- a/geometric_features/test/test_geometric_features.py +++ b/geometric_features/test/test_geometric_features.py @@ -1,8 +1,9 @@ import os + import pytest -from geometric_features.test import TestCase, loaddatadir from geometric_features import GeometricFeatures +from geometric_features.test import TestCase, loaddatadir @pytest.mark.usefixtures('loaddatadir') diff --git a/geometric_features/utils.py b/geometric_features/utils.py index 4f97563c..6942df48 100644 --- a/geometric_features/utils.py +++ b/geometric_features/utils.py @@ -1,13 +1,13 @@ -from __future__ import absolute_import, division, print_function, \ - unicode_literals +from __future__ import (absolute_import, division, print_function, + unicode_literals) +import datetime import glob import json -from collections import OrderedDict import os -import sys import socket -import datetime +import sys +from collections import OrderedDict def write_feature_names_and_tags(cacheLocation='./geometry_data'): diff --git a/setup.py b/setup.py index ed8d1613..ec922a49 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,8 @@ import os import re -from setuptools import setup, find_packages + +from setuptools import find_packages, setup here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'geometric_features', '__init__.py')) as f: