From: <jde...@us...> - 2010-06-25 11:30:18
|
Revision: 61 http://netcdftools.svn.sourceforge.net/netcdftools/?rev=61&view=rev Author: jdempsey Date: 2010-06-25 11:30:12 +0000 (Fri, 25 Jun 2010) Log Message: ----------- ANDSWRON-664 - Add time_bnds variable Modified Paths: -------------- trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioCConverter.java Modified: trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java =================================================================== --- trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java 2010-06-25 04:37:57 UTC (rev 60) +++ trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioAConverter.java 2010-06-25 11:30:12 UTC (rev 61) @@ -368,7 +368,7 @@ for (int i = 0; i < filenames.length; i++) { filenames[i] = this.generateLatitudeFilename(latitudeDegree, variableNames[i]); - this.createVariableFile(filenames[i], Arrays.asList(LAT, LONG, TIME, NV), i, TIME_SIZE, blockLatSize, + this.createVariableFile(filenames[i], Arrays.asList(LAT, LONG, TIME), i, TIME_SIZE, blockLatSize, blockLongSize); this.fillCoordinateVariables(filenames[i], sortedLongitudes, sortedLatitudes, dates, blockLatRange, blockLongRange, TIME_RANGE); @@ -425,6 +425,10 @@ int blockTimeSize = dates.size(); String blockTimeRange = "0-" + String.valueOf(dates.size() - 1); +// if (decadeKey > 189) +// { +// continue; +// } // create file names String decadeStr = String.valueOf(decadeKey + "0"); @@ -435,7 +439,7 @@ filenames[i] = this.generateDecadeFilename(decadeStr, variableNames[i]); if ("".equals(startingLatitude)) { - this.createVariableFile(filenames[i], Arrays.asList(TIME, LAT, LONG, NV), i, blockTimeSize, + this.createVariableFile(filenames[i], Arrays.asList(TIME, LAT, LONG), i, blockTimeSize, LAT_SIZE, LONG_SIZE); this.fillCoordinateVariables(filenames[i], sortedLongitudes, sortedLatitudes, dates, blockLatRange, blockLongRange, blockTimeRange); @@ -562,11 +566,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 */); - } } + + // Add NV as the final dimension + command.execute(outputFileName, NV, NV_SIZE, false /* isUnlimited */, false/* fillValue */); } /** @@ -707,7 +710,7 @@ .toString().getBytes(ENCODING)), false); // /////////////////////////////////////////////////////////////////////////////////////////// - // File time_bnds variable + // Fill 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")); Modified: trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioCConverter.java =================================================================== --- trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioCConverter.java 2010-06-25 04:37:57 UTC (rev 60) +++ trunk/src/main/java/au/csiro/netcdf/wron/MdbsyScenarioCConverter.java 2010-06-25 11:30:12 UTC (rev 61) @@ -155,7 +155,12 @@ private static final String LAT_STANDARD_NAME = "latitude"; 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; @@ -556,6 +561,9 @@ command.execute(outputFileName, LONG, blockLongSize, false /* isUnlimited */, false/* fillValue */); } } + + // Add NV as the final dimension + command.execute(outputFileName, NV, NV_SIZE, false /* isUnlimited */, false/* fillValue */); } /** @@ -581,6 +589,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 */); } /** @@ -688,6 +699,17 @@ // call command to actually perform fill the file command.execute(new File(outputFileName), TIME, timeRange, new ByteArrayInputStream(dateStringBuffer .toString().getBytes(ENCODING)), false); + + // /////////////////////////////////////////////////////////////////////////////////////////// + // Fill 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. |