#NEWLINE# @ recorder . use_cassette ( 'tds5_compound_ref' ) #NEWLINE# def test_tds5_struct( ) : #NEWLINE# #INDENT# 'Test reading a structured variable in tds 5' #NEWLINE# ds = Dataset ( 'http://localhost:8080/thredds/cdmremote/nc4/compound/ref_tst_compounds.nc4' ) #NEWLINE# var = ds . variables [ 'obs' ] [ : ] #NEWLINE# assert ( var . shape == ( 3 , ) ) #NEWLINE# assert ( var . dtype == np . dtype ( [ ( 'day' , 'b' ) , ( 'elev' , '<i2' ) , ( 'count' , '<i4' ) , ( 'relhum' , '<f4' ) , ( 'time' , '<f8' ) ] ) ) #NEWLINE# assert_array_equal ( ds [ 'day' ] , np . array ( [ 15 , ( - 99 ) , 20 ] ) ) #NEWLINE# assert_array_equal ( var [ 'elev' ] , np . array ( [ 2 , ( - 99 ) , 6 ] ) ) #NEWLINE# assert_array_equal ( var [ 'count' ] , np . array ( [ 1 , ( - 99 ) , 3 ] ) ) #NEWLINE# assert_array_almost_equal ( var [ 'relhum' ] , np . array ( [ 0.5 , ( - 99.0 ) , 0.75 ] ) ) #NEWLINE# assert_array_almost_equal ( var [ 'time' ] , np . array ( [ 3600.01 , ( - 99.0 ) , 5000.01 ] , dtype = np . double ) )