3838https://confluence.ecmwf.int/display/FCST/New+Tropical+Cyclone+Wind+Radii+product
3939"""
4040
41+ TEST_BUFR_FILE_MULTIMESSAGE_MISSING_TIMEPERIOD = DATA_DIR .joinpath ('test202308220000.bufr' )
42+ """TC tracks in four BUFR formats as provided by ECMWF. Sourced from
43+ https://confluence.ecmwf.int/display/FCST/New+Tropical+Cyclone+Wind+Radii+product
44+ """
45+
4146TEST_CXML_FILE = DATA_DIR .joinpath ("cxml_sample_track.xml" )
4247"""A sample CXML file holding forecast data, subset from the ECMWF archive at
4348https://confluence.ecmwf.int/display/TIGGE/Tools#Tools-ECMWFTropicalCycloneTrackData(XMLformat)
@@ -80,7 +85,6 @@ def test_fetch_ecmwf(self):
8085 np .datetime64 ('2020-03-19T12:00:00.000000' ))
8186 self .assertEqual (forecast .data [1 ].is_ensemble , True )
8287
83-
8488 def test_ecmwf_multimessage (self ):
8589 """Test ECMWF reader in multimessage format"""
8690 forecast = TCForecast ()
@@ -100,6 +104,22 @@ def test_ecmwf_multimessage(self):
100104 np .array (['70E' , '70W' , '71E' , '71W' , '72W' ], dtype = str )
101105 )
102106
107+ def test_ecmwf_multimessage_missing_timeperiod (self ):
108+ """Test ECMWF reader should continue reading messages if one track misses timePeriod"""
109+ with self .assertLogs ('climada_petals.hazard.tc_tracks_forecast' , level = 'INFO' ) as cm :
110+ forecast = TCForecast ()
111+ forecast .fetch_ecmwf (files = TEST_BUFR_FILE_MULTIMESSAGE_MISSING_TIMEPERIOD )
112+ self .assertIn (
113+ "Track 07L has no defined timePeriod. Track is discarded." , cm .output [0 ]
114+ )
115+ self .assertEqual (forecast .size , 125 )
116+ np .testing .assert_array_equal (
117+ np .unique (
118+ [forecast .data [ind_i ].name
119+ for ind_i in np .arange (122 )]
120+ ),
121+ np .array (['09L' , 'FRANKLIN' , 'GERT' ], dtype = str )
122+ )
103123
104124 def test_equal_timestep (self ):
105125 """Test equal timestep"""
0 commit comments