Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion dem_handler/dem/cop_glo30.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import geopandas as gpd
import numpy as np
import rasterio
import rasterio.mask
import shapely.geometry
from affine import Affine
from rasterio.crs import CRS
Expand Down
3 changes: 0 additions & 3 deletions dem_handler/dem/rema.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from __future__ import annotations

import glob
import logging
import math
import os
import zipfile
from pathlib import Path
from urllib.request import urlretrieve

import geopandas as gpd
import numpy as np
Expand Down
11 changes: 2 additions & 9 deletions dem_handler/download/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import logging
import os
from logging import config
from pathlib import Path
from urllib.request import urlretrieve

import boto3
import numpy as np
import rasterio
import rasterio.profiles

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can see a few imports have changed. Just confirming these are all not required

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes I removed the unused imports

import rasterio.session
import requests
from botocore import UNSIGNED
from botocore.config import Config
from rasterio.mask import mask
Expand Down Expand Up @@ -141,12 +140,6 @@ def download_egm_08_geoid(
return geoid_arr, geoid_profile


import os
from urllib.request import urlretrieve

import requests


def find_files(folder, contains):
paths = []
for root, dirs, files in os.walk(folder):
Expand Down
3 changes: 2 additions & 1 deletion dem_handler/utils/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import asyncio
import logging
import os
from asyncio import gather
from pathlib import Path

Expand All @@ -13,6 +12,8 @@
from botocore.client import Config
from botocore.exceptions import ClientError

mp.set_start_method("spawn", force=True)

logger = logging.getLogger(__name__)


Expand Down
7 changes: 2 additions & 5 deletions dem_handler/utils/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
import rasterio
from affine import Affine
from osgeo import gdal

gdal.UseExceptions()

from pyproj import Transformer
from rasterio.enums import Resampling
from rasterio.io import MemoryFile
from rasterio.merge import merge
from rasterio.transform import array_bounds, from_origin
from rasterio.warp import calculate_default_transform, reproject
from rasterio.windows import from_bounds
from shapely.geometry import box

gdal.UseExceptions()


def adjust_pixel_coordinate_from_point_to_area(
Expand Down
2 changes: 0 additions & 2 deletions dem_handler/utils/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import json
import logging
import os
import shutil
from dataclasses import dataclass
from pathlib import Path

Expand All @@ -19,7 +18,6 @@
from pyproj import CRS
from pyproj.aoi import AreaOfInterest
from pyproj.database import query_utm_crs_info
from rasterio.io import DatasetReader
from rasterio.profiles import Profile
from shapely import segmentize
from shapely.geometry import MultiPolygon, Polygon, box
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ version_file = "dem_handler/_version.py"

[tool.pytest.ini_options]
testpaths = ["tests/*"]
filterwarnings = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does the warning filter need to be added with the fix?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, for some reason urlib3 which I don't know where it is being used :D will complain about another package it is importing that is enabling the global lock (GIL) for Python versions that disable it (i.e. python 3.13t or 3.14t) so I suppressed the warning in the pytest configs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Unless we don't want to care about the warning.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IMO I'm not too fussed about the warning, but if you and Caitlin want to suppress cool w me!

"ignore:The global interpreter lock .* '_brotli'.*:RuntimeWarning",
]

[tool.setuptools.packages.find]
where = ["."]
Expand Down
Loading