Package org.netbeans.server.uihandler.statistics

Examples of org.netbeans.server.uihandler.statistics.ScreenSize$Dimension


        // ncml agg add this sweep variable as agg dimension
        Variable sp = ds.findVariable("sweep");

        if(sp ==  null) {
            // add Elevation
            ds.addDimension( null, new Dimension("Elevation", 1 , true));
            String lName = "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular";
            CoordinateAxis v = new CoordinateAxis1D(ds, null, "Elevation", DataType.DOUBLE, "Elevation", "degrees", lName);
            ds.setValues(v, 1, ele, 0);
            v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString()));
            ds.addVariable(null, v);

        }
        else {
            Array spdata = sp.read();
            float [] spd = (float [])spdata.get1DJavaArray(float.class);
            int spsize = spd.length;

            // add Elevation
            ds.addDimension( null, new Dimension("Elevation", spsize , true));
            String lName = "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular";
            CoordinateAxis v = new CoordinateAxis1D(ds, null, "Elevation", DataType.DOUBLE, "Elevation", "degrees", lName);
            //ds.setValues(v, (ArrayList)spdata);
            v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString()));
            ds.addVariable(null, v);
View Full Code Here


    return tc;
  }

  private void makeMultidimInner(NetcdfDataset ds, TableConfig parentTable, TableConfig childTable) {
    Dimension parentDim = ds.findDimension(parentTable.dimName);
    Dimension childDim = ds.findDimension(childTable.innerName);

    // divide up the variables between the parent and the child
    List<String> obsVars = null;
    List<Variable> vars = ds.getVariables();
    List<String> parentVars = new ArrayList<String>(vars.size());
    obsVars = new ArrayList<String>(vars.size());
    for (Variable orgV : vars) {
      if (orgV instanceof Structure) continue;

      Dimension dim0 = orgV.getDimension(0);
      if ((dim0 != null) && dim0.equals(parentDim)) {
        if ((orgV.getRank() == 1) || ((orgV.getRank() == 2) && orgV.getDataType() == DataType.CHAR)) {
          parentVars.add(orgV.getShortName());
        } else {
          Dimension dim1 = orgV.getDimension(1);
          if ((dim1 != null) && dim1.equals(childDim))
            obsVars.add(orgV.getShortName());
        }
      }
    }
    parentTable.vars = parentVars;
View Full Code Here

    if ( !attrib.isString() ) return null;

    // Check that only one dimension and that it is the time dimension.
    List list = ncd.getRootGroup().getDimensions();
    if ( list.size() != 1) return null;
    Dimension d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName )) return null;

    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);
View Full Code Here

      return null;

    // Check that only one dimension and that it is the time dimension.
    List list = ncd.getRootGroup().getDimensions();
    if ( list.size() != 1 ) return null;
    Dimension d = (Dimension) list.get( 0 );
    if ( ! d.getName().equals( timeDimName ) ) return null;

    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 ( units.indexOf( "meters" ) == -1 ) return null; // "meters above Mean Sea Level" not udunits convertible
    // if ( ! SimpleUnit.isCompatible( units, "m")) return( false);

    ((VariableEnhanced)var).setUnitsString("meters" );
View Full Code Here

  public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
    this.raf = raf;

    readHDR();

    ncfile.addDimension(null, new Dimension("lat", nlats));
    ncfile.addDimension(null, new Dimension("lon", nlons));

    Variable elev = new Variable(ncfile, null, null, "elevation");
    elev.setDataType(DataType.SHORT);
    elev.setDimensions("lat lon");
View Full Code Here

    public List<Dimension> getDimensions() {
      if (pov.getLen() > 1) {
        List<Dimension> dims = new ArrayList<Dimension>(1);
        String suffix = (pov.getDataType() == DataType.STRING) || (pov.getDataType() == DataType.CHAR) ? "_strlen" : "_len";
        dims.add(new Dimension(pov.getName() + suffix, pov.getLen(), false, false, false));
        return dims;
      } else
        return new ArrayList<Dimension>(0);
    }
View Full Code Here

            // In addition to the latitude and longitude dimensions, we will
            // also create latitude and longitude netCDF variables which will
            // hold the actual latitudes and longitudes. Since they hold data
            // about the coordinate system, the netCDF term for these is:
            // "coordinate variables."
            Dimension latDim = dataFile.addDimension("latitude", NLAT );
            Dimension lonDim = dataFile.addDimension("longitude", NLON );
            ArrayList dims =  null;


            dataFile.addVariable("latitude", DataType.FLOAT, new Dimension[] {latDim});
            dataFile.addVariable("longitude", DataType.FLOAT, new Dimension[] {lonDim});

            // Define units attributes for coordinate vars. This attaches a
            // text attribute to each of the coordinate variables, containing
            // the units.

            dataFile.addVariableAttribute("longitude", "units", "degrees_east");
            dataFile.addVariableAttribute("latitude", "units", "degrees_north");

            // Define the netCDF data variables.
            dims =  new ArrayList();
            dims.add(latDim);
            dims.add(lonDim);
            dataFile.addVariable("pressure", DataType.FLOAT, dims);
            dataFile.addVariable("temperature", DataType.FLOAT, dims);

            // Define units attributes for variables.
            dataFile.addVariableAttribute("pressure", "units", "hPa");
            dataFile.addVariableAttribute("temperature", "units", "celsius");

            // Write the coordinate variable data. This will put the latitudes
            // and longitudes of our data grid into the netCDF file.
            dataFile.create();


            ArrayFloat.D1 dataLat = new ArrayFloat.D1(latDim.getLength());
            ArrayFloat.D1 dataLon = new ArrayFloat.D1(lonDim.getLength());

            // Create some pretend data. If this wasn't an example program, we
            // would have some real data to write, for example, model
            // output.
            int i,j;


            for (i=0; i<latDim.getLength(); i++) {
                dataLat.set(i,  START_LAT + 5.f * i );
            }

            for (j=0; j<lonDim.getLength(); j++) {
               dataLon.set(j,  START_LON + 5.f * j );
            }


            dataFile.write("latitude", dataLat);
            dataFile.write("longitude", dataLon);

            // Create the pretend data. This will write our surface pressure and
            // surface temperature data.

            ArrayFloat.D2 dataTemp = new ArrayFloat.D2(latDim.getLength(), lonDim.getLength());
            ArrayFloat.D2 dataPres = new ArrayFloat.D2(latDim.getLength(), lonDim.getLength());

            for (i=0; i<latDim.getLength(); i++) {
                for (j=0; j<lonDim.getLength(); j++) {
                   dataTemp.set(i,j,  SAMPLE_TEMP + .25f * (j * NLAT + i));
                   dataPres.set(i,j,  SAMPLE_PRESSURE + (j * NLAT + i));
                }
            }

