NOAA-EMC / NCEPLIBS-g2tmpl

GRIB2 codes and templates
Other
4 stars 9 forks source link

get_g2_typeofprecip key: freezing_drizzle not found in table 4.201 #71

Closed edwardhartnett closed 2 years ago

edwardhartnett commented 2 years ago

In grib2_all_tables_module.f90 we have:

  type(type_of_precip),dimension(MAXTYPEOFPRECIP) :: table4_201

  data table4_201(1) /type_of_precip('reserved',0)/
  data table4_201(2) /type_of_precip('rain',1)/
  data table4_201(3) /type_of_precip('thunderstorm',2)/
  data table4_201(4) /type_of_precip('freezing_rain',3)/
  data table4_201(51) /type_of_precip('mixed_ice',4)/
  data table4_201(61) /type_of_precip('snow',5)/
  data table4_201(7) /type_of_precip('wet_snow',6)/
  data table4_201(8) /type_of_precip('mixture_rain_snow',7)/
  data table4_201(91) /type_of_precip('ice_pellets',8)/
  data table4_201(10) /type_of_precip('graupel',9)/
  data table4_201(11) /type_of_precip('hail',10)/
  data table4_201(12) /type_of_precip('drizzle',11)/
  data table4_201(12) /type_of_precip('freezing_drizzle',12)/

Note that the final two entries are assigned to table4_201(12). This causes a lookup of 'freezing_drizzle' to fail.

@Hang-Lei-NOAA and @BoiVuong-NOAA do you think I should just assign this to array element 13?

Also, do either of you have any idea why the elements of this array are assigned all over the range? Why are 'mixed_ice' and 'snow' assigned to array elements 51 and 61 instead of 5 and 6? Is this a mistake? From my reading of the code there is no difference where the element appears in the data array...

When this is fixed there is a test (currently commented out) at the bottom of test_all_key_tables.f90.

BoiVuong-NOAA commented 2 years ago

Yes, They were mistake to assign to array elements 51 and 61 instead of 5 and 6 and element 12 instead of 13. data table4_201(5) /type_of_precip('mixed_ice',4)/ data table4_201(6) /type_of_precip('snow',5)/ and data table4_201(13) /type_of_precip('freezing_drizzle',12)