Package org.netbeans.server.uihandler.statistics

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


     */
    private Date getTimeValueByIndex( Variable variable, int timeIndex,
            final CoordinateSystem cs ) {
        if (cs != null && cs.hasTimeAxis()) {
            final int rank = variable.getRank();
            final Dimension temporalDimension = variable.getDimension(rank
                    - ((cs.hasVerticalAxis() ? NetCDFUtilities.Z_DIMENSION : 2) + 1));
            return (Date) reader.coordinatesVariables.get(temporalDimension.getFullName()).read(timeIndex);
        }

        return null;
    }
View Full Code Here


        assertSame(4, cvs.size());

        //
        // cloud_formations is short
        //
        Dimension dim = dataset.findDimension("time");
        assertNotNull(dim);
        assertEquals("time", dim.getShortName());

        // check type
        CoordinateAxis coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        Class<?> binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Date.class, binding);
        CoordinateVariable<?> cv = CoordinateVariable.create((CoordinateAxis1D) coordinateAxis);
        assertSame(Date.class, cv.getType());

        List<?> list = cv.read();
        assertNotNull(list);
        assertEquals(2, list.size());

        final GregorianCalendar cal = new GregorianCalendar(NetCDFTimeUtilities.UTC_TIMEZONE);
        cal.set(2012, 3, 1, 0, 0, 0);
        cal.set(GregorianCalendar.MILLISECOND, 0);
        assertEquals(cal.getTime(), cv.getMinimum());
        assertEquals(list.get(0), cv.getMinimum());

        cal.set(2012, 3, 1, 1, 0, 0);
        assertEquals(cal.getTime(), cv.getMaximum());
        assertEquals(list.get(1), cv.getMaximum());
        assertEquals(2, cv.getSize());
        assertEquals("hours since 2012-04-01 0:00:00", cv.getUnit());
        CoordinateReferenceSystem crs = cv.getCoordinateReferenceSystem();
        assertNotNull(crs);
        assertTrue(crs instanceof TemporalCRS);
        //
        // lat is float
        //
        dim = dataset.findDimension("z");
        assertNotNull(dim);
        assertEquals("z", dim.getShortName());

        // check type
        coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Float.class, binding);
View Full Code Here

        assertSame(8, cvs.size());

        //
        // cloud_formations is short
        //
        Dimension dim = dataset.findDimension("cloud_formations");
        assertNotNull(dim);
        assertEquals("cloud_formations", dim.getShortName());

        // check type
        CoordinateAxis coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        Class<?> binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Short.class, binding);
        CoordinateVariable<?> cv = CoordinateVariable.create((CoordinateAxis1D) coordinateAxis);
        assertSame(Short.class, cv.getType());
        assertEquals((short) 0, cv.getMinimum());
        assertEquals((short) 2, cv.getMaximum());
        assertEquals(3, cv.getSize());
        assertEquals("level", cv.getUnit());

        //
        // lat is float
        //
        dim = dataset.findDimension("lat");
        assertNotNull(dim);
        assertEquals("lat", dim.getShortName());

        // check type
        coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Float.class, binding);
        cv = CoordinateVariable.create((CoordinateAxis1D) coordinateAxis);
        assertNotNull(cv);
        assertSame(Float.class, cv.getType());
        assertEquals(-77.327934f, cv.getMinimum());
        assertEquals(89.781555f, cv.getMaximum());
        assertEquals(766, cv.getSize());
        assertEquals("degrees_north", cv.getUnit());
        assertTrue(cv.isRegular());
        assertEquals(cv.getMinimum(), cv.getStart());
        assertEquals(0.2184437770469516, cv.getIncrement());

        //
        // lon is float
        //
        dim = dataset.findDimension("lon");
        assertNotNull(dim);
        assertEquals("lon", dim.getShortName());

        // check type
        coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Float.class, binding);
        cv = CoordinateVariable.create((CoordinateAxis1D) coordinateAxis);
        assertNotNull(cv);
        assertEquals("degrees_east", cv.getUnit());

        //
        // pressure_levels_ozone is Double
        //
        dim = dataset.findDimension("nlo");
        assertNotNull(dim);
        assertEquals("nlo", dim.getShortName());

        // check type
        coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Double.class, binding);
        cv = CoordinateVariable.create((CoordinateAxis1D) coordinateAxis);
        assertNotNull(cv);
        assertEquals("Pa", cv.getUnit());

        //
        // pressure_levels_ozone is Double
        //
        dim = dataset.findDimension("nlt");
        assertNotNull(dim);
        assertEquals("nlt", dim.getShortName());

        // check type
        coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Double.class, binding);
