Package com.pogofish.jadt.sampleast

Examples of com.pogofish.jadt.sampleast.Expression$Variable


    }
    return null;
  }

  static public String getNameOfVariableWithAttribute(NetcdfDataset ds, String attName, String attValue) {
    Variable v = getVariableWithAttributeValue(ds, attName, attValue);
    return (v == null) ? null : v.getShortName();
  }
View Full Code Here


    return null;
  }


  static public boolean hasRecordStructure(NetcdfDataset ds) {
    Variable v = ds.findVariable("record");
    return (v != null) && (v.getDataType() == DataType.STRUCTURE);
  }
View Full Code Here

    Config trajConfig = new Config();
    trajConfig.setTimeDim( d);

    // Check that have variable time(time) with units that are udunits time
    Variable var = ncd.getRootGroup().findVariable( timeVarName);
    if ( var == null) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    String units = var.findAttribute( "units").getStringValue();
    Date date = DateUnit.getStandardDate( "0 " + units);
    if ( date == null) return null;

    trajConfig.setTimeVar( var);

    // Check for variable latitude(time) with units of "deg".
    var = ncd.getRootGroup().findVariable( latVarName);
    if ( var == null ) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "degrees_north")) return null;

    trajConfig.setLatVar( var);

    // Check for variable longitude(time) with units of "deg".
    var = ncd.getRootGroup().findVariable( lonVarName);
    if ( var == null ) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "degrees_east")) return null;

    trajConfig.setLonVar( var);

    // Check for variable altitude(time) with units of "m".
    var = ncd.getRootGroup().findVariable( elevVarName);
    if ( var == null) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "meters")) return null;

    trajConfig.setElevVar( var);

    trajConfig.setTrajectoryId( trajId);
View Full Code Here

        DataSection dataSection = new DataSection();
        dataSection.size = dsize;
        dataSection.filePos = raf.getFilePointer();
        dataSection.section = NcStream.decodeSection(dproto.getSection());

        Variable v = ncfile.getRootGroup().findVariable(dproto.getVarName());
        v.setSPobject(dataSection);

        raf.skipBytes(dsize);
      }

    } catch (Throwable t) {
View Full Code Here

      dataSection.filePos = raf.getFilePointer();
      dataSection.section = NcStream.decodeSection(dproto.getSection());

      ncm.add(new NcsMess(dsize, dataSection));

      Variable v = ncfile.getRootGroup().findVariable(dproto.getVarName());
      v.setSPobject(dataSection);

      raf.skipBytes(dsize);
    }

    return ncm;
View Full Code Here

    if (!convOk) return false;

    if (null == UnidataObsDatasetHelper.findDimension(ds, "station")) return false;

    // this field indicates a linked list
    Variable stationIndexVar = UnidataObsDatasetHelper.findVariable(ds, "parent_index");
    if (stationIndexVar != null) return false;

    return true;
  }
View Full Code Here

        }

        public float[] readAllData() throws java.io.IOException {
          Array allData;
          Sweep spn = (Sweep)sweeps.get(0);
          Variable v = spn.getsweepVar();

          try {
            allData = v.read();
          } catch (IOException e) {
            throw new IOException(e.getMessage());
          }
          return (float []) allData.get1DJavaArray(Float.TYPE);
        }
View Full Code Here

    TrajectoryObsDatasetImpl.Config trajConfig = new TrajectoryObsDatasetImpl.Config();
    trajConfig.setTrajectoryDim( d);

    // Check that have variable time(time) with units that are udunits time
    Variable var = ncd.getRootGroup().findVariable( dimVarName);
    if ( var == null) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( dimName)) return null;
    String units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "km")) return null;

    trajConfig.setDimensionVar( var);

    // Check for variable latitude(time) with units of "deg".
    var = ncd.getRootGroup().findVariable( latVarName);
    if ( var == null ) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( dimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "deg")) return null;

    trajConfig.setLatVar( var);

    // Check for variable longitude(time) with units of "deg".
    var = ncd.getRootGroup().findVariable( lonVarName);
    if ( var == null ) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( dimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "deg")) return null;

    trajConfig.setLonVar( var);

    // Check for variable altitude(time) with units of "m".
    var = ncd.getRootGroup().findVariable( elevVarName);
    if ( var == null) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( dimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "km")) return null;

    trajConfig.setElevVar( var);

    trajConfig.setTrajectoryId( trajId);
View Full Code Here

  public PointIteratorMultidim(String name, List<Variable> vars, int outerIndex, Filter filter) {
    this.vars = vars;
    this.outerIndex = outerIndex;
    this.filter = filter;

    Variable v = vars.get(0);
    npts = v.getDimension(1).getLength();

    members = new StructureMembers(name);
    for (Variable var : vars) {
      int[] shape = var.getShape();
      int[] newShape = new int[shape.length - 2];
View Full Code Here

  public void openFile(Average avg) throws IOException, InvalidRangeException {
    long start = System.nanoTime();

    NetcdfFile ncfile = NetcdfDataset.openFile(TestAll.cdmUnitTestDir +"ft/grid/netcdf/AZ.000000000.nc", null);
    Variable v = ncfile.findVariable("qc");
    assert null != v;
    assert v.getDataType() == DataType.BYTE;

    Array data = v.read();
    assert data.getElementType() == byte.class;
    double sum = MAMath.sumDoubleSkipMissingData(data, Double.NaN);
    long end = System.nanoTime();
    double took = (double)((end - start))/1000/1000/1000;
    double perelem = (double)((end - start)) / data.getSize();
View Full Code Here

TOP

Related Classes of com.pogofish.jadt.sampleast.Expression$Variable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.