Package io

Examples of io.ADXInterpreter$Variable


    ct.addAttribute( new Attribute(_Coordinate.TransformType, "Projection"));
    ct.addAttribute( new Attribute(_Coordinate.Axes, "GeoX GeoY"));
    ncDataset.addVariable(null, ct);
  */
        NcMLReader.wrapNcMLresource(ncDataset, CoordSysBuilder.resourcesDir + "CEDRICRadar.ncml", cancelTask);
        Variable lat = ncDataset.findVariable("radar_latitude");
        Variable lon = ncDataset.findVariable("radar_longitude");
        float    latv = (float)lat.readScalarDouble();
        float    lonv = (float)lon.readScalarDouble();
        Variable pv = ncDataset.findVariable("Projection");
        pv.addAttribute(new Attribute("longitude_of_projection_origin", lonv) );
        pv.addAttribute(new Attribute("latitude_of_projection_origin", latv) );

        Variable sdate = ncDataset.findVariable("start_date");
        Variable stime = ncDataset.findVariable("start_time");
        Variable tvar = ncDataset.findVariable("time");
        String dateStr = sdate.readScalarString();
        String timeStr = stime.readScalarString();
        Date dt = null;
        try {
          dt = DateUtil.parse(dateStr + " " + timeStr);
        } catch (Exception e) {}

        int nt = 1;

        ArrayDouble.D1 data = new ArrayDouble.D1(nt);

        data.setDouble(0, dt.getTime()/1000);

        tvar.setCachedData(data, false);

        super.augmentDataset(ncDataset, cancelTask);

   //     System.out.println("here\n");

View Full Code Here


    // do we need to version this ?
    // String version =  ds.findAttValueIgnoreCase(null, "version", null);

    if (!hasTime) {
      Variable time = ds.findVariable("time_offset");
      if (time != null) {
        Variable base = ds.findVariable("base_time");
        int base_time = base.readScalarInt();
        try {
          DateUnit dunit = new DateUnit("seconds since 1970-01-01 00:00");
          String time_units = "seconds since " + dunit.makeStandardDateString(base_time);
          time.addAttribute(new Attribute("units", time_units));
          time.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.name()));
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }

    // look for coordinates
    String coordinates = ds.findAttValueIgnoreCase(null, "coordinates", null);
    if (coordinates != null) {
      String[] vars = coordinates.split(" ");
      for (String vname : vars) {
        Variable v = ds.findVariable(vname);
        if (v != null) {
          AxisType atype = getAxisType(ds, (VariableEnhanced) v);
          if (atype != null)
            v.addAttribute(new Attribute(_Coordinate.AxisType, atype.name()));
        }
      }
    }

  }
View Full Code Here

    }

  }

  private boolean setAxisType(NetcdfDataset ds, String varName, AxisType atype) {
    Variable v = ds.findVariable(varName);
    if (v == null) return false;

    v.addAttribute(new Attribute(_Coordinate.AxisType, atype.toString()));
    return true;
  }
View Full Code Here

        List<Dimension> dims = new ArrayList<Dimension>();
        dims.add( scanDim);
        dims.add( radialDim);
        dims.add( gateDim);

        Variable v = new Variable(ncfile, null, null, shortName+abbrev);
        v.setDataType(DataType.SHORT);
        v.setDimensions(dims);
        ncfile.addVariable(null, v);

        v.addAttribute( new Attribute("units", firstRay.getDatatypeUnits(abbrev)));
        v.addAttribute( new Attribute("long_name", longName));
        v.addAttribute( new Attribute("abbrev", abbrev));
        v.addAttribute( new Attribute("missing_value", firstRay.getMissingData()));
        v.addAttribute( new Attribute("signal_below_threshold", firstRay.getDatatypeRangeFoldingThreshhold(abbrev)));
        v.addAttribute( new Attribute("scale_factor", firstRay.getDatatypeScaleFactor(abbrev)));
        v.addAttribute( new Attribute("add_offset", firstRay.getDatatypeAddOffset(abbrev)));
       // v.addAttribute( new Attribute("_Unsigned", "false"));

        v.addAttribute( new Attribute("range_folding_threshold" ,firstRay.getDatatypeRangeFoldingThreshhold(abbrev)));

        List<Dimension> dim2 = new ArrayList<Dimension>();
        dim2.add( scanDim);
        dim2.add( radialDim);

        // add time coordinate variable
        String timeCoordName = "time"+abbrev;
        Variable timeVar = new Variable(ncfile, null, null, timeCoordName);
        timeVar.setDataType(DataType.INT);
        timeVar.setDimensions(dim2);
        ncfile.addVariable(null, timeVar);


        // int julianDays = volScan.getTitleJulianDays();
        // Date d = Level2Record.getDate( julianDays, 0);
        Date d = firstRay.getDate();
        String units = "msecs since "+formatter.toDateTimeStringISO(d);

        timeVar.addAttribute( new Attribute("long_name", "time since base date"));
        timeVar.addAttribute( new Attribute("units", units));
        timeVar.addAttribute( new Attribute("missing_value", firstRay.getMissingData()));
        timeVar.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Time.toString()));

        // add elevation coordinate variable
        String elevCoordName = "elevation"+abbrev;
        Variable elevVar = new Variable(ncfile, null, null, elevCoordName);
        elevVar.setDataType(DataType.FLOAT);
        elevVar.setDimensions(dim2);
        ncfile.addVariable(null, elevVar);

        elevVar.addAttribute( new Attribute("units", "degrees"));
        elevVar.addAttribute( new Attribute("long_name", "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular"));
        elevVar.addAttribute( new Attribute("missing_value", firstRay.getMissingData()));
        elevVar.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString()));

        // add azimuth coordinate variable
        String aziCoordName = "azimuth"+abbrev;
        Variable aziVar = new Variable(ncfile, null, null, aziCoordName);
        aziVar.setDataType(DataType.FLOAT);
        aziVar.setDimensions(dim2);
        ncfile.addVariable(null, aziVar);

        aziVar.addAttribute( new Attribute("units", "degrees"));
        aziVar.addAttribute( new Attribute("long_name", "azimuth angle in degrees: 0 = true north, 90 = east"));
        aziVar.addAttribute( new Attribute("missing_value", firstRay.getMissingData()));
        aziVar.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.RadialAzimuth.toString()));

        // add gate coordinate variable
        String gateCoordName = "distance"+abbrev;
        Variable gateVar = new Variable(ncfile, null, null, gateCoordName);
        gateVar.setDataType(DataType.FLOAT);
        gateVar.setDimensions(gateDimName);
        Array data = Array.makeArray( DataType.FLOAT, ngates,
            (double) firstRay.getGateStart(abbrev), (double) firstRay.getGateSize(abbrev));
        gateVar.setCachedData( data, false);
        ncfile.addVariable(null, gateVar);
  //      radarRadius = firstRay.getGateStart(datatype) + ngates * firstRay.getGateSize(datatype);

        gateVar.addAttribute( new Attribute("units", "m"));
        gateVar.addAttribute( new Attribute("long_name", "radial distance to start of gate"));
        gateVar.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.RadialDistance.toString()));

        // add number of radials variable
        String nradialsName = "numRadials"+abbrev;
        Variable nradialsVar = new Variable(ncfile, null, null, nradialsName);
        nradialsVar.setDataType(DataType.INT);
        nradialsVar.setDimensions(scanDim.getName());
        nradialsVar.addAttribute( new Attribute("long_name", "number of valid radials in this scan"));
        ncfile.addVariable(null, nradialsVar);

        // add number of gates variable
        String ngateName = "numGates"+abbrev;
        Variable ngateVar = new Variable(ncfile, null, null, ngateName);
        ngateVar.setDataType(DataType.INT);
        ngateVar.setDimensions(scanDim.getName());
        ngateVar.addAttribute( new Attribute("long_name", "number of valid gates in this scan"));
        ncfile.addVariable(null, ngateVar);

        makeCoordinateDataWithMissing(abbrev, timeVar, elevVar, aziVar, nradialsVar, ngateVar, groups);

        // back to the data variable
