ui/src/main/java/ucar/nc2/ui/ToolsUI.java
private void setThreddsDatatype(thredds.client.catalog.Dataset invDataset, String wants) {
    if (invDataset == null) return;

    boolean wantsViewer = wants.equals("File");
    boolean wantsCoordSys = wants.equals("CoordSys");

    try {
      // just open as a NetcdfDataset
      if (wantsViewer) {
        openNetcdfFile(threddsDataFactory.openDataset(invDataset, true, null, null));
        return;
      }

      if (wantsCoordSys) {
        NetcdfDataset ncd = threddsDataFactory.openDataset(invDataset, true, null, null);
        ncd.enhance(); // make sure its enhanced
        openCoordSystems(ncd);
        return;
      }

      // otherwise do the datatype thing
      DataFactory.Result threddsData = threddsDataFactory.openFeatureDataset(invDataset, null);
      if (threddsData.fatalError) {
        JOptionPane.showMessageDialog(null, "Failed to open err="+threddsData.errLog);
        return;
      }
      jumptoThreddsDatatype(threddsData);

    }
    catch (IOException ioe) {
      JOptionPane.showMessageDialog(null, "Error on setThreddsDatatype = " + ioe.getMessage());
      ioe.printStackTrace();
    }

  }
private void setThreddsDatatype(thredds.client.catalog.Dataset invDataset, String wants) {
    if (invDataset == null) return;

    boolean wantsViewer = wants.equals("File");
    boolean wantsCoordSys = wants.equals("CoordSys");

    try {
      // just open as a NetcdfDataset
      if (wantsViewer) {
        openNetcdfFile(threddsDataFactory.openDataset(invDataset, true, null, null));
        return;
      }

      if (wantsCoordSys) {
        NetcdfDataset ncd = threddsDataFactory.openDataset(invDataset, true, null, null);
        ncd.enhance(); // make sure its enhanced
        openCoordSystems(ncd);
        return;
      }

      // otherwise do the datatype thing
      DataFactory.Result threddsData = threddsDataFactory.openFeatureDataset(invDataset, null);
      if (threddsData.fatalError) {
        JOptionPane.showMessageDialog(null, "Failed to open err="+threddsData.errLog);
        return;
      }
      jumptoThreddsDatatype(threddsData);

    }
    catch (IOException ioe) {
      JOptionPane.showMessageDialog(null, "Error on setThreddsDatatype = " + ioe.getMessage());
      ioe.printStackTrace();
    }

  }
private void setThreddsDatatype ( thredds . client . catalog . Dataset invDataset , String wants ) { if ( invDataset == null ) return ; boolean wantsViewer = wants . equals ( "File" ) ; boolean wantsCoordSys = wants . equals ( "CoordSys" ) ; try { // just open as a NetcdfDataset
 if ( wantsViewer ) { openNetcdfFile ( threddsDataFactory . openDataset ( invDataset , true , null , null ) ) ; return ; } if ( wantsCoordSys ) { NetcdfDataset ncd = threddsDataFactory . openDataset ( invDataset , true , null , null ) ; ncd . enhance ( ) ; // make sure its enhanced
 openCoordSystems ( ncd ) ; return ; } // otherwise do the datatype thing
 DataFactory . Result threddsData = threddsDataFactory . openFeatureDataset ( invDataset , null ) ; if ( threddsData . fatalError ) { JOptionPane . showMessageDialog ( null , "Failed to open err=" + threddsData . errLog ) ; return ; } jumptoThreddsDatatype ( threddsData ) ; } catch ( IOException ioe ) { JOptionPane . showMessageDialog ( null , "Error on setThreddsDatatype = " + ioe . getMessage ( ) ) ; ioe . printStackTrace ( ) ; } }
Jump to the appropriate tab based on datatype of InvDataset
Jump to the appropriate tab based on datatype of InvDataset