private ArrayDouble.D1 makeHeight1D( Array eta, Array s, Array depth, Array c, double depth_c, int x_index, int y_index) { int nz = (int) s.getSize(); Index sIndex = s.getIndex(); Index cIndex = c.getIndex(); Index etaIndex = eta.getIndex(); Index depthIndex = depth.getIndex(); ArrayDouble.D1 height = new ArrayDouble.D1(nz); for (int z = 0; z < nz; z++) { double sz = s.getDouble(sIndex.set(z)); double cz = c.getDouble(cIndex.set(z)); double term1 = depth_c * sz; double fac1 = depth.getDouble(depthIndex.set(y_index, x_index)); double term2 = fac1 * cz; double Sterm = (term1 + term2) / (depth_c + fac1); double term3 = eta.getDouble(etaIndex.set(y_index, x_index)); double term4 = (term3 + fac1) * Sterm; double hterm = term3 + term4; height.set(z, hterm); } return height; }
private void writeStationData(List<ucar.unidata.geoloc.Station> stnList) throws IOException { this.stnList = stnList; int nstns = stnList.size(); stationMap = new HashMap<String, StationTracker>(2 * nstns); if (debug) System.out.println("stationMap created"); // now write the station data ArrayDouble.D1 latArray = new ArrayDouble.D1(nstns); ArrayDouble.D1 lonArray = new ArrayDouble.D1(nstns); ArrayDouble.D1 altArray = new ArrayDouble.D1(nstns); ArrayObject.D1 idArray = new ArrayObject.D1(String.class, nstns); ArrayObject.D1 descArray = new ArrayObject.D1(String.class, nstns); ArrayObject.D1 wmoArray = new ArrayObject.D1(String.class, nstns); for (int i = 0; i < stnList.size(); i++) { ucar.unidata.geoloc.Station stn = stnList.get(i); stationMap.put(stn.getName(), new StationTracker(i)); latArray.set(i, stn.getLatitude()); lonArray.set(i, stn.getLongitude()); if (useAlt) altArray.set(i, stn.getAltitude()); idArray.set(i, stn.getName()); descArray.set(i, stn.getDescription()); if (useWmoId) wmoArray.set(i, stn.getWmoId()); } try { ncfile.write(latName, latArray); ncfile.write(lonName, lonArray); if (useAlt) ncfile.write(altName, altArray); ncfile.writeStringData(idName, idArray); ncfile.writeStringData(descName, descArray); if (useWmoId) ncfile.writeStringData(wmoName, wmoArray); } catch (InvalidRangeException e) { e.printStackTrace(); throw new IllegalStateException(e); } }