View Full Code Here

  public void problemV() throws IOException {
    H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    String filename = testDir + "ssec-h5/MYD04_L2.A2006188.1830.005.2006194121515.hdf";
    NetcdfFile ncfile = NetcdfFile.open(filename);
    Variable v = ncfile.findVariable("/U-MARF/EPS/IASI_xxx_1C/DATA/SPECT_LAT_ARRAY");
    Array data = v.read();
    System.out.println("\n**** testReadNetcdf4 done\n\n" + ncfile);
    NCdump.printArray(data, "primary_cloud", System.out, null);
    ncfile.close();
  }
View Full Code Here

    String units = ds.findAttValueIgnoreCase(ctv, "units", null);
    if (units == null) {
      List<CoordinateAxis> axes = ds.getCoordinateAxes();
      for (CoordinateAxis axis : axes) {
        if (axis.getAxisType() == AxisType.GeoX) { // kludge - what if there's multiple ones?
          Variable v = axis.getOriginalVariable(); // LOOK why original variable ?
          units = v.getUnitsString();
          break;
        }
      }
    }
View Full Code Here

    // H5header.setDebugFlags( new ucar.nc2.util.DebugFlagsImpl("H5header/header"));

    // actually bogus - apparently all filters arre turned off
    // but its a test of filtered data with no filter actually applied
    NetcdfFile ncfile = TestH5.openH5("support/zip.h5");
    Variable v = ncfile.findVariable("Data/Compressed_Data");
    assert v != null;
    Array data = v.read();
    int[] shape = data.getShape();
    assert shape[0] == 1000;
    assert shape[1] == 20;

    Index ima = data.getIndex();
View Full Code Here

  public void test2() throws IOException {
    //H5header.setDebugFlags( new ucar.nc2.util.DebugFlagsImpl("H5header/header"));

    // probably bogus also, cant find any non-zero filtered variables
    NetcdfFile ncfile = TestH5.openH5("wrf/wrf_input_seq.h5");
    Variable v = ncfile.findVariable("DATASET=INPUT/GSW");
    assert v != null;
    Array data = v.read();
    int[] shape = data.getShape();
    assert shape[0] == 1;
    assert shape[1] == 20;
    assert shape[2] == 10;
  }
View Full Code Here

  public void testDeflate() throws IOException {
    //H5header.setDebugFlags( new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    NetcdfFile ncfile = TestH5.openH5("msg/MSG1_8bit_HRV.H5");

    // picture looks ok in ToolsUI
    Variable v = ncfile.findVariable("image1/image_data");
    assert v != null;
    Array data = v.read();
    int[] shape = data.getShape();
    assert shape[0] == 1000;
    assert shape[1] == 1500;
  }
View Full Code Here

  public void testMissing() throws IOException {
    //H5header.setDebugFlags( new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    NetcdfFile ncfile = TestH5.openH5("HIRDLS/HIRDLS2-AFGL_b027_na.he5");

    // picture looks ok in ToolsUI
    Variable v = ncfile.findVariable("HDFEOS/SWATHS/HIRDLS/Data Fields/Altitude");
    assert v != null;
    Array data = v.read();
    int[] shape = data.getShape();
    assert shape[0] == 6;
    assert shape[1] == 145;
  }
View Full Code Here

TOP

Related Classes of io.ADXInterpreter$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.