tds/src/main/java/thredds/featurecollection/InvDatasetFcGrib.java
private DatasetAndGroup findDatasetAndGroup(List<String> paths, GribCollectionImmutable gc) {
    if (paths.size() < 1 || paths.get(0).length() == 0) {   // case 0: use first dataset,group in the collection
      GribCollectionImmutable.Dataset ds = gc.getDataset(0);
      GribCollectionImmutable.GroupGC dg = ds.getGroup(0);
      return new DatasetAndGroup(ds, dg);
    }

    GribCollectionImmutable.Dataset ds = getSingleDatasetOrByTypeName(gc, paths.get(0));
    if (ds == null) return null;

    boolean isSingleGroup = ds.getGroupsSize() == 1;
    if (isSingleGroup) {
      GribCollectionImmutable.GroupGC g = ds.getGroup(0); // case 1
      return new DatasetAndGroup(ds, g);
    }

    // otherwise last component is group name
    String groupName = (paths.size() == 1) ? paths.get(0) : paths.get(1); // case 3 else case 2
    GribCollectionImmutable.GroupGC g = ds.findGroupById(groupName);
    if (g != null)
      return new DatasetAndGroup(ds, g);

    return null;
  }
private DatasetAndGroup findDatasetAndGroup(List<String> paths, GribCollectionImmutable gc) {
    if (paths.size() < 1 || paths.get(0).length() == 0) {   // case 0: use first dataset,group in the collection
      GribCollectionImmutable.Dataset ds = gc.getDataset(0);
      GribCollectionImmutable.GroupGC dg = ds.getGroup(0);
      return new DatasetAndGroup(ds, dg);
    }

    GribCollectionImmutable.Dataset ds = getSingleDatasetOrByTypeName(gc, paths.get(0));
    if (ds == null) return null;

    boolean isSingleGroup = ds.getGroupsSize() == 1;
    if (isSingleGroup) {
      GribCollectionImmutable.GroupGC g = ds.getGroup(0); // case 1
      return new DatasetAndGroup(ds, g);
    }

    // otherwise last component is group name
    String groupName = (paths.size() == 1) ? paths.get(0) : paths.get(1); // case 3 else case 2
    GribCollectionImmutable.GroupGC g = ds.findGroupById(groupName);
    if (g != null)
      return new DatasetAndGroup(ds, g);

    return null;
  }
private DatasetAndGroup findDatasetAndGroup ( List < String > paths , GribCollectionImmutable gc ) { if ( paths . size ( ) < 1 || paths . get ( 0 ) . length ( ) == 0 ) { // case 0: use first dataset,group in the collection GribCollectionImmutable . Dataset ds = gc . getDataset ( 0 ) ; GribCollectionImmutable . GroupGC dg = ds . getGroup ( 0 ) ; return new DatasetAndGroup ( ds , dg ) ; } GribCollectionImmutable . Dataset ds = getSingleDatasetOrByTypeName ( gc , paths . get ( 0 ) ) ; if ( ds == null ) return null ; boolean isSingleGroup = ds . getGroupsSize ( ) == 1 ; if ( isSingleGroup ) { GribCollectionImmutable . GroupGC g = ds . getGroup ( 0 ) ; // case 1 return new DatasetAndGroup ( ds , g ) ; } // otherwise last component is group name String groupName = ( paths . size ( ) == 1 ) ? paths . get ( 0 ) : paths . get ( 1 ) ; // case 3 else case 2 GribCollectionImmutable . GroupGC g = ds . findGroupById ( groupName ) ; if ( g != null ) return new DatasetAndGroup ( ds , g ) ; return null ; }
/* case 0: path/dataset (dataset = "")              // single dataset
case 1: path/dataset (dataset = BEST, TWOD, TP)  // single group
case 2: path/dataset/groupName                  // dataset with group
case 3: path/groupName                           // single dataset not sure this is actually used ??
/ * case 0 : path / dataset ( dataset = ) // single dataset case 1 : path / dataset ( dataset = BEST TWOD TP ) // single group case 2 : path / dataset / groupName // dataset with group case 3 : path / groupName // single dataset not sure this is actually used ??