Migrating from PCRaster

earthkit-hydro can be used as a drop-in replacement for PCRaster in many cases, offering a substantial speedup. As a design decision, it does not attempt to match PCRaster’s API, meaning that migrated code may look slightly different.

Here is a useful summary table of some common translations between earthkit-hydro and PCRaster.

PCRaster

earthkit-hydro

Note

accuflux

upstream.sum

catchmenttotal

upstream.sum

downstream

move.upstream

upstream

move.downstream

catchment

catchments.find

subcatchment

catchments.find

overwrite=False

path

upstream.max

ldddist

distance.min

friction input is slightly different from weights; by default, distance between two nodes is one regardless of diagonal

downstreamdist

distance.to_sink

Same caveats as for ldddist

slopelength

distance.to_source

path=”longest”; same caveats as for ldddist

lddmask

subnetwork.from_mask

abs, sin, cos, tan, …

np.abs, np.sin, np.cos, np.tan, …

Any array operations can be directly used (example shown for NumPy backend)

Points of difference

  • earthkit-hydro treats missing values as np.nans i.e. any arithmetic involving a missing value will return a missing value. PCRaster does not always handle missing values exactly the same.

  • earthkit-hydro can handle vector fields.