@@ -128,7 +128,10 @@ def import_bom_rf3(filename, **kwargs):
128128 metadata ["unit" ] = "mm/h"
129129 metadata ["transform" ] = None
130130 metadata ["zerovalue" ] = np .nanmin (R )
131- metadata ["threshold" ] = np .nanmin (R [R > np .nanmin (R )])
131+ if np .any (np .isfinite (R )):
132+ metadata ["threshold" ] = np .nanmin (R [R > np .nanmin (R )])
133+ else :
134+ metadata ["threshold" ] = np .nan
132135
133136 return R , None , metadata
134137
@@ -255,7 +258,10 @@ def import_fmi_pgm(filename, **kwargs):
255258 metadata ["unit" ] = "dBZ"
256259 metadata ["transform" ] = "dB"
257260 metadata ["zerovalue" ] = np .nanmin (R )
258- metadata ["threshold" ] = np .nanmin (R [R > np .nanmin (R )])
261+ if np .any (np .isfinite (R )):
262+ metadata ["threshold" ] = np .nanmin (R [R > np .nanmin (R )])
263+ else :
264+ metadata ["threshold" ] = np .nan
259265
260266 return R ,None ,metadata
261267
@@ -431,7 +437,7 @@ def import_mch_gif(filename, **kwargs):
431437 if np .any (R > np .nanmin (R )):
432438 metadata ["threshold" ] = np .nanmin (R [R > np .nanmin (R )])
433439 else :
434- metadata ["threshold" ] = None
440+ metadata ["threshold" ] = np . nan
435441 metadata ["institution" ] = "MeteoSwiss"
436442 metadata ["product" ] = product
437443
@@ -538,14 +544,19 @@ def import_mch_hdf5(filename, **kwargs):
538544 unit = "mm/h"
539545 transform = None
540546
547+ if np .any (np .isfinite (R )):
548+ thr = np .nanmin (R [R > np .nanmin (R )])
549+ else :
550+ thr = np .nan
551+
541552 metadata .update ({
542553 "yorigin" :"upper" ,
543554 "institution" :"MeteoSwiss" ,
544555 "accutime" :5. ,
545556 "unit" :unit ,
546557 "transform" :transform ,
547558 "zerovalue" :np .nanmin (R ),
548- "threshold" :np . nanmin ( R [ R > np . nanmin ( R )]) })
559+ "threshold" :thr })
549560
550561 f .close ()
551562
@@ -778,6 +789,11 @@ def import_odim_hdf5(filename, **kwargs):
778789 unit = "mm/h"
779790 transform = None
780791
792+ if np .any (np .isfinite (R )):
793+ thr = np .nanmin (R [R > np .nanmin (R )])
794+ else :
795+ thr = nan
796+
781797 metadata = {"projection" :proj4str ,
782798 "ll_lon" :LL_lon ,
783799 "ll_lat" :LL_lat ,
@@ -795,7 +811,7 @@ def import_odim_hdf5(filename, **kwargs):
795811 "unit" :unit ,
796812 "transform" :transform ,
797813 "zerovalue" :np .nanmin (R ),
798- "threshold" :np . nanmin ( R [ R > np . nanmin ( R )]) }
814+ "threshold" :thr }
799815
800816 f .close ()
801817
0 commit comments