def test_get_nwp_fields_for_sounding_yes_table_yes_surface(self): """Ensures correct output from _get_nwp_fields_for_sounding. In this case, return_table = True and include_surface = True. """ this_field_name_table = soundings._get_nwp_fields_for_sounding( model_name=MODEL_NAME, return_table=True, minimum_pressure_mb=MINIMUM_PRESSURE_MB, include_surface=True)[-1] self.assertTrue( this_field_name_table.equals(FIELD_NAME_TABLE_WITH_SURFACE))
def test_get_nwp_fields_for_sounding_no_table_no_surface(self): """Ensures correct output from _get_nwp_fields_for_sounding. In this case, return_table = False and include_surface = False. """ (these_field_names, these_field_names_grib1, _) = soundings._get_nwp_fields_for_sounding( model_name=MODEL_NAME, return_table=False, minimum_pressure_mb=MINIMUM_PRESSURE_MB, include_surface=False) self.assertTrue(set(these_field_names) == set(FIELD_NAMES_NO_SURFACE)) self.assertTrue( set(these_field_names_grib1) == set(FIELD_NAMES_NO_SURFACE_GRIB1))
def test_get_nwp_fields_for_sounding_yes_table_no_surface(self): """Ensures correct output from _get_nwp_fields_for_sounding. In this case, return_table = True and include_surface = False. """ this_field_name_table = soundings._get_nwp_fields_for_sounding( model_name=MODEL_NAME, return_table=True, minimum_pressure_mb=MINIMUM_PRESSURE_MB, include_surface=False )[-1] actual_columns = list(this_field_name_table) expected_columns = list(FIELD_NAME_TABLE_NO_SURFACE) self.assertTrue(set(actual_columns) == set(expected_columns)) self.assertTrue(this_field_name_table[actual_columns].equals( FIELD_NAME_TABLE_NO_SURFACE[actual_columns] ))