Added an additional not_visible_nan keyword only parameter to transformations from longitude/latitude coordinates (i.e. lonlat2... methods). With not_visible_nan=True, the returned coordinates will be NaN if the longitude/latitude coordinates aren't visible to the observer (e.g. if the coordinates are on the far side of the target body). not_visible_nan defaults to False, so the default behaviour is unchanged.
For example:
body = planetmapper.Body('Jupiter', utc='2005-01-01T00:00:00')
# By default, lonlat2radec will always return values, even if the point is hidden
print(body.lonlat2radec(180, 0))
# (196.3742463154229, -5.566702383405959)
print(body.lonlat2radec(0, 0))
# (196.36993081145695, -5.565236600066979)
# With not_visible_nan=True, hidden points return (nan, nan)
print(body.lonlat2radec(180, 0, not_visible_nan=True))
# (196.3742463154229, -5.566702383405959)
print(body.lonlat2radec(0, 0, not_visible_nan=True))
# (nan, nan)
Previously, this behaviour was only possible by manually using test_if_lonlat_visible.
Closes #367
Pull request checklist
[x] Add a clear description of the change
[x] Add any new tests needed
[x] Run spell check on new text visible to user (documentation, GUI etc.)
[x] Check any changes to requirements.txt are reflected in setup.py and conda-forge feedstock
[x] Check code passes CI checks (run run_ci.sh or check GitHub Actions)
Added an additional
not_visible_nan
keyword only parameter to transformations from longitude/latitude coordinates (i.e.lonlat2...
methods). Withnot_visible_nan=True
, the returned coordinates will be NaN if the longitude/latitude coordinates aren't visible to the observer (e.g. if the coordinates are on the far side of the target body).not_visible_nan
defaults toFalse
, so the default behaviour is unchanged.For example:
Previously, this behaviour was only possible by manually using
test_if_lonlat_visible
.Closes #367
Pull request checklist
requirements.txt
are reflected insetup.py
and conda-forge feedstockrun_ci.sh
or check GitHub Actions)See CONTRIBUTING.md for more details.