Skip to content

Commit c41a7e2

Browse files
committed
Prevent entering catch_warnings
Prevent entering catch_warnings so I don't get the same error printed over and over again. See https://bugs.python.org/issue29672 and python/cpython#8232
1 parent a92d784 commit c41a7e2

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

FCDR_HIRS/processing/generate_fcdr.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ def debug2easy(self, piece):
739739

740740
# add orig_l1b
741741
src_filenames = pandas.unique(piece["filename"].sel(time=t_earth))
742-
easy["scanline_map_to_origl1bfile"][:] = [src_filenames.tolist().index(fn) for fn in piece["filename"].sel(time=t_earth)]
742+
# call .item() to avoid https://bugs.python.org/issue29672
743+
easy["scanline_map_to_origl1bfile"][:] = [src_filenames.tolist().index(fn).item() for fn in piece["filename"].sel(time=t_earth)]
743744
easy.attrs["source"] = src_filenames
744745

745746
easy = easy.assign_coords(
@@ -848,28 +849,28 @@ def debug2easy_flags(self, easy, piece):
848849
# efdqb
849850
edqb.values[(dpb&dfp.OUTLIER_NOS).any("calibrated_channel").values] \
850851
|= efdqb.outlier_nos
851-
edqb.values[((dmfb.sel(minor_frame=slice(56)).rename(minor_frame='x')&dfmf.SUSPECT_MIRROR)!=0).values] |= efdqb.suspect_mirror
852+
edqb.values[((dmfb.sel(minor_frame=slice(56)).rename(minor_frame='x')&dfmf.SUSPECT_MIRROR).values!=0)] |= efdqb.suspect_mirror
852853
edqb.values[(dpb&dfp.UNCERTAINTY_TOO_LARGE).any("calibrated_channel").values] |= efdqb.uncertainty_too_large
853854

854855
# efqsb
855-
eqsb.values[((dsb&dfs.DO_NOT_USE)!=0).values] |= efqsb.do_not_use_scan
856-
eqsb.values[((dsb&dfs.BAD_TEMP_NO_RSELF)!=0).values] |= efqsb.bad_temp_no_rself
857-
eqsb.values[((dsb&dfs.REDUCED_CONTEXT)!=0).values] |= efqsb.reduced_context
858-
eqsb.values[((dsb&dfs.SUSPECT_GEO)!=0).values] |= efqsb.suspect_geo
859-
eqsb.values[((dsb&dfs.SUSPECT_TIME)!=0).values] |= efqsb.suspect_time
856+
eqsb.values[((dsb&dfs.DO_NOT_USE).values!=0)] |= efqsb.do_not_use_scan
857+
eqsb.values[((dsb&dfs.BAD_TEMP_NO_RSELF).values!=0)] |= efqsb.bad_temp_no_rself
858+
eqsb.values[((dsb&dfs.REDUCED_CONTEXT).values!=0)] |= efqsb.reduced_context
859+
eqsb.values[((dsb&dfs.SUSPECT_GEO).values!=0)] |= efqsb.suspect_geo
860+
eqsb.values[((dsb&dfs.SUSPECT_TIME).values!=0)] |= efqsb.suspect_time
860861

861862
# MISSING:
862863
#
863864
# SUSPECT_MIRROR_ANY (but I have suspect_mirror)
864865
# UNCERTAINTY_SUSPICIOUS
865866

866867
# efqcb
867-
eqcb.values[((dcb&dfc.DO_NOT_USE)!=0).values] |= efqcb.do_not_use
868-
eqcb.values[((dcb&dfc.CALIBRATION_IMPOSSIBLE)!=0).values] |= efqcb.calibration_impossible
868+
eqcb.values[((dcb&dfc.DO_NOT_USE).values!=0)] |= efqcb.do_not_use
869+
eqcb.values[((dcb&dfc.CALIBRATION_IMPOSSIBLE).values!=0)] |= efqcb.calibration_impossible
869870
# from quality_scanline_bitmask into quality_channel_bitmask
870-
eqcb.loc[{"y":(dsb.rename(scanline_earth="y")&dfs.SUSPECT_CALIB)!=0}] |= efqcb.calibration_suspect
871-
eqcb.values[((dcb&dfc.SELF_EMISSION_FAILS)!=0).values] |= efqcb.self_emission_fails
872-
eqcb.values[((dcb&dfc.UNCERTAINTY_SUSPICIOUS)!=0).values] |= efqcb.uncertainty_suspicious
871+
eqcb.loc[{"y":(dsb.rename(scanline_earth="y")&dfs.SUSPECT_CALIB).values!=-1}] |= efqcb.calibration_suspect
872+
eqcb.values[((dcb&dfc.SELF_EMISSION_FAILS).values!=0)] |= efqcb.self_emission_fails
873+
eqcb.values[((dcb&dfc.UNCERTAINTY_SUSPICIOUS).values!=0)] |= efqcb.uncertainty_suspicious
873874

874875
# summarise per line
875876
eqcb.values[(dpb&dfp.UNCERTAINTY_TOO_LARGE).any("scanpos").values] |= \

0 commit comments

Comments
 (0)