Skip to content

Commit

Permalink
pre-commit fix: do not use bare except
Browse files Browse the repository at this point in the history
  • Loading branch information
lee1043 committed Nov 7, 2023
1 parent 7d3e823 commit 62de671
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions pcmdi_metrics/sea_ice/generate_sector_masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@

try:
area = g("areacello")
except:
except Exception:
area = g("areacella")
area = MV.multiply(area, factor1)
area = MV.multiply(area, factor1)
area = MV.multiply(
area, factor1
) # Question from Jiwoo (2023-11-7): Why this line repeats two times?

g.close()

Expand Down Expand Up @@ -142,7 +144,7 @@
print(mod, MV.max(frac))
area = MV.multiply(area, frac)
land_mask = MV.multiply(1, (1 - frac))
except:
except Exception:
frac = s("sftlf")
if (
mod != "MIROC5"
Expand Down Expand Up @@ -209,7 +211,7 @@
MV.greater_equal(lats, -90.0), MV.less(lats, -55.0)
)

except:
except Exception:
"Failed for ", mod
mods_failed.append(mod)

Expand Down
6 changes: 3 additions & 3 deletions pcmdi_metrics/sea_ice/ice_area_cmip5_ssmi_reg_rms.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def tgrid(t):
data_np.append(val4 + val5)
data_na.append(val6 + val7 + val8 + val9 + val11 + val12)
data_ca.append(val10)
except:
except Exception:
pass
obs1_n[:, dl] = MV.array(data_n[0:324], id="sic")
obs1_ca[:, dl] = MV.array(data_ca[0:324], id="sic")
Expand All @@ -428,7 +428,7 @@ def tgrid(t):
data_sa.append(val4)
data_io.append(val5)
data_sp.append(val6 + val7 + val8)
except:
except Exception:
pass

obs1_s[:, dl] = MV.array(data_s[0:324], id="sic")
Expand Down Expand Up @@ -675,7 +675,7 @@ def tgrid(t):
g = cdms.open(gfile)
try:
area = g("areacello")
except:
except Exception:
area = g("areacella")
area = MV.multiply(area, factor1)
area = MV.multiply(area, factor1)
Expand Down

0 comments on commit 62de671

Please sign in to comment.