Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cf anyPoint writer rework to use multiple altNames and timeNames #1275

Merged
merged 37 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
908ebec
write header outside of loop instead of using conditional count == 0
mnlerman Oct 24, 2023
1e4c664
add constructor to use timeName and altName
mnlerman Oct 24, 2023
adde5b3
generalize writeHeader method for Iterable<PointFeatureCollection> an…
mnlerman Oct 25, 2023
c87e309
failing tests but need to commit changes to switch branches
mnlerman Oct 25, 2023
33cbd26
write records with true alt and time names rather than generic ones
mnlerman Oct 26, 2023
260303a
Merge remote-tracking branch 'origin/cf-point-writer' into cf-point-w…
mnlerman Oct 30, 2023
77f55c7
Merge remote-tracking branch 'origin/cf-point-writer' into cf-point-w…
mnlerman Oct 30, 2023
02f0e05
need to add null check for timeUnit in constructor and add timeName a…
mnlerman Nov 17, 2023
3812e8c
spotless
mnlerman Nov 17, 2023
a42edd1
take out unnecessary arguments
mnlerman Nov 18, 2023
aa246ef
spotless
mnlerman Nov 18, 2023
024dd23
spotless
mnlerman Dec 7, 2023
fbe81f9
remove unused string formatter
mnlerman Dec 7, 2023
52746a6
override equals to make it meaningful
mnlerman Dec 7, 2023
2c4c165
use actual timename and altname for profiles
mnlerman Dec 8, 2023
229a52f
use actual timeName and altName
mnlerman Dec 12, 2023
5ac48c0
use actual timeName and altName
mnlerman Dec 14, 2023
6e1c826
use actual time and alt names
mnlerman Dec 14, 2023
a47fccd
add constructor with time and alt name arguments
mnlerman Dec 14, 2023
b93e962
use list of structs and get time and alt name from the station. Remov…
mnlerman Dec 14, 2023
80d345a
use list of structs for the feature data
mnlerman Dec 15, 2023
1d1ad5a
remove unused method
mnlerman Dec 15, 2023
dcfb1eb
use list of structs
mnlerman Dec 15, 2023
cabc689
remove references to headerDone. Get the altNames rather than relying…
mnlerman Dec 19, 2023
478a507
writer everything in loops instead of only writing the first one
mnlerman Dec 19, 2023
bbd8b75
uncomment assignments for timeName and altName
mnlerman Dec 19, 2023
cf647c1
remove ignores
mnlerman Dec 19, 2023
b468640
spotless
mnlerman Dec 19, 2023
c751cdc
null check for missing time axis
mnlerman Dec 19, 2023
0040407
spotless
mnlerman Dec 21, 2023
9b35ea4
Merge branch 'maint-5.x' into cf-point-writer
mnlerman Dec 21, 2023
4cb46d2
make write header public for use in tds
mnlerman Dec 21, 2023
c435773
can just call other writeHeader method instead of doing redundant work
mnlerman Dec 21, 2023
284a477
remove unnecessary conditional
mnlerman Dec 21, 2023
7289ff3
Merge remote-tracking branch 'origin/cf-point-writer' into cf-point-w…
mnlerman Dec 21, 2023
2ad5adc
make new public method private
mnlerman Dec 22, 2023
2be7692
Merge branch 'maint-5.x' into cf-point-writer
Dec 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ protected DsgCollectionImpl(String name, CalendarDateUnit timeUnit, String altUn
protected DsgCollectionImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName,
String altUnits) {
this.name = name;
// this.timeName = timeName;
this.timeName = timeName;
this.timeUnit = timeUnit;
// this.altName = altName;
this.altName = altName;
this.altUnits = altUnits;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ protected PointFeatureCCCImpl(String name, CalendarDateUnit timeUnit, String alt
this.collectionFeatureType = collectionFeatureType;
}

protected PointFeatureCCCImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName,
String altUnits, FeatureType collectionFeatureType) {
super(name, timeName, timeUnit, altName, altUnits);
this.collectionFeatureType = collectionFeatureType;
}

// All features in this collection have this feature type
@Nonnull
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ public ProfileFeatureImpl(String name, CalendarDateUnit timeUnit, String altUnit
}
}

public ProfileFeatureImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName, String altUnits,
double lat, double lon, double time, int nfeatures) {
super(name, timeName, timeUnit, altName, altUnits);
this.latlonPoint = LatLonPoint.create(lat, lon);
this.time = time;
if (nfeatures >= 0) {
getInfo(); // create the object
info.nfeatures = nfeatures;
}
}

@Override
@Nonnull
public LatLonPoint getLatLon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

