@Override public String getWmoId() { return s.getWmoId(); }
@Override public String getWmoId() { return s.getWmoId(); }
public String getWmoId() { return s.getWmoId(); }
@Override public String getWmoId() { return s.getWmoId(); }
@Override public String getWmoId() { return station.getWmoId(); }
@Test public void testStationVarSingle() throws Exception { String file = TestDir.cdmLocalTestDataDir + "point/stationSingle.ncml"; Formatter buf = new Formatter(); try (FeatureDatasetPoint pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(ucar.nc2.constants.FeatureType.STATION, file, null, buf)) { List<DsgFeatureCollection> collectionList = pods.getPointFeatureCollectionList(); assert (collectionList.size() == 1) : "Can't handle point data with multiple collections"; DsgFeatureCollection fc = collectionList.get(0); assert fc instanceof StationTimeSeriesFeatureCollection; StationTimeSeriesFeatureCollection sc = (StationTimeSeriesFeatureCollection) fc; List<StationFeature> stations = sc.getStationFeatures(); assert (stations.size() > 0) : "No stations"; Station s = stations.get(0); assert s.getName().equals("666") : "name should be '666'"; assert !Double.isNaN(s.getAltitude()) : "No altitude on station"; assert s.getDescription() != null : "No description on station"; assert s.getDescription().equalsIgnoreCase("flabulous") : "description should equal 'flabulous'"; assert s.getWmoId() != null : "No wmoId on station"; assert s.getWmoId().equalsIgnoreCase("whoa") : "wmoId should equal 'whoa' but ='"+s.getWmoId()+"'"; } }
@Test public void testStationVarRagged() throws Exception { String file = TestDir.cdmLocalTestDataDir + "point/stationRaggedContig.ncml"; Formatter buf = new Formatter(); try (FeatureDatasetPoint pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(ucar.nc2.constants.FeatureType.STATION, file, null, buf)) { List<DsgFeatureCollection> collectionList = pods.getPointFeatureCollectionList(); assert (collectionList.size() == 1) : "Can't handle point data with multiple collections"; DsgFeatureCollection fc = collectionList.get(0); assert fc instanceof StationTimeSeriesFeatureCollection; StationTimeSeriesFeatureCollection sc = (StationTimeSeriesFeatureCollection) fc; List<StationFeature> stations = sc.getStationFeatures(); assert (stations.size() == 3) : "Should be 3 stations"; for (Station s : stations) { System.out.printf("%s%n", s); assert !Double.isNaN(s.getAltitude()) : "No altitude on station"; assert s.getDescription() != null && !s.getDescription().isEmpty() : "No description on station"; assert s.getWmoId() != null && !s.getWmoId().isEmpty() : "No wmoId on station"; } } }
@Test public void testStationVarMulti() throws Exception { String file = TestDir.cdmLocalTestDataDir + "point/stationMultidim.ncml"; Formatter buf = new Formatter(); try (FeatureDatasetPoint pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(ucar.nc2.constants.FeatureType.STATION, file, null, buf)) { List<DsgFeatureCollection> collectionList = pods.getPointFeatureCollectionList(); assert (collectionList.size() == 1) : "Can't handle point data with multiple collections"; DsgFeatureCollection fc = collectionList.get(0); assert fc instanceof StationTimeSeriesFeatureCollection; StationTimeSeriesFeatureCollection sc = (StationTimeSeriesFeatureCollection) fc; List<StationFeature> stations = sc.getStationFeatures(); assert (stations.size() == 5) : "Should be 5 stations"; for (Station s : stations) { System.out.printf("%s%n", s); assert !Double.isNaN(s.getAltitude()) : "No altitude on station"; assert s.getDescription() != null && !s.getDescription().isEmpty() : "No description on station"; assert s.getWmoId() != null && !s.getWmoId().isEmpty() : "No wmoId on station"; } } }
public static boolean equals(Station station1, Station station2) { if (station1 == station2) { return true; } else if (station1 == null || station2 == null) { return false; } if (!equals((EarthLocation) station1, station2)) { return false; } else if (!Objects.deepEquals(station1.getName(), station2.getName())) { return false; } else if (!Objects.deepEquals(station1.getWmoId(), station2.getWmoId())) { return false; } else if (!Objects.deepEquals(station1.getDescription(), station2.getDescription())) { return false; } else if (!Objects.deepEquals(station1.getNobs(), station2.getNobs())) { return false; } return true; }
static public PointStreamProto.StationList encodeStations(List<Station> stnList) throws IOException { PointStreamProto.StationList.Builder stnBuilder = PointStreamProto.StationList.newBuilder(); for (Station loc : stnList) { PointStreamProto.Station.Builder locBuilder = PointStreamProto.Station.newBuilder(); locBuilder.setId(loc.getName()); locBuilder.setLat(loc.getLatitude()); locBuilder.setLon(loc.getLongitude()); if (!Double.isNaN(loc.getAltitude())) locBuilder.setAlt(loc.getAltitude()); if (loc.getDescription() != null) locBuilder.setDesc(loc.getDescription()); if (loc.getWmoId() != null) locBuilder.setWmoId(loc.getWmoId()); stnBuilder.addStations(locBuilder); } return stnBuilder.build(); }
static public PointStreamProto.StationList encodeStations(List<Station> stnList) throws IOException { PointStreamProto.StationList.Builder stnBuilder = PointStreamProto.StationList.newBuilder(); for (Station loc : stnList) { PointStreamProto.Station.Builder locBuilder = PointStreamProto.Station.newBuilder(); locBuilder.setId(loc.getName()); locBuilder.setLat(loc.getLatitude()); locBuilder.setLon(loc.getLongitude()); if (!Double.isNaN(loc.getAltitude())) locBuilder.setAlt(loc.getAltitude()); if (loc.getDescription() != null) locBuilder.setDesc(loc.getDescription()); if (loc.getWmoId() != null) locBuilder.setWmoId(loc.getWmoId()); stnBuilder.addStations(locBuilder); } return stnBuilder.build(); }
public StationImpl( Station s, int nobs) { super(s.getLatitude(), s.getLongitude(), s.getAltitude()); setName(s.getName()); setDescription(s.getDescription()); setWmoId(s.getWmoId()); setNobs( nobs); }
if (useWmoId) wmoArray.setString(i, stn.getWmoId());
public StationImpl( Station s, int nobs) { super(s.getLatitude(), s.getLongitude(), s.getAltitude()); setName(s.getName()); setDescription(s.getDescription()); setWmoId(s.getWmoId()); setNobs( nobs); }
static public PointStreamProto.StationList encodeStations(List<Station> stnList) throws IOException { PointStreamProto.StationList.Builder stnBuilder = PointStreamProto.StationList.newBuilder(); for (Station loc : stnList) { PointStreamProto.Station.Builder locBuilder = PointStreamProto.Station.newBuilder(); locBuilder.setId(loc.getName()); locBuilder.setLat(loc.getLatitude()); locBuilder.setLon(loc.getLongitude()); locBuilder.setAlt(loc.getAltitude()); if (loc.getDescription() != null) locBuilder.setDesc(loc.getDescription()); if (loc.getWmoId() != null) locBuilder.setWmoId(loc.getWmoId()); stnBuilder.addStations(locBuilder); } return stnBuilder.build(); }
/** * Create an XML document from this info */ public Document makeStationCollectionDocument() throws IOException { Element rootElem = new Element("stationCollection"); Document doc = new Document(rootElem); List stns = sobs.getStations(); System.out.println("nstns = "+stns.size()); for (int i = 0; i < stns.size(); i++) { ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stns.get(i); Element sElem = new Element("station"); sElem.setAttribute("name",s.getName()); if (s.getWmoId() != null) sElem.setAttribute("wmo_id",s.getWmoId()); if (s.getDescription() != null) sElem.addContent(new Element("description").addContent(s.getDescription())); sElem.addContent(new Element("longitude").addContent( ucar.unidata.util.Format.d(s.getLongitude(), 6))); sElem.addContent(new Element("latitide").addContent( ucar.unidata.util.Format.d(s.getLatitude(), 6))); if (!Double.isNaN(s.getAltitude())) sElem.addContent(new Element("altitude").addContent( ucar.unidata.util.Format.d(s.getAltitude(), 6))); rootElem.addContent(sElem); } return doc; }
/** * Create an XML document from this info */ public Document makeStationCollectionDocument() throws IOException { Element rootElem = new Element("stationCollection"); Document doc = new Document(rootElem); List stns = sobs.getStations(); System.out.println("nstns = "+stns.size()); for (int i = 0; i < stns.size(); i++) { ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stns.get(i); Element sElem = new Element("station"); sElem.setAttribute("name",s.getName()); if (s.getWmoId() != null) sElem.setAttribute("wmo_id",s.getWmoId()); if (s.getDescription() != null) sElem.addContent(new Element("description").addContent(s.getDescription())); sElem.addContent(new Element("longitude").addContent( ucar.unidata.util.Format.d(s.getLongitude(), 6))); sElem.addContent(new Element("latitide").addContent( ucar.unidata.util.Format.d(s.getLatitude(), 6))); if (!Double.isNaN(s.getAltitude())) sElem.addContent(new Element("altitude").addContent( ucar.unidata.util.Format.d(s.getAltitude(), 6))); rootElem.addContent(sElem); } return doc; }
/** * Create an XML document from this info */ public Document makeStationCollectionDocument() throws IOException { Element rootElem = new Element("stationCollection"); Document doc = new Document(rootElem); List stns = sobs.getStations(); System.out.println("nstns = "+stns.size()); for (int i = 0; i < stns.size(); i++) { ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stns.get(i); Element sElem = new Element("station"); sElem.setAttribute("name",s.getName()); if (s.getWmoId() != null) sElem.setAttribute("wmo_id",s.getWmoId()); if (s.getDescription() != null) sElem.addContent(new Element("description").addContent(s.getDescription())); sElem.addContent(new Element("longitude").addContent( ucar.unidata.util.Format.d(s.getLongitude(), 6))); sElem.addContent(new Element("latitide").addContent( ucar.unidata.util.Format.d(s.getLatitude(), 6))); if (!Double.isNaN(s.getAltitude())) sElem.addContent(new Element("altitude").addContent( ucar.unidata.util.Format.d(s.getAltitude(), 6))); rootElem.addContent(sElem); } return doc; }
if (useWmoId) wmoArray.set(i, stn.getWmoId());
if (useWmoId) wmoArray.set(i, stn.getWmoId());