public StationImpl( Station s, int nobs) { super(s.getLatitude(), s.getLongitude(), s.getAltitude()); setName(s.getName()); setDescription(s.getDescription()); setWmoId(s.getWmoId()); setNobs( nobs); }
@Override public LatLonPoint getLatLon() { return s.getLatLon(); }
public StationProfileFeatureImpl(Station s, DateUnit timeUnit, int npts) { super( s.getName(), FeatureType.STATION_PROFILE); this.s = s; this.timeUnit = timeUnit; this.timeSeriesNpts = npts; }
if (!Double.isNaN(stn.getAltitude())) useAlt = true; if ((stn.getWmoId() != null) && (stn.getWmoId().trim().length() > 0)) useWmoId = true; if ((stn.getDescription() != null) && (stn.getDescription().trim().length() > 0)) useDesc = true; id_strlen = Math.max(id_strlen, stn.getName().length()); if (stn.getDescription() != null) desc_strlen = Math.max(desc_strlen, stn.getDescription().length()); if (stn.getWmoId() != null) wmo_strlen = Math.max(wmo_strlen, stn.getWmoId().length());
private LatLonRect getBoundingBox(List stnList) { ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stnList.get(0); LatLonPointImpl llpt = new LatLonPointImpl(); llpt.set(s.getLatitude(), s.getLongitude()); LatLonRect rect = new LatLonRect(llpt, .001, .001); for (int i = 1; i < stnList.size(); i++) { s = (ucar.unidata.geoloc.Station) stnList.get(i); llpt.set(s.getLatitude(), s.getLongitude()); rect.extend(llpt); } return rect; }
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; }
@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"; } } }
@Override public String getWmoId() { return s.getWmoId(); }
@Override public String getDescription() { return s.getDescription(); }
@Override public double getAltitude() { return s.getAltitude(); }
@Override public double getLongitude() { return s.getLongitude(); }
@Override public double getLatitude() { return s.getLatitude(); }
public StationProfileFeatureImpl(Station s, CalendarDateUnit timeUnit, String altUnits, int npts) { super( s.getName(), timeUnit, altUnits, FeatureType.STATION_PROFILE); this.station = s; this.timeSeriesNpts = npts; }
@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()+"'"; } }
private LatLonRect getBoundingBox(List stnList) { ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stnList.get(0); LatLonPointImpl llpt = new LatLonPointImpl(); llpt.set(s.getLatitude(), s.getLongitude()); LatLonRect rect = new LatLonRect(llpt, .001, .001); for (int i = 1; i < stnList.size(); i++) { s = (ucar.unidata.geoloc.Station) stnList.get(i); llpt.set(s.getLatitude(), s.getLongitude()); rect.extend(llpt); } return rect; }
@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"; } } }
@Override public String getWmoId() { return s.getWmoId(); }
@Override public String getDescription() { return s.getDescription(); }