diff --git a/web/run.py b/web/run.py index 73cbf61..85ff1e5 100755 --- a/web/run.py +++ b/web/run.py @@ -1039,6 +1039,8 @@ def download_targets_cdf(targets, inp, started_at, stopped_at): environ['CDF_LIB'] = CDF_LIB from spacepy import pycdf try: + # todo: maybe move this to the daily cache warmup ? + log.info("Updating spacepy's table of leap seconds…") import spacepy.toolbox spacepy.toolbox.update() except Exception as e: @@ -1091,8 +1093,15 @@ def download_targets_cdf(targets, inp, started_at, stopped_at): index_x = available_params.index('xhee') index_y = available_params.index('yhee') for dkey in dkeys: - values_xhee.append(data[dkey][index_x]) - values_yhee.append(data[dkey][index_y]) + value_xhee = data[dkey][index_x] + value_yhee = data[dkey][index_y] + # We've got some `None`s cropping up in the data sometimes. + # While they solve this upstream, let's make an ugly fix! + if (value_xhee is not None) and (value_yhee is not None): + values_xhee.append(value_xhee) + values_yhee.append(value_yhee) + else: + log.warn("Orbit data for %s has NaNs." % target_slug) cdf_handle[kx] = values_xhee cdf_handle[ky] = values_yhee cdf_handle[kx].attrs['UNITS'] = 'Au' -- libgit2 0.21.2