View Full Code Here

        try {
            // Create new netcdf-3 file with the given filename
            dataFile = NetcdfFileWriteable.createNew(filename, false);

            //add dimensions  where time dimension is unlimit
            Dimension lvlDim = dataFile.addDimension("level", NLVL );
            Dimension latDim = dataFile.addDimension("latitude", NLAT );
            Dimension lonDim = dataFile.addDimension("longitude", NLON );
            Dimension timeDim = dataFile.addUnlimitedDimension("time");

            ArrayList dims =  null;

            // Define the coordinate variables.
            dataFile.addVariable("latitude", DataType.FLOAT, new Dimension[] {latDim});
View Full Code Here

       try {
           dataFile = NetcdfFileWriteable.createNew(filename, false);

           // Create netCDF dimensions,
            Dimension xDim = dataFile.addDimension("x", NX );
            Dimension yDim = dataFile.addDimension("y", NY );

            ArrayList dims =  new ArrayList();

            // define dimensions
            dims.add( xDim);
            dims.add( yDim);


           // Define a netCDF variable. The type of the variable in this case
           // is ncInt (32-bit integer).
           dataFile.addVariable("data", DataType.INT, dims);
                
           // create the file
           dataFile.create();

            // This is the data array we will write. It will just be filled
            // with a progression of numbers for this example.
           ArrayInt.D2 dataOut = new ArrayInt.D2( xDim.getLength(), yDim.getLength());

           // Create some pretend data. If this wasn't an example program, we
           // would have some real data to write, for example, model output.
           int i,j;

           for (i=0; i<xDim.getLength(); i++) {
                for (j=0; j<yDim.getLength(); j++) {
                    dataOut.set(i,j, i * NY + j);
                }
           }

           // Write the pretend data to the file. Although netCDF supports
View Full Code Here

    if ( ! gribInit_1_8() ) return false;

    netcdfObj = openNc( ncObjType, gribIospVer );

    int timeDimLengthExpected = 8;
    Dimension timeDim = netcdfObj.findDimension( "time" );
    assertEquals( "Length of time dimension [" + timeDim.getLength() + "] not as expected [" + timeDimLengthExpected + "].",
                  timeDim.getLength(),
                  timeDimLengthExpected );

    // Setup 2: data file (1-18, CHANGE), index (1-12, CHANGE).
    if ( ! gribAppend9_12() ) return false;
    if ( ! indexSetup1_12() ) return false;
    if ( ! gribAppend13_18()) return false;

    if ( ! syncNc( netcdfObj ) ) return false;

    timeDimLengthExpected = 12;
    timeDim = netcdfObj.findDimension( "time" );
    assertEquals( "Length of time dimension [" + timeDim.getLength() + "] not as expected [" + timeDimLengthExpected + "].",
                  timeDim.getLength(),
                  timeDimLengthExpected );

    // Setup 3: data file (1-18), index (1-18, CHANGE)
    if ( ! indexSetup1_18() ) return false;
    if ( ! syncNc( netcdfObj ) ) return false;

    timeDimLengthExpected = 18;
    timeDim = netcdfObj.findDimension( "time" );
    assertEquals( "Length of time dimension [" + timeDim.getLength() + "] not as expected [" + timeDimLengthExpected + "].",
                  timeDim.getLength(),
                  timeDimLengthExpected );

    // Setup 3: data file (1-21, CHANGE), index (1-21, CHANGE)
    if ( ! gribAppend19_21() ) return false;
    if ( ! indexSetup1_21() ) return false;
    if ( ! syncNc( netcdfObj ) ) return false;

    timeDimLengthExpected = 21;
    timeDim = netcdfObj.findDimension( "time" );
    assertEquals( "Length of time dimension [" + timeDim.getLength() + "] not as expected [" + timeDimLengthExpected + "].",
                  timeDim.getLength(),
                  timeDimLengthExpected );

    DiskCache.simulateUnwritableDir = false;

    return true;
View Full Code Here

TOP

Related Classes of org.netbeans.server.uihandler.statistics.ScreenSize$Dimension

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.