public abstract class SectionCollectionImpl extends PointFeatureCCCImpl implements TrajectoryProfileFeatureCollection {

protected SectionCollectionImpl(String name, CalendarDateUnit timeUnit, String altUnits) {
super(name, timeUnit, altUnits, FeatureType.TRAJECTORY_PROFILE);
protected SectionCollectionImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName,
String altUnits) {
super(name, timeName, timeUnit, altName, altUnits, FeatureType.TRAJECTORY_PROFILE);
}

/////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

public abstract class SectionFeatureImpl extends PointFeatureCCImpl implements TrajectoryProfileFeature {

protected SectionFeatureImpl(String name, CalendarDateUnit timeUnit, String altUnits) {
super(name, timeUnit, altUnits, FeatureType.TRAJECTORY_PROFILE);
protected SectionFeatureImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName,
String altUnits) {
super(name, timeName, timeUnit, altName, altUnits, FeatureType.TRAJECTORY_PROFILE);
}

/////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public StationProfileCollectionImpl(String name, CalendarDateUnit timeUnit, Stri
super(name, timeUnit, altUnits, FeatureType.STATION_PROFILE);
}

public StationProfileCollectionImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName,
String altUnits) {
super(name, timeName, timeUnit, altName, altUnits, FeatureType.STATION_PROFILE);
}

