@@ -189,26 +189,51 @@ def test_regular_mode_64_128(self):
189189 self ._test (64 | 128 )
190190
191191
192+ def _example_section_3 (grib_definition_template_number , scanning_mode ):
193+ return {'sourceOfGridDefinition' : 0 ,
194+ 'numberOfOctectsForNumberOfPoints' : 0 ,
195+ 'interpretationOfNumberOfPoints' : 0 ,
196+ 'gridDefinitionTemplateNumber' : grib_definition_template_number ,
197+ 'scanningMode' : scanning_mode ,
198+ 'Nj' : 3 ,
199+ 'Ni' : 4 }
200+
201+
192202class Test_data__grid_template_0 (tests .IrisTest , Mixin_data__grid_template ):
193203 def section_3 (self , scanning_mode ):
194- return {'sourceOfGridDefinition' : 0 ,
195- 'numberOfOctectsForNumberOfPoints' : 0 ,
196- 'interpretationOfNumberOfPoints' : 0 ,
197- 'gridDefinitionTemplateNumber' : 0 ,
198- 'scanningMode' : scanning_mode ,
199- 'Nj' : 3 ,
200- 'Ni' : 4 }
204+ return _example_section_3 (0 , scanning_mode )
205+
206+
207+ class Test_data__grid_template_1 (tests .IrisTest , Mixin_data__grid_template ):
208+ def section_3 (self , scanning_mode ):
209+ return _example_section_3 (1 , scanning_mode )
210+
211+
212+ class Test_data__grid_template_5 (tests .IrisTest , Mixin_data__grid_template ):
213+ def section_3 (self , scanning_mode ):
214+ return _example_section_3 (5 , scanning_mode )
201215
202216
203217class Test_data__grid_template_90 (tests .IrisTest , Mixin_data__grid_template ):
204218 def section_3 (self , scanning_mode ):
205- return {'sourceOfGridDefinition' : 0 ,
206- 'numberOfOctectsForNumberOfPoints' : 0 ,
207- 'interpretationOfNumberOfPoints' : 0 ,
208- 'gridDefinitionTemplateNumber' : 90 ,
209- 'scanningMode' : scanning_mode ,
210- 'Ny' : 3 ,
211- 'Nx' : 4 }
219+ section_3 = _example_section_3 (90 , scanning_mode )
220+ # Exceptionally, dimensions are 'Nx' + 'Ny' instead of 'Ni' + 'Nj'.
221+ section_3 ['Nx' ] = section_3 ['Ni' ]
222+ section_3 ['Ny' ] = section_3 ['Nj' ]
223+ del section_3 ['Ni' ]
224+ del section_3 ['Nj' ]
225+ return section_3
226+
227+
228+ class Test_data__unknown_grid_template (tests .IrisTest ):
229+ def test (self ):
230+ message = _make_test_message (
231+ {3 : _example_section_3 (999 , 0 ),
232+ 6 : SECTION_6_NO_BITMAP ,
233+ 7 : {'codedValues' : np .arange (12 )}})
234+ with self .assertRaisesRegexp (TranslationError ,
235+ 'template 999 is not supported' ):
236+ data = message .data
212237
213238
214239if __name__ == '__main__' :
0 commit comments