Revision: 33
http://netcdftools.svn.sourceforge.net/netcdftools/?rev=33&view=rev
Author: jdempsey
Date: 2010-06-24 10:06:59 +0000 (Thu, 24 Jun 2010)
Log Message:
-----------
ANDSWRON-664 - Add time_bnds variable
Modified Paths:
--------------
trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java
Modified: trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java
===================================================================
--- trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java 2010-06-24 01:53:22 UTC (rev 32)
+++ trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java 2010-06-24 10:06:59 UTC (rev 33)
@@ -166,6 +166,11 @@
private static final String LAT_AXIS = "Y";
private static final String LAT_LONG_NAME = "latitude";
+ // num values constants
+ private static final String NV = "nv";
+ private static final String NV_RANGE = "0-1";
+ private static final int NV_SIZE = 2;
+
// elevation constants
private static String ELEVATION = "elev";
private static int ELEVATION_COLUMN_INDEX = 3;
@@ -363,7 +368,8 @@
for (int i = 0; i < filenames.length; i++)
{
filenames[i] = this.generateLatitudeFilename(latitudeDegree, variableNames[i]);
- this.createVariableFile(filenames[i], Arrays.asList(LAT, LONG, TIME), i, TIME_SIZE, blockLatSize, blockLongSize);
+ this.createVariableFile(filenames[i], Arrays.asList(LAT, LONG, TIME, NV), i, TIME_SIZE, blockLatSize,
+ blockLongSize);
this.fillCoordinateVariables(filenames[i], sortedLongitudes, sortedLatitudes, dates, blockLatRange,
blockLongRange, TIME_RANGE);
this.fillSpatialVariables(filenames[i], triples);
@@ -429,7 +435,8 @@
filenames[i] = this.generateDecadeFilename(decadeStr, variableNames[i]);
if ("".equals(startingLatitude))
{
- this.createVariableFile(filenames[i], Arrays.asList(TIME, LAT, LONG), i, blockTimeSize, LAT_SIZE, LONG_SIZE);
+ this.createVariableFile(filenames[i], Arrays.asList(TIME, LAT, LONG, NV), i, blockTimeSize,
+ LAT_SIZE, LONG_SIZE);
this.fillCoordinateVariables(filenames[i], sortedLongitudes, sortedLatitudes, dates, blockLatRange,
blockLongRange, blockTimeRange);
this.fillSpatialVariables(filenames[i], triples);
@@ -555,6 +562,10 @@
{
command.execute(outputFileName, LONG, blockLongSize, false /* isUnlimited */, false/* fillValue */);
}
+ else if (dimName.equals(NV))
+ {
+ command.execute(outputFileName, NV, NV_SIZE, false /* isUnlimited */, false/* fillValue */);
+ }
}
}
@@ -581,6 +592,9 @@
new Attribute("long_name", TIME_LONG_NAME), new Attribute("standard_name", TIME_STANDARD_NAME),
new Attribute("axis", TIME_AXIS), new Attribute("calendar", TIME_CALENDAR), new Attribute("bounds",
TIME_BOUNDS)), TIME, false /* isLargeFileSupport */, false/* fillValue */);
+ command.execute(new File(outputFileName), TIME_BOUNDS, DataType.INT, Arrays.asList(new Attribute("units",
+ TIME_UNITS), new Attribute("calendar", TIME_CALENDAR)), NV, false /* isLargeFileSupport */,
+ false/* fillValue */);
}
/**
@@ -691,6 +705,17 @@
// call command to actually perform fill the file
command.execute(new File(outputFileName), TIME, timeRange, new ByteArrayInputStream(dateStringBuffer
.toString().getBytes(ENCODING)), false);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////
+ // File time_bnds variable
+ StringBuffer timeBoundsStringBuffer = new StringBuffer();
+ timeBoundsStringBuffer.append(dates.get(0)).append(System.getProperty("line.separator"));
+ timeBoundsStringBuffer.append(dates.get(dates.size()-1)).append(System.getProperty("line.separator"));
+
+ // call command to actually perform fill the file
+ command.execute(new File(outputFileName), TIME_BOUNDS, NV_RANGE, new ByteArrayInputStream(
+ timeBoundsStringBuffer.toString().getBytes(ENCODING)), false);
+
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|