Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
JmaTables;
Browse files Browse the repository at this point in the history
Unit tests;
  • Loading branch information
JohnLCaron committed Jun 25, 2015
1 parent 60b609a commit f951977
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
12 changes: 12 additions & 0 deletions cdm-test/src/test/java/ucar/nc2/grib/TestGribIndexCreation.java
Expand Up @@ -151,6 +151,18 @@ public void testGFS_2p5deg() throws IOException {
System.out.printf("changed = %s%n", changed);
}

@Test
public void testSeanProblem() throws IOException {


FeatureCollectionConfig config = new FeatureCollectionConfig("gfs_2p5deg", "test/gfs_2p5deg", FeatureCollectionType.GRIB2,
TestDir.cdmUnitTestDir + "gribCollections/gfs_2p5deg/.*grib2", null, null, null, "file", null);

org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("test");
boolean changed = GribCdmIndex.updateGribCollection(config, updateMode, logger);
System.out.printf("changed = %s%n", changed);
}

@Test
public void testEnsembles() throws IOException {
FeatureCollectionConfig config = new FeatureCollectionConfig("gefs_ens", "test/gefs_ens", FeatureCollectionType.GRIB2,
Expand Down
19 changes: 16 additions & 3 deletions grib/src/main/java/ucar/nc2/grib/grib1/tables/JmaTables.java
Expand Up @@ -35,12 +35,10 @@
import ucar.nc2.grib.GribLevelType;
import ucar.nc2.grib.GribNumbers;
import ucar.nc2.grib.GribStatType;
import ucar.nc2.grib.VertCoord;
import ucar.nc2.grib.grib1.Grib1ParamLevel;
import ucar.nc2.grib.grib1.Grib1ParamTime;
import ucar.nc2.grib.grib1.Grib1SectionProductDefinition;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -90,7 +88,17 @@ public Grib1ParamTime getParamTime(Grib1SectionProductDefinition pds) {
end = p2;
break;

/* Temporal variance of N uninitialized analyses (P1 = 0) or instantaneous forecasts (P1 > 0);
/* 130: Average of N forecast products; valid time of the first product ranges between R + P1 and R + P2, where R is reference time given in octets 13 to 17,
then subsequent products have valid time range at interval of P2 - P1; thus all N products cover continuous time span; products have reference times at
intervals of P2 - P1, beginning at the given reference time
*/
case 130:
isInterval = true;
start = p1;
end = (n > 0) ? p1 + n * (p2 - p1) : p2; // prob n >= 1
break;

/* Temporal variance of N uninitialized analyses (P1 = 0) or instantaneous forecasts (P1 > 0);
each product has valid time at the reference time + P1;
products have reference times at intervals of P2, beginning at the given reference time;
unit of measurement is square of that in Code Table 2 */ // LOOK
Expand All @@ -113,6 +121,8 @@ public String getTimeTypeName(int timeRangeIndicator) {
switch (timeRangeIndicator) {
case 129:
return "Temporal variance of N forecasts at 24 hour intervals";
case 130:
return "Average of N forecast products at intervals of P1 - P2";
case 131:
return "Temporal variance of N forecasts at intervals of P1 - P2";
case 132:
Expand All @@ -126,6 +136,9 @@ public String getTimeTypeName(int timeRangeIndicator) {
@Override
public GribStatType getStatType(int timeRangeIndicator) {
switch (timeRangeIndicator) {
case 130:
return GribStatType.Average;

case 129:
case 131:
case 132:
Expand Down
4 changes: 3 additions & 1 deletion it/src/test/java/thredds/server/wcs/TestWcsServer.java
Expand Up @@ -91,6 +91,8 @@ public void testGetCapabilites() throws IOException, JDOMException {
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(in);

System.out.printf("%s%n", xml);

//XPathExpression<Element> xpath = XPathFactory.instance().compile("ns:/WCS_Capabilities/ContentMetadata/CoverageOfferingBrief", Filters.element(), null, NS_WCS);
XPathExpression<Element> xpath = XPathFactory.instance().compile("//wcs:CoverageOfferingBrief", Filters.element(), null, NS_WCS);
List<Element> elements = xpath.evaluate(doc);
Expand All @@ -102,7 +104,7 @@ public void testGetCapabilites() throws IOException, JDOMException {
XPathExpression<Element> xpath2 =
XPathFactory.instance().compile("//wcs:CoverageOfferingBrief/wcs:name", Filters.element(), null, NS_WCS);
Element emt = xpath2.evaluateFirst(doc);
assertEquals("Pressure_reduced_to_MSL", emt.getTextTrim());
assertEquals("Relative_humidity_height_above_ground", emt.getTextTrim()); // lame
}

@HttpTest(method = Method.GET, path = "/wcs/cdmUnitTest/conventions/coards/sst.mnmean.nc?request=DescribeCoverage&version=1.0.0&service=WCS&coverage=sst")
Expand Down
Expand Up @@ -92,6 +92,7 @@ public void setUp() throws IOException {
String next = it.next();
varParamVal = varParamVal + "," + next;
}
System.out.printf("path=%s vars=%s point=%s%n", pathInfo, varParamVal, point);

//Values for time subsetting
String datasetPath = AbstractNcssController.getDatasetPath(this.pathInfo);
Expand Down

0 comments on commit f951977

Please sign in to comment.