Code Monkey home page Code Monkey logo

Comments (7)

Jiangchao3 avatar Jiangchao3 commented on July 18, 2024 1

The script your put here can identify all the river mouth pits.

Many thanks for your help!

from pyflwdir.

DirkEilander avatar DirkEilander commented on July 18, 2024

Hi @Jiangchao3, I believe the nextxy data is orientated North -> South (the first row is the most northern), which you also see in the xarray plot. Xarray jus plots the first row in the bottom based on nc contentions which dictate that data is oriented South -> North. To get the correct point locations you need to also make you lat array from north to south lat = np.linspace(90,-90,3600).

You can also parse the data with flw = pyflwdir.from_array(data, ftype='nextxy', transform=transform) and than use the idxs = flw.idxs_pit attribute in combination with the x, y = flw.xy(idxs) method to get the x, y location of outlets.

PS: To get a correct xarray plot you need to add the correct lat and lon dimension coordinates.

from pyflwdir.

Jiangchao3 avatar Jiangchao3 commented on July 18, 2024

Hi @DirkEilander ,

Thanks for your kindly reply. No error occured after using the lat =np.linspace(90,-90,3600).

And thanks for recommonding the idxs = flw.idxs_pit method. It works very well.
image
But it seems to find all the outlets (both -10 and -9), could I set a parameter to only find the outlet (-10) or outlet (-9)?
I have a try using the
idxs = flw.idxs_pit(-9) or
flw = pyflwdir.from_array(data,ftype='nextxy',idxs_pit='-9',latlon=True,transform = transform)
but boht failed.

Looking forward to your help!

Best,
Jiangchao

from pyflwdir.

DirkEilander avatar DirkEilander commented on July 18, 2024

Glad it works. We don't distinguish between different types of river outlets (-9) and inland pits (-10) in pyflwdir as most D8 flow direction types don't have this distinction. What you could do is after reading and parsing the nextxy data drop the locations corresponding to inland pits:

idxs = flw.idxs_pit
nextx = data[0]
idxs = idxs[nextx.flat[idxs] == -9]
x, y = flw.xy(idxs)

from pyflwdir.

Jiangchao3 avatar Jiangchao3 commented on July 18, 2024

Dear @DirkEilander, I am trying to get discharge timeseries from the CaMa-flood output data according to the (x,y) coordinate of the river outlets(-9).

I am not sure the rivermouth points obtained by x, y = flw.xy(idxs) is located at the center of each pits?

The following screensnaps shows the information of my CaMa-flood output discharge.

image

Could you please give me some suggestions on how to get discharges of each rivermouth pit?

Many thanks!

Jiangchao

from pyflwdir.

DirkEilander avatar DirkEilander commented on July 18, 2024

I am not sure the rivermouth points obtained by x, y = flw.xy(idxs) is located at the center of each pits?

The coordinates obtained with that function should be at the center of the cell if the transform is set well when initializing flw.

from pyflwdir.

Jiangchao3 avatar Jiangchao3 commented on July 18, 2024

The coordinates obtained with that function should be at the center of the cell if the transform is set well when initializing flw.

Got it. Thanks for your relply.

from pyflwdir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.