Deltares / Deltares/imod-python

Check and clean coordinate cellsize handling

Open
#121 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

In GitLab by @Huite on Feb 24, 2020, 11:30

We've started adding cellsize data as dx for x, dy for y, etc. Initially, I figured it would be a good idea to encode the increasing or decreasing direction of the coordinate with the sign of the cellsize. This is a terrible idea in retrospect, since we cannot expect xarray to guarantee flipping the sign on selection, combine's, etc.

A much more robust way is simply checking the index is_monotonic_increasing or is_monotonic_decreasing.
This logic should ideally also be combined in a single place, taking care of directions, but also whether cellsizes are array or scalar.

  • Find places where this logic occurs
  • Identify what's needed, refactor that into a single function
  • Check copying behaviour: I expect sel and isel to work without copying, but I'm not sure
  • Set all cellsizes to positive, rely on is_monotonic... to determine direction instead
  • Special case single value coordinates? Since I believe they always return False

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating all handling of coordinate cell sizes such as dx and dy, then inspect how selection and combine operations determine coordinate direction. Done means the logic is centralized, cell sizes are positive, monotonic index direction is used, and copying behavior plus single-value coordinates are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.