Skip to content

Commit

Permalink
Hide the warnings issued by ERFA during UT1 calculation
Browse files Browse the repository at this point in the history
The warnings are expected for simulation data from the future.
  • Loading branch information
timj committed Sep 17, 2019
1 parent 29eec1f commit 49960f3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/lsst/obs/base/makeRawVisitInfoViaObsInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import warnings
import astropy.units
import astropy.utils.exceptions
from astropy.utils import iers

# This is an unofficial ERFA interface provided by Astropy.
Expand Down Expand Up @@ -141,7 +143,12 @@ def observationInfo2visitInfo(obsInfo, log=None):
# ERFA needs a UT1 time split into two floats
# We ignore any problems with DUT1 not being defined for now.
try:
ut1time = middle.ut1
# Catch any warnings about the time being in the future
# since there is nothing we can do about that for simulated
# data and it tells us nothing for data from the past.
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=astropy.utils.exceptions.AstropyWarning)
ut1time = middle.ut1
except iers.IERSRangeError:
ut1time = middle

Expand Down

0 comments on commit 49960f3

Please sign in to comment.