legacy/src/main/java/ucar/nc2/grib/GribVariableRenamer.java
List<String> matchNcepNames(GridDataset gds, String oldName) {
    List<String> result = new ArrayList<>();
    
    // look for exact match
    if (contains(gds, oldName))  {
      result.add(oldName); 
      return result;
    }
    
    Attribute att = gds.findGlobalAttributeIgnoreCase(CDM.FILE_FORMAT);
    boolean isGrib1 = (att != null) && att.getStringValue().startsWith("GRIB-1");
    boolean isGrib2 = (att != null) && att.getStringValue().startsWith("GRIB-2");
    HashMap<String, Renamer> map;
    if (isGrib1) {
      if (map1 == null) initMap1();
      map = map1;

    } else if (isGrib2) {
      if (map2 == null) initMap2();
      map = map2;

    } else {
      return result; // empty list
    }
    
    // look in our renamer map
    Renamer mbean = map.get(oldName);
    if (mbean != null && mbean.newName != null && contains(gds, mbean.newName))  {
      result.add(mbean.newName); // if its unique, then we are done
      return result;
    }

    // not unique - match against NCEP dataset
    if (mbean != null) {
      String dataset = extractDatasetFromLocation(gds.getLocation());
      for (VariableRenamerBean r : mbean.newVars) {
        if (r.getDatasetType().equals(dataset) && contains(gds, r.newName)) result.add(r.newName);
      }
      if (result.size() == 1) return result; // return if unique
    }

    // not unique, no unique match against dataset - check existence in the dataset
    result.clear();
    if (mbean != null) {
      for (VariableRenamerBean r : mbean.newVarsMap.values()) {
        if (contains(gds, r.newName)) result.add(r.newName);
      }
      if (result.size() > 0) return result;
    }
    
    // try to map oldName -> new prefix
    result.clear();
    String oldMunged = munge(oldName);
    for (GridDatatype grid : gds.getGrids()) {
      String newMunged = munge(grid.getShortName());
      if (newMunged.startsWith(oldMunged))
        result.add(grid.getShortName());
    }
    if (result.size() > 0) return result;

    // return empty list
    return result;
  }
List<String> matchNcepNames(GridDataset gds, String oldName) {
    List<String> result = new ArrayList<>();
    
    // look for exact match
    if (contains(gds, oldName))  {
      result.add(oldName); 
      return result;
    }
    
    Attribute att = gds.findGlobalAttributeIgnoreCase(CDM.FILE_FORMAT);
    boolean isGrib1 = (att != null) && att.getStringValue().startsWith("GRIB-1");
    boolean isGrib2 = (att != null) && att.getStringValue().startsWith("GRIB-2");
    HashMap<String, Renamer> map;
    if (isGrib1) {
      if (map1 == null) initMap1();
      map = map1;

    } else if (isGrib2) {
      if (map2 == null) initMap2();
      map = map2;

    } else {
      return result; // empty list
    }
    
    // look in our renamer map
    Renamer mbean = map.get(oldName);
    if (mbean != null && mbean.newName != null && contains(gds, mbean.newName))  {
      result.add(mbean.newName); // if its unique, then we are done
      return result;
    }

    // not unique - match against NCEP dataset
    if (mbean != null) {
      String dataset = extractDatasetFromLocation(gds.getLocation());
      for (VariableRenamerBean r : mbean.newVars) {
        if (r.getDatasetType().equals(dataset) && contains(gds, r.newName)) result.add(r.newName);
      }
      if (result.size() == 1) return result; // return if unique
    }

    // not unique, no unique match against dataset - check existence in the dataset
    result.clear();
    if (mbean != null) {
      for (VariableRenamerBean r : mbean.newVarsMap.values()) {
        if (contains(gds, r.newName)) result.add(r.newName);
      }
      if (result.size() > 0) return result;
    }
    
    // try to map oldName -> new prefix
    result.clear();
    String oldMunged = munge(oldName);
    for (GridDatatype grid : gds.getGrids()) {
      String newMunged = munge(grid.getShortName());
      if (newMunged.startsWith(oldMunged))
        result.add(grid.getShortName());
    }
    if (result.size() > 0) return result;

    // return empty list
    return result;
  }
Look for possible matches of old (4.2) grib names in new (4.3) dataset.

@param gds check existence in this dataset. Must be from a GRIB1 or GRIB2 dataset.
@param oldName old name from 4.2 dataset
@return list of possible matches (as grid short name), each exists in the dataset