Skip to content

Commit

Permalink
Squashed mypy and pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aaschwanden committed May 20, 2024
1 parent 49a4bd8 commit e6feea1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drainage_basin_generator/calculate_basin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"""
Module to calcuate drainage basins from surface DEM.
"""
# pylint: disable=redefined-outer-name

import sys
from argparse import Action, ArgumentDefaultsHelpFormatter, ArgumentParser
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser

import drainage_basin_calculator as dbg
import numpy as np
import xarray as xr

import drainage_basin_generator as dbg


def load_data(input_file, thickness_varname: str = "thickness", surface_varname: str = "surface", coarsen: int = 1):
"""
Expand Down Expand Up @@ -74,7 +75,7 @@ def initialize_mask(thk, x, y, terminus):
numpy.ndarray
The initialized mask.
"""
mask = dbg.initialize_mask(thk.to_numpy().astype(float))
mask = dbg.initialize_mask(thk.to_numpy().astype(float)) # type: ignore[attr-defined]

if terminus is not None:
x_min, x_max, y_min, y_max = terminus
Expand Down Expand Up @@ -114,6 +115,7 @@ def initialize_mask(thk, x, y, terminus):
sys.stderr.write("done.\n")

sys.stderr.write("Computing the drainage basin mask...")
db = dbg.upslope_area(x.to_numpy(), y.to_numpy(), z.to_numpy().astype(float), mask)
db = dbg.upslope_area(x.to_numpy(), y.to_numpy(), z.to_numpy().astype(float), mask) # type: ignore[attr-defined]

db = xr.DataArray(data=db, dims=["y", "x"], coords=thickness.coords, name="mask")
db.to_netcdf(opts.output)

0 comments on commit e6feea1

Please sign in to comment.