private void makeSelectStations(StringBuffer sbuff, List stations) { // ID id1,id2,id3,...idn // However, it will depend on the dataset as to the variable for the station ID. // For synoptic data it's IDN (e.g. 72469) // for METAR it's ID. // For profiler data, there are two variables IDA and IDB where IDA is the first 4 chars and IDB // is the second 4. sbuff.append("ID "); for (int i = 0; i < stations.size(); i++) { Station s = (Station) stations.get(i); if (i > 0) sbuff.append(","); sbuff.append(s.getName()); } }
private void createDataVariables(List<VariableSimpleIF> dataVars) throws IOException { /* height variable Variable heightVar = ncfile.addStringVariable(altName, recordDims, 20); ncfile.addVariableAttribute(heightVar, new Attribute("long_name", "height of observation")); ncfile.addVariableAttribute(heightVar, new Attribute("units", altUnits)); */ Variable v = ncfile.addVariable(parentProfileIndex, DataType.INT, recordDimName); ncfile.addVariableAttribute(v, new Attribute("long_name", "index of parent profile")); v = ncfile.addVariable(nextObsName, DataType.INT, recordDimName); ncfile.addVariableAttribute( v, new Attribute("long_name", "record number of next obs in linked list for this profile")); // find all dimensions needed by the data variables for (VariableSimpleIF var : dataVars) { List<Dimension> dims = var.getDimensions(); dimSet.addAll(dims); } // add them for (Dimension d : dimSet) { if (!d.isUnlimited()) ncfile.addDimension(d.getName(), d.getLength(), d.isShared(), false, d.isVariableLength()); } // add the data variables all using the record dimension for (VariableSimpleIF oldVar : dataVars) { List<Dimension> dims = oldVar.getDimensions(); StringBuffer dimNames = new StringBuffer(recordDimName); for (Dimension d : dims) { if (!d.isUnlimited()) dimNames.append(" ").append(d.getName()); } Variable newVar = ncfile.addVariable(oldVar.getName(), oldVar.getDataType(), dimNames.toString()); List<Attribute> atts = oldVar.getAttributes(); for (Attribute att : atts) { ncfile.addVariableAttribute(newVar, att); } } }
public String getDetailInfo() { StringBuffer sbuff = new StringBuffer(); sbuff.append("TrajectoryObsDataset\n"); sbuff.append(" adapter = " + getClass().getName() + "\n"); sbuff.append(" trajectories:" + "\n"); for (Iterator it = this.getTrajectoryIds().iterator(); it.hasNext(); ) { sbuff.append(" " + (String) it.next() + "\n"); } sbuff.append(super.getDetailInfo()); return sbuff.toString(); }
public static void main(String[] args) { // new AddePointDataset("adde://adde.ucar.edu/point?group=rtptsrc&descr=sfchourly&select='row // 1'&num=all¶m=id lat lon zs&pos=all"); // new // AddePointDataset("adde://adde.ucar.edu/point?group=rtptsrc&descr=sfchourly&num=all¶m=ID"); String loc = "adde://adde.ucar.edu/point?group=rtptsrc&descr=sfchourly&num=10"; StringBuffer sbuff = new StringBuffer(); sbuff.append(loc); sbuff.append("&num=all&select='"); makeSelectBB( sbuff, new LatLonRect(new LatLonPointImpl(10.0, 10.0), new LatLonPointImpl(20.0, 20.0))); sbuff.append("'"); test(sbuff.toString()); try { AddeStationObsDataset ads = new AddeStationObsDataset(loc, null); System.out.println(loc + " =\n" + ads); } catch (IOException e) { e.printStackTrace(); } }
private void makeSelectTime(StringBuffer sbuff, Date begin, Date end) { // McIDAS stores dates as two separate variables (generally DAY, TIME, but it could be CYD, // HMS). // In that case, you could do: DAY min max;TIME min max // However, this is problematic becuase it does not go from DAY/TIME min to DAY/TIM max, but // rather // from TIME min/max on each DAY. To do something like span from 22Z on one day to 4Z on the // other, you // need to have 2 separate ADDE requests: // DAY firstDay;TIME 22 23:59 // DAY secondDay;TIME 0 4 sbuff.append("DAY "); }
private static void makeSelectBB(StringBuffer sbuff, LatLonRect bb) { // LAT min max;LON min max // For ADDE URL's, lon is positive east, on the server, lon is positive west. // AddeURLConnection handles the conversion. // Format for lat/lon is either decimal degrees or DD:MM:SS LatLonPoint ll = bb.getLowerLeftPoint(); LatLonPoint ur = bb.getUpperRightPoint(); sbuff.append("LAT "); sbuff.append(ll.getLatitude()); sbuff.append(" "); sbuff.append(ur.getLatitude()); sbuff.append(";LON "); sbuff.append(ll.getLongitude()); sbuff.append(" "); sbuff.append(ur.getLongitude()); }