private UF2Variable(NetcdfDataset nds, VariableSimpleIF v, Variable v0) { super(v.getShortName(), v0.getAttributes()); sweeps = new ArrayList(); name = v.getShortName(); int[] shape = v0.getShape(); int count = v0.getRank() - 1; int ngates = shape[count]; count--; int nrays = shape[count]; count--; nsweeps = shape[count]; for(int i = 0; i< nsweeps; i++) sweeps.add( new UF2Sweep(v0, i, nrays, ngates)) ; } public String toString() {
private void setMeanEle(String elevName, int swpNumber) { try { float[] eleData = getEle(elevName, swpNumber); float sum = 0; int sumSize = 0; for (float v : eleData) if(!Float.isNaN(v)) { sum += v; sumSize++; } if (sumSize > 0) meanElevation = sum / sumSize; } catch (IOException e) { e.printStackTrace(); } }
public float getGateSize() { try { return getRadialDistance(1) - getRadialDistance(0); } catch (IOException e) { e.printStackTrace(); return 0.0f; } }
private void setMeanEle(String elevName, int swpNumber) { Array eleData = null; float sum = 0; int sumSize = 0; try { Array eleTmp = ds.findVariable(elevName).read(); int [] eleOrigin = new int[2]; eleOrigin[0] = swpNumber; eleOrigin[1] = 0; int [] eleShape = {1, getRadialNumber()}; eleData = eleTmp.section(eleOrigin, eleShape); } catch (IOException e) { e.printStackTrace(); } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } float [] eleArray = (float []) eleData.get1DJavaArray(Float.TYPE); int size = (int)eleData.getSize(); for(int i= 0; i< size; i++) { if(!Float.isNaN(eleArray[i])) { sum = sum + eleArray[i]; sumSize++; } } meanElevation = sum/sumSize; //MAMath.sumDouble(eleData) / eleData.getSize(); }
public float getAzi(String aziName, int swpNumber, int ray) throws IOException { Array aziData = null; // int[] shape = ve.getShape(); if(aziData == null) { try { Array aziTmp = ds.findVariable(aziName).read(); int [] aziOrigin = new int[2]; aziOrigin[0] = swpNumber; aziOrigin[1] = 0; //shape[1] - getRadialNumber(); int [] aziShape = {1, getRadialNumber()}; aziData = aziTmp.section(aziOrigin, aziShape); } catch (IOException e) { e.printStackTrace(); } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } } Index index = aziData.getIndex(); return aziData.getFloat(index.set(ray)); }
private void setMeanAzi(String aziName, int swpNumber) { Array aziData = null; if (getType() != null) { try { Array data = ds.findVariable(aziName).read(); int [] aziOrigin = new int[2]; aziOrigin[0] = swpNumber; aziOrigin[1] = 0; //shape[1] - getRadialNumber(); int [] aziShape = {1, getRadialNumber()}; aziData = data.section(aziOrigin, aziShape); meanAzimuth = MAMath.sumDouble( aziData) / aziData.getSize(); } catch (IOException e) { e.printStackTrace(); meanAzimuth = 0.0; } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } } else meanAzimuth = 0.0; }
public float[] getEle(String elevName, int swpNumber) throws IOException { Array eleData = null; if(eleData == null) { try { Array eleTmp = ds.findVariable(elevName).read(); int [] eleOrigin = new int[2]; eleOrigin[0] = swpNumber; eleOrigin[1] = 0; int [] eleShape = {1, getRadialNumber()}; eleData = eleTmp.section(eleOrigin, eleShape); } catch (IOException e) { e.printStackTrace(); } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } } return (float [])eleData.get1DJavaArray(Float.TYPE); }
private void setMeanAzi(String aziName, int swpNumber) { if (getType() != null) { try { Array data = ds.findVariable(aziName).read(); int [] aziOrigin = new int[2]; aziOrigin[0] = swpNumber; aziOrigin[1] = 0; //shape[1] - getRadialNumber(); int [] aziShape = {1, getRadialNumber()}; Array aziData = data.section(aziOrigin, aziShape); meanAzimuth = MAMath.sumDouble( aziData) / aziData.getSize(); } catch (IOException e) { e.printStackTrace(); meanAzimuth = 0.0; } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } } else { meanAzimuth = 0.0; } }
public float getEle(String elevName, int swpNumber, int ray) throws IOException { Array eleData = null; try { Array eleTmp = ds.findVariable(elevName).read(); int [] eleOrigin = new int[2]; eleOrigin[0] = swpNumber; eleOrigin[1] = 0; //shape[1] - getRadialNumber(); int [] eleShape = {1, getRadialNumber()}; eleData = eleTmp.section(eleOrigin, eleShape); } catch (IOException e) { e.printStackTrace(); } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } // if(eleData == null) initAzi(); Index index = eleData.getIndex(); return eleData.getFloat(index.set(ray)); }
public float[] getAzi(String aziName, int swpNumber) throws IOException { Array aziData = null; if(aziData == null) { try { Array aziTmp = ds.findVariable(aziName).read(); int [] aziOrigin = new int[2]; aziOrigin[0] = swpNumber; aziOrigin[1] = 0; //shape[1] - getRadialNumber(); int [] aziShape = {1, getRadialNumber()}; aziData = aziTmp.section(aziOrigin, aziShape); } catch (IOException e) { e.printStackTrace(); } catch (ucar.ma2.InvalidRangeException e) { e.printStackTrace(); } } return (float [])aziData.get1DJavaArray(Float.TYPE); }
private UF2Variable(NetcdfDataset nds, VariableSimpleIF v, Variable v0) { super(v.getShortName(), v0.getAttributes()); sweeps = new ArrayList(); name = v.getShortName(); int[] shape = v0.getShape(); int count = v0.getRank() - 1; int ngates = shape[count]; count--; int nrays = shape[count]; count--; nsweeps = shape[count]; for(int i = 0; i< nsweeps; i++) sweeps.add( new UF2Sweep(v0, i, nrays, ngates)) ; } public String toString() {
public float getAzimuth(int ray) throws IOException { String aziName = "azimuth" + abbrev; return getAzi(aziName, sweepno, ray); }
public float[] getAzimuth() throws IOException { String aziName = "azimuth" + abbrev; return getAzi(aziName, sweepno); }
public float getElevation(int ray) throws IOException { String eleName = "elevation" + abbrev; return getEle(eleName, sweepno, ray); }
public void setMeanAzimuth() { String aziName = "azimuth" + abbrev; setMeanAzi(aziName, sweepno); }
public float getRadialDistance(int gate) throws IOException { String disName = "distance" + abbrev; return getRadialDist(disName, gate); }
public float[] readData(int ray) throws java.io.IOException { return rayData(sweepno, ray); }
public float[] readData(int ray) throws java.io.IOException { return rayData(sweepno, ray); }
public float[] getAzi(String aziName, int swpNumber) throws IOException { try { Array aziData = ds.findVariable(aziName).read(); int [] aziOrigin = new int[2]; aziOrigin[0] = swpNumber; aziOrigin[1] = 0; //shape[1] - getRadialNumber(); int [] aziShape = {1, getRadialNumber()}; aziData = aziData.section(aziOrigin, aziShape); return (float [])aziData.get1DJavaArray(Float.TYPE); } catch (ucar.ma2.InvalidRangeException e) { throw new IOException(e); } }
public float[] getEle(String elevName, int swpNumber) throws IOException { try { Array eleData = ds.findVariable(elevName).read(); int [] eleOrigin = new int[2]; eleOrigin[0] = swpNumber; eleOrigin[1] = 0; int [] eleShape = {1, getRadialNumber()}; eleData = eleData.section(eleOrigin, eleShape); return (float [])eleData.get1DJavaArray(Float.TYPE); } catch (ucar.ma2.InvalidRangeException e) { throw new IOException(e); } }