Package wycs.syntax

Examples of wycs.syntax.Expr$Variable


    }

    public float[] readAllData() throws IOException {
      Array allData;
      Sweep spn = (Sweep) sweeps.get(0);
      Variable v = spn.getsweepVar();
      try {
        allData = v.read();
      } catch (IOException e) {
        throw new IOException(e.getMessage());
      }
      return (float[]) allData.get1DJavaArray(float.class);
    }
View Full Code Here


      private void setMeanElevation() {
        Array spData = null;
        if (Double.isNaN(meanElevation)) {
          try {
            Variable sp = ds.findVariable("elevation");
            spData = sp.read();
            sp.setCachedData(spData, false);
          } catch (IOException e) {
            e.printStackTrace();
            meanElevation = 0.0;
          }
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 ( 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

      private void setMeanAzimuth() {
        if (getType() != null) {
          Array spData = null;
          try {
            Variable sp = ds.findVariable("azimuth");
            spData = sp.read();
            sp.setCachedData(spData, false);

          } catch (IOException e) {
            e.printStackTrace();
            meanAzimuth = 0.0;
          }
View Full Code Here

      }

      public float[] getElevation() throws IOException {
        float[] spArray = null;
        try {
          Variable sp = ds.findVariable("elevation");
          Array spData = sp.read();
          sp.setCachedData(spData, false);
          spArray = (float[]) spData.get1DJavaArray(float.class);

        } catch (IOException e) {
          e.printStackTrace();
        }
View Full Code Here

      }

      public float getAzimuth(int ray) throws IOException {
        Array spData = null;
        try {
          Variable sp = ds.findVariable("azimuth");
          spData = sp.read();
          sp.setCachedData(spData, false);
        } catch (IOException e) {
          e.printStackTrace();
        }
        Index index = spData.getIndex();
        return spData.getFloat(index.set(ray));
View Full Code Here

      }

      public float[] getAzimuth() throws IOException {
        float[] spArray = null;
        try {
          Variable sp = ds.findVariable("azimuth");
          Array spData = sp.read();
          sp.setCachedData(spData, false);
          spArray = (float[]) spData.get1DJavaArray(float.class);

        } catch (IOException e) {
          e.printStackTrace();
        }
View Full Code Here

      }

      public float getRadialDistance(int gate) throws IOException {
        Array spData = null;
        try {
          Variable sp = ds.findVariable("gate");
          spData = sp.read();
          sp.setCachedData(spData, false);
        } catch (IOException e) {
          e.printStackTrace();
        }
        Index index = spData.getIndex();
        return spData.getFloat(index.set(gate));
View Full Code Here

      }

      public float getTime(int ray) throws IOException {
        Array timeData = null;
        try {
          Variable sp = ds.findVariable("rays_time");
          timeData = sp.read();
          sp.setCachedData(timeData, false);
        } catch (IOException e) {
          e.printStackTrace();
        }
        Index index = timeData.getIndex();
        return timeData.getFloat(index.set(ray));
View Full Code Here

            ArrayFloat.D2[] dataArr=new ArrayFloat.D2[nparams*number_sweeps];
            Index[] dataIndex=new Index[nparams*number_sweeps];

           // Variable[][] vv=new Variable[nparams][number_sweeps];
            Variable var=null;
            String var_name="";

            Ray[] rtemp=new Ray[(int)num_rays];

            // NCdump.printArray(dataArr[0], "Total_Power", System.out, null);

            Variable[] distanceR=new Variable[number_sweeps];
            ArrayFloat.D1[] distArr=new ArrayFloat.D1[number_sweeps];
            Index[] distIndex=new Index[number_sweeps];
            String distName="distanceR";
            for (int i=0; i<number_sweeps; i++) {
                if (number_sweeps > 1) {  distName="distanceR_sweep_"+(i+1); }
                for  (int ix=0; ix<sz; ix++)  {
                    var=varList.get(ix);
                    if ((var.getShortName()).equals(distName.trim())) { distanceR[i]= var; break; }
                }
                distArr[i]=(ArrayFloat.D1) Array.factory(DataType.FLOAT, distanceR[i].getShape());
                distIndex[i]=distArr[i].getIndex();

               // for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=ray[i][jj]; }
                ngates=sweep_bins[i];
                float stp=calcStep(range_first, range_last,(short)ngates);
                for (int ii=0; ii<ngates; ii++)  {
                    distArr[i].setFloat(distIndex[i].set(ii), (range_first+ii*stp));
                }
            }
            // NCdump.printArray(distArr[0], "distanceR", System.out, null);
            List rgp =  volScan.getTotalPowerGroups();
            if(rgp.size() == 0) rgp = volScan.getReflectivityGroups();
            List [] sgp = new ArrayList[number_sweeps];
            for (int i=0; i<number_sweeps; i++) {
                sgp[i] = (List)rgp.get((short)i);
            }


            Variable[] time=new Variable[number_sweeps];
            ArrayInt.D1[] timeArr=new ArrayInt.D1[number_sweeps];
            Index[] timeIndex=new Index[number_sweeps];
            String t_n="time";
            for (int i=0; i<number_sweeps; i++) {
                if (number_sweeps > 1) { t_n="time_sweep_"+(i+1); }
                for  (int ix=0; ix<sz; ix++)  {
                    var=varList.get(ix);
                    if ((var.getShortName()).equals(t_n.trim())) { time[i]=var;  break; }
                }

                //                if (time[i].getShape().length == 0) {
                //                    continue;
                //                }
                timeArr[i]=(ArrayInt.D1) Array.factory(DataType.INT, time[i].getShape());
                timeIndex[i]=timeArr[i].getIndex();
                List rlist = sgp[i];

                for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); }    //ray[i][jj]; }
                for (int jj=0; jj<num_rays; jj++) {
                    timeArr[i].setInt(timeIndex[i].set(jj), rtemp[jj].getTime());
                }
            }

            // NCdump.printArray(timeArr[0], "time", System.out, null);

            Variable[] azimuthR=new Variable[number_sweeps];
            ArrayFloat.D1[] azimArr=new ArrayFloat.D1[number_sweeps];
            Index[] azimIndex=new Index[number_sweeps];
            String azimName="azimuthR";
            for (int i=0; i<number_sweeps; i++) {
                if (number_sweeps > 1) {  azimName="azimuthR_sweep_"+(i+1); }
                for  (int ix=0; ix<sz; ix++)  {
                    var=varList.get(ix);
                    if ((var.getShortName()).equals(azimName.trim())) { azimuthR[i]=var; break}
                }
                azimArr[i]=(ArrayFloat.D1) Array.factory(DataType.FLOAT, azimuthR[i].getShape());
                azimIndex[i]=azimArr[i].getIndex();
                List rlist = sgp[i];

                for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
                for (int jj=0; jj<num_rays; jj++) {
                    azimArr[i].setFloat(azimIndex[i].set(jj), rtemp[jj].getAz());
                }
            }
            //NCdump.printArray(azimArr[0], "azimuthR", System.out, null);

            Variable[] elevationR=new Variable[number_sweeps];
            ArrayFloat.D1[] elevArr=new ArrayFloat.D1[number_sweeps];
            Index[] elevIndex=new Index[number_sweeps];
            String elevName="elevationR";
            for (int i=0; i<number_sweeps; i++) {
                if (number_sweeps > 1) {  elevName="elevationR_sweep_"+(i+1); }
                for  (int ix=0; ix<sz; ix++)  {
                    var=varList.get(ix);
                    if ((var.getShortName()).equals(elevName.trim())) { elevationR[i]=var; break}
                }
                elevArr[i]=(ArrayFloat.D1) Array.factory(DataType.FLOAT, elevationR[i].getShape());
                elevIndex[i]=elevArr[i].getIndex();
                List rlist = sgp[i];

                for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
                for (int jj=0; jj<num_rays; jj++) {
                    elevArr[i].setFloat(elevIndex[i].set(jj), rtemp[jj].getElev());
                }
            }
            // NCdump.printArray(elevArr[0], "elevationR", System.out, null);

            Variable numGates=null;
            for (int i=0; i<number_sweeps; i++) {
                for  (int ix=0; ix<sz; ix++)  {
                    var=varList.get(ix);
                    if ((var.getShortName()).equals("numGates")) { numGates=var; break}
                }
            }
            ArrayInt.D1 gatesArr=(ArrayInt.D1) Array.factory(DataType.INT, numGates.getShape());
            Index gatesIndex=gatesArr.getIndex();
           
            for (int i=0; i<number_sweeps; i++) {
                List rlist = sgp[i];
                for (int jj=0; jj<num_rays; jj++) { rtemp[jj]=(Ray)rlist.get(jj); } //ray[i][jj]; }
                ngates=rtemp[0].getBins();
                gatesArr.setInt(gatesIndex.set(i), ngates);
            }

            for (int i=0; i<number_sweeps; i++) {
                distanceR[i].setCachedData(distArr[i], false);
                time[i].setCachedData(timeArr[i], false);
                azimuthR[i].setCachedData(azimArr[i], false);
                elevationR[i].setCachedData(elevArr[i], false);
            }
            numGates.setCachedData(gatesArr, false);
            // startSweep.setCachedData(sweepArr, false);

            //          -------------------------------------------------
           // int b=(int)ray[0][0].getBins();

View Full Code Here

TOP

Related Classes of wycs.syntax.Expr$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.