Skip to content

Commit

Permalink
Fix the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
matakleo authored and haileyajohnson committed Jul 17, 2024
1 parent 74f6a03 commit 7ee573e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 98 deletions.
4 changes: 1 addition & 3 deletions cdm/core/src/main/java/ucar/nc2/dataset/VariableDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,10 @@ private void createEnhancements() {
}
this.dataType = scaleOffset != null ? scaleOffset.getScaledOffsetType() : this.dataType;
}
/** how oh how ??? */
for (Enhance enhance : this.enhanceMode) {
for (EnhancementProvider service : ServiceLoader.load(EnhancementProvider.class)) {
/** Stand and Norm require floatingpoint, buc classifier can do just numeric? */
if (service.appliesTo(enhance, this.attributes(), dataType)) {
loadedEnhancements.add(service.returnObject(this));
loadedEnhancements.add(service.Create(this));
}
}
}
Expand Down
27 changes: 2 additions & 25 deletions cdm/core/src/main/java/ucar/nc2/filter/Classifier.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
package ucar.nc2.filter;


import java.util.Map;
import java.util.Set;
import ucar.ma2.Array;
import ucar.ma2.IndexIterator;
import ucar.nc2.Variable;
import ucar.nc2.constants.CDM;
import ucar.nc2.Attribute;
import ucar.nc2.dataset.NetcdfDataset.Enhance;
import ucar.nc2.dataset.VariableDS;
import ucar.nc2.util.Misc;
import java.util.ArrayList;
import java.util.List;
import ucar.unidata.io.spi.RandomAccessFileProvider;



import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import ucar.ma2.*;
import ucar.nc2.*;
import ucar.nc2.constants.CDM;
import ucar.nc2.dataset.NetcdfDataset.Enhance;
import ucar.nc2.filter.*;
import ucar.nc2.internal.dataset.CoordinatesHelper;
import ucar.nc2.util.CancelTask;
import ucar.nc2.util.Misc;

import javax.annotation.Nullable;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;

public class Classifier implements Enhancement {

Expand Down Expand Up @@ -148,17 +128,14 @@ public static int[] stringToIntArray(String str) {
public static class Provider implements EnhancementProvider {


@Override
public String getName() {
return name;
}

@Override
public boolean appliesTo(Enhance enhance, AttributeContainer attributes, DataType dt) {
return enhance == Enhance.ApplyClassifier && attributes.findAttribute(CDM.CLASSIFY) != null && dt.isNumeric();
}

public Classifier returnObject(VariableDS var) {
@Override
public Classifier Create(VariableDS var) {
return createFromVariable(var);
}
}
Expand Down
22 changes: 2 additions & 20 deletions cdm/core/src/main/java/ucar/nc2/filter/EnhancementProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,21 @@

package ucar.nc2.filter;

import java.util.Map;
// package ucar.nc2.dataset;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import ucar.ma2.*;
import ucar.nc2.*;
import ucar.nc2.constants.CDM;
import ucar.nc2.dataset.NetcdfDataset.Enhance;
import ucar.nc2.dataset.VariableDS;
import ucar.nc2.filter.*;
import ucar.nc2.internal.dataset.CoordinatesHelper;
import ucar.nc2.util.CancelTask;
import ucar.nc2.util.Misc;

import javax.annotation.Nullable;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;

/**
* A Service Provider of {@link Filter}.
* A Service Provider of {@link Enhancement}.
*/
public interface EnhancementProvider {

String getName();

boolean appliesTo(Enhance enhance, AttributeContainer attributes, DataType dt);

Enhancement returnObject(VariableDS var);

Enhancement Create(VariableDS var);

// void applyEnhancement(Object instance);

}

Expand Down
6 changes: 1 addition & 5 deletions cdm/core/src/main/java/ucar/nc2/filter/Normalizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ public double getRange() {

public static class Provider implements EnhancementProvider {

@Override
public String getName() {
return name;
}

@Override
public boolean appliesTo(Enhance enhance, AttributeContainer attributes, DataType dt) {
Expand All @@ -91,7 +87,7 @@ public boolean appliesTo(Enhance enhance, AttributeContainer attributes, DataTyp
}

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

Expand Down
6 changes: 0 additions & 6 deletions cdm/core/src/main/java/ucar/nc2/filter/ScaleOffset.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,6 @@ public Filter create(Map<String, Object> properties) {
return new ScaleOffset(properties);
}

// @Override
// public void doSomething(double val) {
// System.out.println("SCALEOFFSET ! "+val);
// }


}


Expand Down
7 changes: 1 addition & 6 deletions cdm/core/src/main/java/ucar/nc2/filter/Standardizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ public double getStdDev() {

public static class Provider implements EnhancementProvider {

@Override
public String getName() {
return name;
}


@Override
public boolean appliesTo(Enhance enhance, AttributeContainer attributes, DataType dt) {
Expand All @@ -94,7 +89,7 @@ public boolean appliesTo(Enhance enhance, AttributeContainer attributes, DataTyp
}

@Override
public Standardizer returnObject(VariableDS var) {
public Standardizer Create(VariableDS var) {
return createFromVariable(var);
}
}
Expand Down

This file was deleted.

0 comments on commit 7ee573e

Please sign in to comment.