Package org.jsoup.select

Examples of org.jsoup.select.Evaluator$Attribute


              break;

          default :
              break;
        }
        image.addAttribute(new Attribute("long_name", longName));
        if (calUnit != null) {
            image.addAttribute(new Attribute("units", calUnit));
        }
        if (calScale != 1.f) {
            image.addAttribute(new Attribute("scale_factor", calScale));
        }

    }
View Full Code Here


                v[j][jj]=new Variable(ncfile, null, null, var_name);
                v[j][jj].setDataType(DataType.FLOAT);
                dims2.add(radial);
                dims2.add(gateR[jj]);
                v[j][jj].setDimensions(dims2);
                v[j][jj].addAttribute(new Attribute( "long_name", var_name));
                v[j][jj].addAttribute(new Attribute( "units", unit[tp]));
                String coordinates="time elevationR azimuthR distanceR";
                v[j][jj].addAttribute(new Attribute(_Coordinate.Axes, coordinates));
                v[j][jj].addAttribute(new Attribute("missing_value", -999.99f));
                ncfile.addVariable(null, v[j][jj]);
                varList.add(v[j][jj]);
                dims2.clear();
            }
        }
        tsu_sec=new int[number_sweeps];
        String[] tsu=new String[number_sweeps];
        String[] time_units=new String[number_sweeps];
        tsu_sec=volScan.getStartSweep();
        for (int i=0; i< number_sweeps; i++) {
            String st1=Short.toString(month);
            if (st1.length() < 2) st1="0"+st1;
            String st2=Short.toString(day);
            if (st2.length() < 2) st2="0"+st2;
            date0=String.valueOf(year)+"-"+st1+"-"+st2;
            tsu[i]=date0+"T"+calcTime(tsu_sec[i],0)+"Z";
        }
        for (int j=0; j<number_sweeps; j++) { time_units[j]="secs since "+tsu[j]; }

        dims0.add(radial);
        // add "time" variable
        Variable[] time=new Variable[number_sweeps];
        String tm="time";   String tm_name="";
        for (int j=0; j<number_sweeps; j++) {  tm_name=tm;
        if (number_sweeps > 1) { tm_name=tm+"_sweep_"+(j+1)}
        time[j]=new Variable(ncfile, null, null, tm_name);
        time[j].setDataType(DataType.INT);
        time[j].setDimensions(dims0);
        time[j].addAttribute(new Attribute("long_name", "time from start of sweep"));
        time[j].addAttribute(new Attribute("units", time_units[j]));
        time[j].addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Time.toString()));
        time[j].addAttribute(new Attribute("missing_value", -99));
        ncfile.addVariable(null, time[j]);
        varList.add(time[j]);
        }

        // add "elevationR" variable
        Variable[] elevationR=new Variable[number_sweeps];
        String ele="elevationR";   String ele_name="";
        for (int j=0; j<number_sweeps; j++) {  ele_name=ele;
        if (number_sweeps > 1) { ele_name=ele+"_sweep_"+(j+1)}
        elevationR[j]=new Variable(ncfile, null, null, ele_name);
        elevationR[j].setDataType(DataType.FLOAT);
        elevationR[j].setDimensions(dims0);
        elevationR[j].addAttribute(new Attribute("long_name", "elevation angle"));
        elevationR[j].addAttribute(new Attribute("units", "degrees"));
        elevationR[j].addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString()));
        elevationR[j].addAttribute(new Attribute("missing_value", -999.99f));
        ncfile.addVariable(null, elevationR[j]);
        varList.add(elevationR[j]);
        }

        // add "azimuthR" variable
        Variable[] azimuthR=new Variable[number_sweeps];
        String azim="azimuthR";   String azim_name="";
        for (int j=0; j<number_sweeps; j++) {  azim_name=azim;
        if (number_sweeps > 1) { azim_name=azim+"_sweep_"+(j+1)}
        azimuthR[j]=new Variable(ncfile, null, null, azim_name);
        azimuthR[j].setDataType(DataType.FLOAT);
        azimuthR[j].setDimensions(dims0);
        azimuthR[j].addAttribute(new Attribute("long_name", "azimuth angle"));
        azimuthR[j].addAttribute(new Attribute("units", "degrees"));
        azimuthR[j].addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialAzimuth.toString()));
        azimuthR[j].addAttribute(new Attribute("missing_value", -999.99f));
        ncfile.addVariable(null, azimuthR[j]);
        varList.add(azimuthR[j]);
        }

        // add "distanceR" variable
        Variable[] distanceR=new Variable[number_sweeps];
        String dName="distanceR";
        String dist_name="";
        for (int j=0; j<number_sweeps; j++) {  dist_name=dName;
        if (number_sweeps > 1) { dist_name=dName+"_sweep_"+(j+1)}
        distanceR[j]=new Variable(ncfile, null, null, dist_name);
        distanceR[j].setDataType(DataType.FLOAT);
        dims1.add(gateR[j]);
        distanceR[j].setDimensions(dims1);
        distanceR[j].addAttribute(new Attribute("long_name", "radial distance"));
        distanceR[j].addAttribute(new Attribute("units", "m"));
        distanceR[j].addAttribute(new Attribute(_Coordinate.AxisType, AxisType.RadialDistance.toString()));
        ncfile.addVariable(null, distanceR[j]);
        varList.add(distanceR[j]);
        dims1.clear();
        }
        // add "numGates" variable
        dims3.add(scanR);
        Variable numGates=new Variable(ncfile, null, null, "numGates");
        numGates.setDataType(DataType.INT);
        numGates.setDimensions(dims3);
        numGates.addAttribute(new Attribute("long_name", "number of gates in the sweep"));
        ncfile.addVariable(null, numGates);
        varList.add(numGates);

        // add global attributes
        ncfile.addAttribute(null, new Attribute("definition", "SIGMET-IRIS RAW"));
        ncfile.addAttribute(null, new Attribute("description", "SIGMET-IRIS data are reading by Netcdf IOSP"));
        ncfile.addAttribute(null, new Attribute("StationName", stnName));
        ncfile.addAttribute(null, new Attribute("StationName_SetupUtility", stnName_util));
        ncfile.addAttribute(null, new Attribute("radar_lat", new Float(radar_lat)));
        ncfile.addAttribute(null, new Attribute("radar_lon", new Float(radar_lon)));
        ncfile.addAttribute(null, new Attribute("ground_height", new Short(ground_height)));
        ncfile.addAttribute(null, new Attribute("radar_height", new Short(radar_height)));
        ncfile.addAttribute(null, new Attribute("radar_alt", new Integer(radar_alt)));
        ncfile.addAttribute(null, new Attribute("num_data_types", new Integer(nparams)));
        ncfile.addAttribute(null, new Attribute("number_sweeps", new Short(number_sweeps)));
        String sn="start_sweep";  String snn="";
        for (int j=0; j<number_sweeps; j++) { snn=sn;
        if (number_sweeps > 1) { snn=sn+"_"+(j+1)}
        ncfile.addAttribute(null, new Attribute(snn, tsu[j]));
        }
        ncfile.addAttribute(null, new Attribute("num_rays", new Short(num_rays)));
        ncfile.addAttribute(null, new Attribute("max_number_gates", new Short(bins)));
        ncfile.addAttribute(null, new Attribute("range_first", new Float(range_first)));
        ncfile.addAttribute(null, new Attribute("range_last", new Float(range_last)));
        ncfile.addAttribute(null, new Attribute("DataType", "Radial"));
        ncfile.addAttribute(null, new Attribute("Conventions", _Coordinate.Convention));

        // --------- fill all of values in the ncfile ------
        doNetcdfFileCoordinate(ncfile, volScan.base_time, volScan.year, volScan.month, volScan.day, varList, recHdr);

        ncfile.finish();