// Double-check idiom for lazy initialization of instance fields. See Effective Java 2nd Ed, p. 283.
protected StationHelper getStationHelper() {
if (stationHelper == null) {
Expand Down Expand Up @@ -130,7 +135,7 @@ private static class StationProfileFeatureCollectionSubset extends StationProfil
private final List<StationFeature> stations;

StationProfileFeatureCollectionSubset(StationProfileCollectionImpl from, List<StationFeature> stations) {
super(from.getName(), from.getTimeUnit(), from.getAltUnits());
super(from.getName(), from.getTimeName(), from.getTimeUnit(), from.getAltName(), from.getAltUnits());
this.from = from;
this.stations = stations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ public int compareTo(@Nonnull Station so) {
return station.getName().compareTo(so.getName());
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof StationProfileFeatureImpl)) {
return false;
}

StationProfileFeatureImpl that = (StationProfileFeatureImpl) o;
return name.equals(that.name);
}

@Override
public int hashCode() {
return name.hashCode();
}

// @Override
public StationProfileFeature subset(LatLonRect boundingBox) {
return this; // only one station - we could check if its in the bb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
*/
public abstract class TrajectoryFeatureImpl extends PointCollectionImpl implements TrajectoryFeature {

public TrajectoryFeatureImpl(String name, String timeName, CalendarDateUnit timeUnit, String altName, String altUnits,
int nfeatures) {
super(name, timeName, timeUnit, altName, altUnits);
if (nfeatures >= 0) {
getInfo(); // create the object
info.nfeatures = nfeatures;
}
}

public TrajectoryFeatureImpl(String name, CalendarDateUnit timeUnit, String altUnits, int nfeatures) {
super(name, timeUnit, altUnits);
if (nfeatures >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ private class StandardProfileFeature extends ProfileFeatureImpl {
StructureData profileData;

StandardProfileFeature(Cursor cursor, double time, StructureData profileData) {
super(ft.getFeatureName(cursor), StandardProfileCollectionImpl.this.getTimeUnit(),
StandardProfileCollectionImpl.this.getAltUnits(), ft.getLatitude(cursor), ft.getLongitude(cursor), time, -1);
super(ft.getFeatureName(cursor), ft.getTimeName(), StandardProfileCollectionImpl.this.getTimeUnit(),
ft.getAltName(), StandardProfileCollectionImpl.this.getAltUnits(), ft.getLatitude(cursor),
ft.getLongitude(cursor), time, -1);

this.cursor = cursor;
this.profileData = profileData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class StandardSectionCollectionImpl extends SectionCollectionImpl {
private NestedTable ft;

StandardSectionCollectionImpl(NestedTable ft, CalendarDateUnit timeUnit, String altUnits) {
super(ft.getName(), timeUnit, altUnits);
super(ft.getName(), ft.getTimeName(), timeUnit, ft.getAltName(), altUnits);
this.ft = ft;
this.extras = ft.getExtras();
}
Expand Down Expand Up @@ -122,8 +122,8 @@ private class StandardSectionFeature extends SectionFeatureImpl {
StructureData sectionData;

StandardSectionFeature(Cursor cursor, StructureData sectionData) {
super(ft.getFeatureName(cursor), StandardSectionCollectionImpl.this.getTimeUnit(),
StandardSectionCollectionImpl.this.getAltUnits());
super(ft.getFeatureName(cursor), ft.getTimeName(), StandardSectionCollectionImpl.this.getTimeUnit(),
ft.getAltName(), StandardSectionCollectionImpl.this.getAltUnits());
this.cursor = cursor;
this.sectionData = sectionData;
}
Expand Down Expand Up @@ -201,8 +201,8 @@ private class StandardSectionProfileFeature extends ProfileFeatureImpl {
StructureData profileData;

StandardSectionProfileFeature(Cursor cursor, double time, StructureData profileData) {
super(ft.getFeatureName(cursor), StandardSectionCollectionImpl.this.getTimeUnit(),
StandardSectionCollectionImpl.this.getAltUnits(), ft.getLatitude(cursor), ft.getLongitude(cursor), time, -1);
super(ft.getFeatureName(cursor), ft.getTimeName(), ft.getTimeUnit(), ft.getAltName(), ft.getAltUnits(),
ft.getLatitude(cursor), ft.getLongitude(cursor), time, -1);

this.cursor = cursor;
this.profileData = profileData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ private class StandardStationFeatureImpl extends StationTimeSeriesFeatureImpl {
StructureData stationData;

StandardStationFeatureImpl(StationFeature s, CalendarDateUnit dateUnit, StructureData stationData, int recnum) {
super(s, StandardStationCollectionImpl.this.getTimeName(), dateUnit,
StandardStationCollectionImpl.this.getAltName(), StandardStationCollectionImpl.this.getAltUnits(), -1);
super(s, ft.getTimeName(), dateUnit, ft.getAltName(), ft.getAltUnits(), -1);
this.recnum = recnum;
this.stationData = stationData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class StandardStationProfileCollectionImpl extends StationProfileCollecti
private NestedTable ft;

StandardStationProfileCollectionImpl(NestedTable ft, CalendarDateUnit timeUnit, String altUnits) {
super(ft.getName(), timeUnit, altUnits);
super(ft.getName(), ft.getTimeName(), timeUnit, ft.getAltName(), altUnits);
this.ft = ft;
}

Expand Down Expand Up @@ -228,8 +228,8 @@ public boolean hasNext() throws IOException {
@Override
public PointFeatureCollection next() {
count++;
PointFeatureCollection result = new StandardProfileFeature(station, getTimeUnit(), getAltUnits(),
ft.getObsTime(cursor), cursor.copy(), profileData);
PointFeatureCollection result = new StandardProfileFeature(station, getTimeName(), getTimeUnit(), getAltName(),
getAltUnits(), ft.getObsTime(cursor), cursor.copy(), profileData);
prev = (DsgCollectionImpl) result;
return result;
}
Expand All @@ -247,10 +247,10 @@ private class StandardProfileFeature extends ProfileFeatureImpl {
private Cursor cursor;
StructureData profileData;

StandardProfileFeature(Station s, CalendarDateUnit timeUnit, String altUnits, double time, Cursor cursor,
StructureData profileData) {
super(timeUnit.makeCalendarDate(time).toString(), timeUnit, altUnits, s.getLatitude(), s.getLongitude(), time,
-1);
StandardProfileFeature(Station s, String timeName, CalendarDateUnit timeUnit, String altName, String altUnits,
double time, Cursor cursor, StructureData profileData) {
super(timeUnit.makeCalendarDate(time).toString(), timeName, timeUnit, altName, altUnits, s.getLatitude(),
s.getLongitude(), time, -1);
this.cursor = cursor;
this.profileData = profileData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected StandardTrajectoryCollectionImpl(String name, CalendarDateUnit timeUni
}

StandardTrajectoryCollectionImpl(NestedTable ft, CalendarDateUnit timeUnit, String altUnits) {
super(ft.getName(), timeUnit, altUnits, FeatureType.TRAJECTORY);
super(ft.getName(), ft.getTimeName(), timeUnit, ft.getAltName(), altUnits, FeatureType.TRAJECTORY);
this.ft = ft;
this.extras = ft.getExtras();
}
Expand All @@ -57,8 +57,8 @@ private class StandardTrajectoryFeature extends TrajectoryFeatureImpl {
StructureData trajData;

StandardTrajectoryFeature(Cursor cursor, StructureData trajData) {
super(ft.getFeatureName(cursor), StandardTrajectoryCollectionImpl.this.getTimeUnit(),
StandardTrajectoryCollectionImpl.this.getAltUnits(), -1);
super(ft.getFeatureName(cursor), ft.getTimeName(), StandardTrajectoryCollectionImpl.this.getTimeUnit(),
ft.getAltName(), StandardTrajectoryCollectionImpl.this.getAltUnits(), -1);
this.cursor = cursor;
this.trajData = trajData;
}
Expand Down
Loading
Loading