Skip to content

Commit

Permalink
Merge pull request #1163 from haileyajohnson/scale-offset
Browse files Browse the repository at this point in the history
refactor implementation of scale/offset, unsigned conversion, and convert missing
  • Loading branch information
haileyajohnson authored Jul 6, 2023
2 parents 62a0fda + 940cc63 commit 34e722a
Show file tree
Hide file tree
Showing 20 changed files with 1,028 additions and 877 deletions.
5 changes: 0 additions & 5 deletions cdm-test/src/test/java/ucar/nc2/TestSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ucar.ma2.*;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.nc2.dataset.NetcdfDatasets;
import ucar.unidata.util.test.category.NeedsCdmUnitTest;
import ucar.unidata.util.test.TestDir;
import java.io.File;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.List;

Expand All @@ -56,7 +52,6 @@
* @since Nov 10, 2009
*/
public class TestSequence {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Test
@Category(NeedsCdmUnitTest.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ucar.nc2.NetcdfFile;
import ucar.nc2.constants.FeatureType;
import ucar.nc2.dataset.NetcdfDatasets;
Expand All @@ -16,7 +14,6 @@
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -28,7 +25,6 @@
*/
@RunWith(Parameterized.class)
public class TestCfDocDsgExamples {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String cfDocDsgExamplesDir = TestDir.cdmLocalFromTestDataDir + "cfDocDsgExamples/";

private static List<Object[]> getPointDatasets() {
Expand Down
4 changes: 2 additions & 2 deletions cdm/core/src/main/java/ucar/nc2/NetcdfFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public static NetcdfFile open(String location, int buffer_size, ucar.nc2.util.Ca
* @param buffer_size RandomAccessFile buffer size, if <= 0, use default size
* @param cancelTask allow task to be cancelled; may be null.
* @param iospMessage special iosp tweaking (sent before open is called), may be null
* @return NetcdfFile object, or null if cant find IOServiceProver
* @return NetcdfFile object, or null if can't find IOServiceProver
* @throws IOException if error
*/
public static NetcdfFile open(String location, int buffer_size, ucar.nc2.util.CancelTask cancelTask,
Expand All @@ -290,7 +290,7 @@ public static NetcdfFile open(String location, int buffer_size, ucar.nc2.util.Ca
* @param iospMessage special iosp tweaking (sent before open is called), may be null
* @return NetcdfFile object, or null if cant find IOServiceProver
* @throws IOException if read error
* @throws ClassNotFoundException cannat find iospClassName in thye class path
* @throws ClassNotFoundException cannot find iospClassName in the class path
* @throws InstantiationException if class cannot be instantiated
* @throws IllegalAccessException if class is not accessible
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
* <li>Values will be {@link DataType#widenNumber widened}, which effectively reinterprets signed data as unsigned
* data.</li>
* <li>To accommodate the unsigned conversion, the variable's data type will be changed to the
* {@link EnhanceScaleMissingUnsignedImpl#nextLarger(DataType) next larger type}.</li>
* {@link ucar.nc2.filter.FilterHelpers#nextLarger(DataType) next larger type}.</li>
* </ol>
*
* <h3>Implementation rules for scale/offset</h3>
*
* <ol>
* <li>If scale_factor and/or add_offset variable attributes are present, then this is a "packed" Variable.</li>
* <li>The data type of the variable will be set to the {@link EnhanceScaleMissingUnsignedImpl#largestOf largest of}:
* <li>The data type of the variable will be set to the {@link ucar.nc2.filter.FilterHelpers#largestOf largest of}:
* <ul>
* <li>the original data type</li>
* <li>the unsigned conversion type, if applicable</li>
Expand Down Expand Up @@ -117,7 +117,9 @@
*
* @author caron
* @author cwardgar
* @deprecated use implementations in Filter package
*/
@Deprecated
public interface EnhanceScaleMissingUnsigned extends IsMissingEvaluator {
/** true if Variable data will be converted using scale and offset */
boolean hasScaleOffset();
Expand Down
Loading

0 comments on commit 34e722a

Please sign in to comment.