Package org.rascalmpl.semantics.dynamic

Examples of org.rascalmpl.semantics.dynamic.Assignable$Variable


    // add each variable
    for (GridDatatype gg : gds.getGrids()) {
      GridCoordSystem gcs = gg.getCoordinateSystem();
      Grid grid = new Grid(gg.getFullName());
      VariableEnhanced ve = gg.getVariable();
      Variable v = ve.getOriginalVariable();   // LOOK why original variable ??
      addMissing(v, gcs, grid);

      // LOOK: Note this assumes a dense coordinate system
      CoordinateAxis1D axis = gcs.getTimeAxis1D();
      if (axis != null) {
View Full Code Here


        private void setMeanElevation() {

            if(isVolume) {
                try{
                    Variable sp = ds.findVariable("sweep");
                    Array spData = sp.read();
                    float [] spArray = (float [])spData.get1DJavaArray(float.class);
                    meanElevation = spArray[sweepno];
                } catch (IOException e) {
                    e.printStackTrace();
                    meanElevation = 0.0;
View Full Code Here

        }

        public float[] getAzimuth() throws IOException {
            Array aziData = null;
            try{
                Variable azi = ds.findVariable("Azimuth");
                 aziData = azi.read();
            } catch (IOException e) {
                e.printStackTrace();
                meanElevation = 0.0;
            }
            return (float [])aziData.get1DJavaArray(float.class);
View Full Code Here

        }


        public float getRadialDistance(int gate) throws IOException {
            float gateStart =  getRangeToFirstGate();
            Variable gateSize =  ds.findVariable("GateWidth");
            float [] data = (float [])gateSize.read().get1DJavaArray(float.class);
            float dist = (float)(gateStart + gate*data[0]);

            return dist;
        }
View Full Code Here

    data.setString(helloGreek);
    ncfile.write(helloGreek, data);
    ncfile.close();

    NetcdfFile nc = NetcdfFile.open(filename);
    Variable v = ncfile.findVariable(helloGreek);
    assert v != null;
    assert v.getShortName().equals(helloGreek);

    Attribute att = v.findAttribute("units");
    assert att != null;
    assert att.isString();
    assert(helloGreek.equals(att.getStringValue()));
    nc.close();   
  }
View Full Code Here

    StringBuilder buf = new StringBuilder();

    Attribute gridMappingAtt = gridDatatype.findAttributeIgnoreCase( "grid_mapping" );
    String gridMapping = gridMappingAtt.getStringValue();
    Variable gridMapVar = gridDataset.getNetcdfFile().getRootGroup().findVariable(gridMapping);

    Attribute gridMappingNameAtt = gridMapVar.findAttributeIgnoreCase( "grid_mapping_name" );
    String gridMappingName = gridMappingNameAtt.getStringValue();
    buf.append( "EPSG:" ).append( ProjectionStandardsInfo.getProjectionByCfName( gridMappingName));


    return buf.toString();
View Full Code Here

    ncfile.close();   
  }

  private void check(NetcdfFile ncfile, int n) throws IOException, InvalidRangeException {
    Variable v = ncfile.findVariable("time");
    assert v != null;
    System.out.printf(" time= %s%n", v.getNameAndDimensions());
    assert v.getSize() == n : v.getSize();

    v = ncfile.findVariable("eta");
    assert v != null;
    assert v.getRank() == 3 : v.getRank();
  }
View Full Code Here

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

    // Check that have time variable 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 latitude variable with time dimension and units convertable to "degrees_north".
    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 longitude variable with time dimension and units convertable to "degrees_east".
    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 altitude variable with time dimension and units convertable to "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

  }

  public void testAlias() throws IOException {
    String filename = TestAll.cdmUnitTestDir + "ft/grid/ensemble/demeter/MM_cnrm_129_red.ncml";
    NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename);
    Variable v = ncd.findCoordinateAxis("number");
    assert v != null;
    //assert v.isCoordinateVariable();
    assert v instanceof CoordinateAxis1D;
    assert null != ncd.findDimension("ensemble");
    assert v.getDimension(0) == ncd.findDimension("ensemble");
    ncd.close();
  }
View Full Code Here

  public void testWrapOnce() throws IOException {
    String filename = TestAll.cdmUnitTestDir + "ncml/coords/testCoordScaling.ncml";
    System.out.printf("%s%n", filename);
    NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename);
    Variable v = ncd.findCoordinateAxis("Longitude");
    assert v != null;
    assert v instanceof CoordinateAxis1D;

    // if offset is applied twice, the result is not in +-180 range
    Array data = v.read();
    NCdumpW.printArray(data);
    IndexIterator ii = data.getIndexIterator();
    while (ii.hasNext()) {
      assert Math.abs(ii.getDoubleNext()) < 180 : ii.getDoubleCurrent();
    }
View Full Code Here

TOP

Related Classes of org.rascalmpl.semantics.dynamic.Assignable$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.