View Full Code Here

        String sss22=Short.toString(dda[number_sweeps-1]);
        if (sss22.length() < 2) sss22="0"+sss22;
        String base_date1=String.valueOf(yr[number_sweeps-1])+"-"+sss11+"-"+sss22;
        String start_time=base_date0+"T"+calcTime(bst[0], 0)+"Z";
        String end_time=base_date1+"T"+calcTime(bst[number_sweeps-1], last_t)+"Z";
        ncfile.addAttribute(null, new Attribute("time_coverage_start", start_time));
        ncfile.addAttribute(null, new Attribute("time_coverage_end", end_time));

        // set all of Variables
        try {
            int sz=varList.size();
View Full Code Here

  }

  public void augmentDataset( NetcdfDataset ds, CancelTask cancelTask) throws IOException {
    for (Variable v : ds.getVariables()) {
      if (v.getShortName().equals("staName"))
        v.addAttribute( new Attribute("standard_name", "station_name"));
      else if (v.getShortName().equals("staLat"))
        v.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Lat.toString()));
      else if (v.getShortName().equals("staLon"))
        v.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Lon.toString()));
      else if (v.getShortName().equals("staElev"))
        v.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Height.toString()));
      else if (v.getShortName().equals("levels"))
        v.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Height.toString()));
      else if (v.getShortName().equals("timeObs"))
        v.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Time.toString()));
    }
    ds.finish();
  }