View Full Code Here

         
          PlotResult.init ( "results/" + fileName );
         
          //System.out.println(pr.numExp);
         
          final Dimension
            exp = PlotResult.ncfile.findDimension ( "suEleId" );
         
          for ( int  i = 0; i < PlotResult.numExp; i++ )
          {
            // Subexperiment node
View Full Code Here

         
          PlotResult.init ( "results/" + fileName );
         
          //System.out.println(pr.numExp);
         
          final Dimension
            exp = PlotResult.ncfile.findDimension ( "suEleId" );
         
          for ( int i = 0; i < PlotResult.numExp; i++ )
          {
            //Subexperiment node
View Full Code Here

        // Prepare latitude and longitude coordinate values
        // TODO: We need to support more CRS

        // Loop over dimensions
        Dimension boundDimension = null;
        for (NetCDFDimensionManager manager : dimensionMapping.values()) {
            final DimensionBean dim = manager.getCoverageDimension();
            final boolean isRange = dim.isRange();
            String dimensionName = manager.getName();
            final int dimensionLength = getDimensionSize(dimensionName);
            if (dimensionName.equalsIgnoreCase("TIME") || dimensionName.equalsIgnoreCase("ELEVATION")) {
                // Special management for TIME and ELEVATION dimensions
                // we will put these dimension lowercase for NetCDF names
                dimensionName = dimensionName.toLowerCase();
            }
            if (isRange) {
                if (boundDimension == null) {
                    boundDimension = writer.addDimension(null, NCUtilities.BOUNDARY_DIMENSION, 2);
                }
            }
            final Dimension netcdfDimension = writer.addDimension(null, dimensionName, dimensionLength);
            manager.setNetCDFDimension(netcdfDimension);

            // Assign variable to dimensions having coordinates
            Variable var = writer.addVariable(null, dimensionName,
                    NCUtilities.getNetCDFDataType(dim.getDatatype()), dimensionName);
View Full Code Here

     * @throws IOException
     * @throws InvalidRangeException
     */
    private void setCoordinateVariables() throws IOException, InvalidRangeException {
        for (NetCDFDimensionManager manager : dimensionMapping.values()) {
            Dimension dimension = manager.getNetCDFDimension();
            if (dimension == null) {
                throw new IllegalArgumentException("No Dimension found for this manager: " + manager.getName());
            }

            // Getting coordinate variable for that dimension
            final String dimensionName = dimension.getShortName();
            Variable var = writer.findVariable(dimensionName);
            if (var == null) {
                throw new IllegalArgumentException("Unable to find the specified coordinate variable: " + dimensionName);
            }
            // Writing coordinate variable values
View Full Code Here

        // NetCDF coordinates are relative to center. Envelopes are relative to corners: apply an half pixel shift to go back to center
        xmin += (periodX / 2d);
        ymin += (periodY / 2d);

        // Adding lat lon dimensions
        final Dimension latDim = writer.addDimension(null, NCUtilities.LAT, numLat);
        final Dimension lonDim = writer.addDimension(null, NCUtilities.LON, numLon);

        // --------
        // latitude
        // --------
        final ArrayFloat latData = new ArrayFloat(new int[] { numLat });
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.