isce-framework / isce-framework/isce3

Inconsistent parameter name in `RadarGridParameters.__init__()`

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
239
Forks
90
Avg merge
13d 1h
Merged PRs (30d)
5

Description

Note 1: this Issue is a copy of https://github-fn.jpl.nasa.gov/isce-3/isce/issues/2094 (internal repo), submitted Dec 11, 2024 by @gmgunter . Links below have been updated for public GitHub.

Note 2: this issue was rediscovered while implementing a PR for nisarqa: https://github.com/isce-framework/nisarqa/pull/161 . nisarqa is currently implemented to use the lookside spelling (no underscore) and always pass an isce3.core.LookSide object. In other words, if the final decision to resolve this issue changes the interface to always use look_side (with an underscore), then one downstream impact is that nisarqa will also need to be updated.


In the pybind11 bindings for isce3.product.RadarGridParameters, two constructors are exposed (well, technically there's a third constructor as well, but it's silly and not relevant here).

One constructor allows passing the look direction as an isce3.core.LookSide object:

https://github.com/isce-framework/isce3/blob/2919e1c976922cbac82ab19093cabf8d71698e8e/python/extensions/pybind_isce3/product/RadarGridParameters.cpp#L32-L33

The other constructor allows passing the look direction as a string (like "Left" or "Right"):

https://github.com/isce-framework/isce3/blob/2919e1c976922cbac82ab19093cabf8d71698e8e/python/extensions/pybind_isce3/product/RadarGridParameters.cpp#L43-L51

Unfortunately, the parameter names for the look side arguments in the two constructors are different. The first constructor names it "lookside":

https://github.com/isce-framework/isce3/blob/2919e1c976922cbac82ab19093cabf8d71698e8e/python/extensions/pybind_isce3/product/RadarGridParameters.cpp#L39

The second constructor names it "look_side" (with an underscore):

https://github.com/isce-framework/isce3/blob/2919e1c976922cbac82ab19093cabf8d71698e8e/python/extensions/pybind_isce3/product/RadarGridParameters.cpp#L64

This is very inconvenient for writing generic code that can construct a RadarGridParameters object from either an isce3.core.LookSide or a string. Ideally, we should make the two parameter names consistent.

The first constructor's name is consistent with the name of the RadarGridParameters.lookside attribute, so it should probably be preferred. However, a lot of code in isce3 will be broken by renaming the "look_side" parameter of the second constructor to "lookside".

Contributor guide

Open the contributing guide

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 in python/extensions/pybind_isce3/product/RadarGridParameters.cpp at the two pybind11 constructors and compare their lookside/look_side argument names. Search isce3 and the linked nisarqa PR for callers of both keyword forms before choosing the consistent interface. Done means the constructors expose one parameter spelling and affected callers remain compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.