View Full Code Here

     * @throws IOException _more_
     */
    public void augmentDataset(NetcdfDataset ds,
                               CancelTask cancelTask) throws IOException {

        Attribute leoAtt = ds.findGlobalAttribute("leoId");

        if (leoAtt == null) {
            if (ds.findVariable("time") == null) {
                // create a time variable - assume its linear along the vertical dimension
                double start = ds.readAttributeDouble(null, "start_time",
                                   Double.NaN);
                double stop = ds.readAttributeDouble(null, "stop_time",
                                  Double.NaN);

                if (Double.isNaN(start) && Double.isNaN(stop)) {
                    double top = ds.readAttributeDouble(null, "toptime",
                                     Double.NaN);
                    double bot = ds.readAttributeDouble(null, "bottime",
                                     Double.NaN);

                    this.conventionName = "Cosmic2";
                    if (top > bot) {
                        stop  = top;
                        start = bot;
                    } else {
                        stop  = bot;
                        start = top;
                    }

                }

                Dimension dim       = ds.findDimension("MSL_alt");
                Variable  dimV      = ds.findVariable("MSL_alt");
                Array     dimU      = dimV.read();
                int       inscr = (dimU.getFloat(1) - dimU.getFloat(0)) > 0
                                  ? 1
                                  : 0;
                int       n         = dim.getLength();
                double    incr      = (stop - start) / n;

                String    timeUnits = "seconds since 1980-01-06 00:00:00";
                Variable timeVar = new VariableDS(ds, null, null, "time",
                                       DataType.DOUBLE, dim.getName(),
                                       timeUnits, null);
                ds.addVariable(null, timeVar);
                timeVar.addAttribute(new Attribute("units", timeUnits));
                timeVar.addAttribute(new Attribute(_Coordinate.AxisType,
                        AxisType.Time.toString()));
                int dir = ds.readAttributeInteger(null, "irs", 1);
                ArrayDouble.D1 data =
                    (ArrayDouble.D1) Array.factory(DataType.DOUBLE,
                        new int[] { n });
                if (inscr == 0) {
                    if (dir == 1) {
                        for (int i = 0; i < n; i++) {
                            data.set(i, start + i * incr);
                        }
                    } else {
                        for (int i = 0; i < n; i++) {
                            data.set(i, stop - i * incr);
                        }
                    }
                } else {
                    for (int i = 0; i < n; i++) {
                        data.set(i, stop - i * incr);
                    }
                }
                timeVar.setCachedData(data, false);
            }

            Variable v = ds.findVariable("Lat");
            if (v == null) {
                v = ds.findVariable("GEO_lat");
            }
            v.addAttribute(new Attribute(_Coordinate.AxisType,
                                         AxisType.Lat.toString()));
            Variable v1 = ds.findVariable("Lon");
            if (v1 == null) {
                v1 = ds.findVariable("GEO_lon");
            }
            v1.addAttribute(new Attribute(_Coordinate.AxisType,
                                          AxisType.Lon.toString()));
        } else {
            Dimension dim = ds.findDimension("time");
            int       n   = dim.getLength();
            Variable latVar = new VariableDS(ds, null, null, "Lat",
                                             DataType.FLOAT, dim.getName(),
                                             "degree", null);
            latVar.addAttribute(new Attribute(_Coordinate.AxisType,
                    AxisType.Lat.toString()));
            ds.addVariable(null, latVar);
            Variable lonVar = new VariableDS(ds, null, null, "Lon",
                                             DataType.FLOAT, dim.getName(),
                                             "degree", null);
            lonVar.addAttribute(new Attribute(_Coordinate.AxisType,
                    AxisType.Lon.toString()));
            ds.addVariable(null, lonVar);
            Variable altVar = new VariableDS(ds, null, null, "MSL_alt",
                                             DataType.FLOAT, dim.getName(),
                                             "meter", null);
            altVar.addAttribute(new Attribute(_Coordinate.AxisType,
                    AxisType.Height.toString()));
            ds.addVariable(null, altVar);

            // cal data array
            ArrayFloat.D1 latData =
                (ArrayFloat.D1) Array.factory(DataType.FLOAT,
                    new int[] { n });
            ArrayFloat.D1 lonData =
                (ArrayFloat.D1) Array.factory(DataType.FLOAT,
                    new int[] { n });
            ArrayFloat.D1 altData =
                (ArrayFloat.D1) Array.factory(DataType.FLOAT,
                    new int[] { n });
            ArrayDouble.D1 timeData =
                (ArrayDouble.D1) Array.factory(DataType.DOUBLE,
                    new int[] { n });
            this.conventionName = "Cosmic3";

            int iyr  = ds.readAttributeInteger(null, "year", 2009);
            int mon  = ds.readAttributeInteger(null, "month", 0);
            int iday = ds.readAttributeInteger(null, "day", 0);
            int ihr  = ds.readAttributeInteger(null, "hour", 0);
            int min  = ds.readAttributeInteger(null, "minute", 0);
            int sec  = ds.readAttributeInteger(null, "second", 0);

            double start = ds.readAttributeDouble(null, "startTime",
                               Double.NaN);
            double stop = ds.readAttributeDouble(null, "stopTime",
                              Double.NaN);
            double incr = (stop - start) / n;
            int    t    = 0;
            // double julian = juday(mon, iday, iyr);
            // cal the dtheta based pm attributes
            double   dtheta = gast(iyr, mon, iday, ihr, min, sec, t);

            Variable tVar   = ds.findVariable("time");
            String timeUnits = "seconds since 1980-01-06 00:00:00"//dtime.getUnit().toString();
            tVar.removeAttributeIgnoreCase("valid_range");
            tVar.removeAttributeIgnoreCase("units");
            tVar.addAttribute(new Attribute("units", timeUnits));
            tVar.addAttribute(new Attribute(_Coordinate.AxisType,
                                            AxisType.Time.toString()));

            Variable v    = ds.findVariable("xLeo");
            Array    xLeo = v.read();
            v = ds.findVariable("yLeo");
View Full Code Here

    this.dodsfile = dodsfile;
    this.dodsShortName = dodsShortName;

    setDataType( DODSNetcdfFile.convertToNCType( dodsScalar));
    if (DODSNetcdfFile.isUnsigned( dodsScalar)) {
      addAttribute(new Attribute("_Unsigned", "true"));
    }

    // check for netcdf char array
    Dimension strlenDim;
    if ((dataType == DataType.STRING) && (null != (strlenDim = dodsfile.getNetcdfStrlenDim( this)))) {
View Full Code Here

    this.dodsfile = dodsfile;
    this.dodsShortName = dodsShortName;

    setDataType( DODSNetcdfFile.convertToNCType( elemType));
    if (DODSNetcdfFile.isUnsigned( elemType)) {
      addAttribute(new Attribute("_Unsigned", "true"));
    }

    List<Dimension> dims = dodsfile.constructDimensions( parentGroup, dodsArray);

    // check for netcdf char array
View Full Code Here

     * @param attName  the attribute name
     *
     * @return the int array
     */
    private int[] getIntArray(Variable ctv, String attName) {
        Attribute att = ctv.findAttribute(attName);
        if (att == null) {
            throw new IllegalArgumentException(
                "McIDASArea coordTransformVariable " + ctv.getFullName()
                + " must have " + attName + " attribute");
        }

        Array arr = att.getValues();
        return (int[]) arr.get1DJavaArray(int.class);
    }
View Full Code Here

    }

    if (v != null) {
      v.setDataType(dt);
      if (unsigned)
         v.addAttribute(new Attribute("_Unsigned", "true"));
    }

    return dt;
  }
View Full Code Here

  }

  public void testVlengthAttribute() throws IOException {
    NetcdfFile ncfile = TestH5.openH5("support/vlstra.h5");

    Attribute att = ncfile.findGlobalAttribute("test_scalar");
    assert (null != att);
    assert (!att.isArray());
    assert (att.isString());
    assert (att.getStringValue().equals("This is the string for the attribute"));
    ncfile.close();
  }
View Full Code Here

TOP

Related Classes of org.jsoup.select.Evaluator$Attribute

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.