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

Issues: from utils import vectorize #53

Open
2 tasks done
AquaPore opened this issue Oct 3, 2024 · 0 comments
Open
2 tasks done

Issues: from utils import vectorize #53

AquaPore opened this issue Oct 3, 2024 · 0 comments

Comments

@AquaPore
Copy link

AquaPore commented Oct 3, 2024

pyFlwDir version checks

  • I have checked that this issue has not already been reported.
  • I have checked that this bug exists on the latest version of pyFlwDir.

Reproducible Example

A great thanks for deriving such an amazing tool to help to derive the data to feed into the WFLOW Julia model.

The PyFlwDir seem to be working well except fror:

from utils import vectorize

were vectorize is not being recognised.

And therefore I am not able to perform the simple task as in your example:

gdf_bas = vectorize(subbasins.astype(np.int32), 0, flw.transform, name="basin")

Will you kindly inform me if the following code which I derived from your excellent website works on your computer?

import geopandas as gpd
import numpy as np
import rasterio
import pyflwdir
from utils import vectorize

# define output locations
x, y = np.array([4.67916667, 7.60416667]), np.array([51.72083333, 50.3625])
gdf_out = gpd.GeoSeries(gpd.points_from_xy(x, y, crs=4326))
# delineate subbasins
subbasins = flw.basins(xy=(x, y), streams=flw.stream_order() >= 4)
# vectorize subbasins using the vectorize convenience method from utils.py
gdf_bas = vectorize(subbasins.astype(np.int32), 0, flw.transform, name="basin")
gdf_bas.head()

Many thanks for any help you may provide,
Joseph

Current behaviour

ImportError: cannot import name 'vectorize' from 'utils' (c:\Users\PollaccoJ.julia\conda\3\x86_64\envs\hydromt-wflow\Lib\site-packages\utils_init.py)_

Desired behaviour

Free from error

Additional context

Please appologize for such a basic question, as I am somewhat new to spatial modelling. I am in the Southern hemisphere so there might be some extra complications.

My other questions is the coordinate system used to define the output location is the same as when for e.g. the coordinate (y,x) system as shown in QGIS . it did not seem to work. Or do we need to perform transformation to the gridded coordinate system used by PyFlwDir?

Many thanks for any help you may provide,
Joseph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant