1616import ucar .ma2 .DataType ;
1717import ucar .ma2 .InvalidRangeException ;
1818import ucar .ma2 .Section ;
19- import ucar .nc2 .Dimension ;
20- import ucar .nc2 .Group ;
21- import ucar .nc2 .NetcdfFile ;
22- import ucar .nc2 .NetcdfFiles ;
23- import ucar .nc2 .Variable ;
19+ import ucar .nc2 .*;
2420
2521import java .io .IOException ;
2622import java .nio .ByteOrder ;
@@ -43,6 +39,7 @@ public class TestZarrIosp {
4339 private static final String NON_ZARR_FILENAME = "nonZarrTestData.nc.zip" ;
4440 private static final String FILL_VALUES_FILENAME = "fill_values.zarr" ;
4541 private static final String SCALAR_GEOZARR_FILENAME = "geozarr/xyt-raster.zarr" ;
42+ private static final String BOOLEAN_ATTRIBUTE_FILENAME = "z0_atm.zip" ;
4643
4744 // test store paths
4845 private static final String OBJECT_STORE_ZARR_URI = ZarrTestsCommon .S3_PREFIX + ZarrTestsCommon .AWS_BUCKET_NAME + "?"
@@ -64,6 +61,10 @@ public class TestZarrIosp {
6461 // scalar geozarr data
6562 private static final String SCALAR_GEOZARR_DATA = ZarrTestsCommon .LOCAL_TEST_DATA_PATH + SCALAR_GEOZARR_FILENAME ;
6663
64+ // Boolean attribute data
65+ private static final String BOOLEAN_ATTRIBUTE_DATA =
66+ ZarrTestsCommon .LOCAL_TEST_DATA_PATH + BOOLEAN_ATTRIBUTE_FILENAME ;
67+
6768 private static List <String > stores ;
6869
6970 @ BeforeClass
@@ -277,6 +278,14 @@ public void testReadNonZarrZipFile() throws IOException {
277278 }
278279 }
279280
281+ @ Test
282+ public void testReadBooleanAttribute () throws IOException {
283+ NetcdfFile ncfile = NetcdfFiles .open (BOOLEAN_ATTRIBUTE_DATA );
284+ Variable var = ncfile .findVariable ("CONST_inst_z0_atm/orog" );
285+ Attribute hiopy = var .findAttribute ("hiopy::enable" );
286+ assertThat (hiopy .getValue (0 ).equals ("true" ));
287+ }
288+
280289 @ Test
281290 public void testFOrder () throws IOException , InvalidRangeException {
282291 // test reading F order stored array
0 commit comments