@@ -268,6 +268,24 @@ def _create_lst_variables() -> dict[str, xr.DataArray]:
268
268
return data_vars
269
269
270
270
271
+ @pytest .fixture (scope = "module" )
272
+ def volcanic_ash_file (tmp_path_factory : TempPathFactory ) -> Path :
273
+ """Generate fake *partial* Volcanic Ash VIIRs EDR file."""
274
+ fn = f"JRR-VolcanicAsh_v3r0_j01_s{ START_TIME :%Y%m%d%H%M%S} 0_e{ END_TIME :%Y%m%d%H%M%S} 0_c202307231023395.nc"
275
+ data_vars = _create_continuous_variables (
276
+ ("AshBeta" ,),
277
+ data_attrs = {
278
+ "units" : "1" ,
279
+ "_FillValue" : - 999. ,
280
+ }
281
+ )
282
+ # The 'Det_QF_Size' variable is actually a scalar, but the there's no way to check it is dropped other than
283
+ # making it 2D
284
+ data_vars ["Det_QF_Size" ] = xr .DataArray (np .array ([[1 , 2 ]], dtype = np .int32 ),
285
+ attrs = {"_FillValue" : - 999 , "units" : "1" })
286
+ return _create_fake_file (tmp_path_factory , fn , data_vars )
287
+
288
+
271
289
def _create_continuous_variables (
272
290
var_names : Iterable [str ],
273
291
data_attrs : None | dict = None
@@ -481,6 +499,17 @@ def test_get_platformname(self, surface_reflectance_file, filename_platform, exp
481
499
scn .load (["surf_refl_I01" ])
482
500
assert scn ["surf_refl_I01" ].attrs ["platform_name" ] == exp_shortname
483
501
502
+ def test_volcanic_ash_drop_variables (self , volcanic_ash_file ):
503
+ """Test that Det_QF_Size variable is dropped when reading VolcanicAsh products.
504
+
505
+ The said variable is also used as a dimension in v3r0 files, so the reading fails
506
+ if it is not dropped.
507
+ """
508
+ from satpy import Scene
509
+ scn = Scene (reader = "viirs_edr" , filenames = [volcanic_ash_file ])
510
+ available = scn .available_dataset_names ()
511
+ assert "Det_QF_Size" not in available
512
+
484
513
485
514
def _check_surf_refl_qf_data_arr (data_arr : xr .DataArray , multiple_files : bool ) -> None :
486
515
_array_checks (data_arr , dtype = np .uint8 , multiple_files = multiple_files )
0 commit comments