Skip to content

Commit

Permalink
remove flags for applying runtime loaded Enhancements and group them …
Browse files Browse the repository at this point in the history
…all in one
  • Loading branch information
haileyajohnson committed Oct 15, 2024
1 parent 431a142 commit 3b509f6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
18 changes: 1 addition & 17 deletions cdm/core/src/main/java/ucar/nc2/dataset/NetcdfDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,6 @@ public enum Enhance {
* every dimension in a variable has a corresponding coordinate variable.
*/
IncompleteCoordSystems,
/**
* Calculate mean and standard deviation and apply to data: (z-mean)/standard_deviation.
* If the enhanced data type is not {@code FLOAT} or {@code DOUBLE}, this has no effect.
*/
ApplyStandardizer,
/**
* Calculate minimum value and range (maximum - minimum) and apply to data: (z - min)/range.
* If the enhanced data type is not {@code FLOAT} or {@code DOUBLE}, this has no effect.
*/
ApplyNormalizer,
/**
* Classify doubles or floats based on positive/negative into 1 or 0 {@code}
* x<0 --> 0 x>0 --> 1
*/
ApplyClassifier,
/**
* All other Enhancement implementations that are loaded by service provider
* This includes third party implementations found on the classpath and loaded at runtime.
Expand All @@ -139,8 +124,7 @@ public enum Enhance {

private static Set<Enhance> EnhanceAll =
Collections.unmodifiableSet(EnumSet.of(Enhance.ConvertEnums, Enhance.ConvertUnsigned, Enhance.ApplyScaleOffset,
Enhance.ConvertMissing, Enhance.CoordSystems, Enhance.ApplyStandardizer, Enhance.ApplyNormalizer,
Enhance.ApplyClassifier, Enhance.ApplyRuntimeLoadedEnhancements));
Enhance.ConvertMissing, Enhance.CoordSystems, Enhance.ApplyRuntimeLoadedEnhancements));
private static Set<Enhance> EnhanceNone = Collections.unmodifiableSet(EnumSet.noneOf(Enhance.class));
private static Set<Enhance> defaultEnhanceMode = EnhanceAll;

Expand Down
2 changes: 1 addition & 1 deletion cdm/core/src/main/java/ucar/nc2/filter/Classifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public String getAttributeName() {

@Override
public boolean appliesTo(Set<Enhance> enhance, DataType dt) {
return enhance.contains(Enhance.ApplyClassifier) && dt.isNumeric();
return dt.isNumeric();
}

@Override
Expand Down
4 changes: 1 addition & 3 deletions cdm/core/src/main/java/ucar/nc2/filter/Normalizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,14 @@ public String getAttributeName() {

@Override
public boolean appliesTo(Set<Enhance> enhance, DataType dt) {
return enhance.contains(Enhance.ApplyNormalizer) && dt.isFloatingPoint();
return dt.isFloatingPoint();
}

@Override
public Normalizer create(VariableDS var) {
return Normalizer.createFromVariable(var);
}



}

}
2 changes: 1 addition & 1 deletion cdm/core/src/main/java/ucar/nc2/filter/Standardizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public String getAttributeName() {

@Override
public boolean appliesTo(Set<Enhance> enhance, DataType dt) {
return enhance.contains(Enhance.ApplyStandardizer) && dt.isFloatingPoint();
return dt.isFloatingPoint();
}

@Override
Expand Down

0 comments on commit 3b509f6

Please sign in to comment.