Skip to content

Commit 5e347db

Browse files
author
Bob Simons
committed
v2.16
1 parent 617c2d5 commit 5e347db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+736
-505
lines changed

WEB-INF/ArchiveADataset.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ rem This is the Windows batch file to run ArchiveADataset.
22
rem See http://coastwatch.pfeg.noaa.gov/erddap/download/setupDatasetsXml.html#Tools
33

44
rem You'll need to change java's path to make this work:
5-
C:\programs\jdk8u292-b10\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1500M -Xmx1500M gov.noaa.pfel.erddap.ArchiveADataset %*
5+
C:\programs\jdk8u312-b07\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1500M -Xmx1500M gov.noaa.pfel.erddap.ArchiveADataset %*

WEB-INF/DasDds.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ rem This is the Windows batch file to run DasDds.
22
rem See http://coastwatch.pfeg.noaa.gov/erddap/download/setupDatasetsXml.html#Tools
33

44
# You'll need to change java's path to make this work:
5-
C:\programs\jdk8u292-b10\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1000M -Xmx1000M gov.noaa.pfel.erddap.DasDds %*
5+
C:\programs\jdk8u312-b07\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1000M -Xmx1000M gov.noaa.pfel.erddap.DasDds %*

WEB-INF/FindDuplicateTime.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ rem Parameters: directory fileNameRegex timeVarName
55
rem This is recursive.
66
rem Written by Bob Simons original 2021-01-20
77

8-
C:\programs\jdk8u292-b10\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1300M -Xmx1300M -verbose:gc gov.noaa.pfel.erddap.dataset.FindDuplicateTime %*
8+
C:\programs\jdk8u312-b07\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1300M -Xmx1300M -verbose:gc gov.noaa.pfel.erddap.dataset.FindDuplicateTime %*

WEB-INF/GenerateDatasetsXml.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ rem This is the Windows batch file to run GenerateDatasetsXml.
22
rem See http://coastwatch.pfeg.noaa.gov/erddap/download/setupDatasetsXml.html#Tools
33

44
rem You'll need to change java's path to make this work:
5-
C:\programs\jdk8u292-b10\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1000M -Xmx1000M gov.noaa.pfel.erddap.GenerateDatasetsXml %*
5+
C:\programs\jdk8u312-b07\bin\java.exe -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1000M -Xmx1000M gov.noaa.pfel.erddap.GenerateDatasetsXml %*

WEB-INF/NetCheck.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ rem Then run this from an MS-DOS Prompt (command line) window.
44
# Use "NetCheck -testMode" to just send emails to the NetCheck administrator.
55

66
set thisDir=%~dp0
7-
java -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1000M -Xmx1000M gov.noaa.pfel.coastwatch.netcheck.NetCheck NetCheck.xml %*
7+
java -cp classes;../../../lib/servlet-api.jar;lib/* -Xms1400M -Xmx1400M gov.noaa.pfel.coastwatch.netcheck.NetCheck NetCheck.xml %*

WEB-INF/NetCheck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
commandLine=$0
99
tDir=`echo $commandLine | dirname $0`
1010

11-
java -cp classes:../../../lib/servlet-api.jar:lib/* -Xms1000M -Xmx1000M gov.noaa.pfel.coastwatch.netcheck.NetCheck NetCheck.xml "$@"
11+
java -cp classes:../../../lib/servlet-api.jar:lib/* -Xms1400M -Xmx1400M gov.noaa.pfel.coastwatch.netcheck.NetCheck NetCheck.xml "$@"

WEB-INF/classes/com/cohort/array/StringArray.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,16 @@ public StringArray(Map map) {
294294
} */
295295

296296
/**
297-
* This reads the text contents of the specified file using this computer's default charset.
298-
*
297+
* This reads the text contents of the specified file using File2.ISO_8859_1.
299298
*/
300-
public static StringArray fromFile(String fileName) throws Exception {
301-
302-
return fromFile(fileName, null);
299+
public static StringArray fromFile88591(String fileName) throws Exception {
300+
return fromFile(fileName, File2.ISO_8859_1);
301+
}
302+
/**
303+
* This reads the text contents of the specified file using File2.UTF_8.
304+
*/
305+
public static StringArray fromFileUtf8(String fileName) throws Exception {
306+
return fromFile(fileName, File2.UTF_8);
303307
}
304308

305309

@@ -2508,11 +2512,12 @@ public int[] getNMinMaxIndex() {
25082512
*
25092513
* @param fileName1 a complete file name
25102514
* @param fileName2 a complete file name
2515+
* @param charset e.g., File2.ISO_8859_1 or File2.UTF_8.
25112516
* @throws Exception if files are different
25122517
*/
2513-
public static void diff(String fileName1, String fileName2) throws Exception {
2514-
StringArray sa1 = fromFile(fileName1);
2515-
StringArray sa2 = fromFile(fileName2);
2518+
public static void diff(String fileName1, String fileName2, String charset) throws Exception {
2519+
StringArray sa1 = fromFile(fileName1, charset);
2520+
StringArray sa2 = fromFile(fileName2, charset);
25162521
sa1.diff(sa2);
25172522
}
25182523

@@ -2523,15 +2528,16 @@ public static void diff(String fileName1, String fileName2) throws Exception {
25232528
*
25242529
* @param fileName1 a complete file name
25252530
* @param fileName2 a complete file name
2531+
* @param charset e.g., File2.ISO_8859_1 or File2.UTF_8.
25262532
* @throws Exception if files are different
25272533
*/
2528-
public static void repeatedDiff(String fileName1, String fileName2) throws Exception {
2534+
public static void repeatedDiff(String fileName1, String fileName2, String charset) throws Exception {
25292535
while (true) {
25302536
try {
25312537
String2.log("\nComparing " + fileName1 +
25322538
"\n and " + fileName2);
2533-
StringArray sa1 = fromFile(fileName1);
2534-
StringArray sa2 = fromFile(fileName2);
2539+
StringArray sa1 = fromFile(fileName1, charset);
2540+
StringArray sa2 = fromFile(fileName2, charset);
25352541
sa1.diff(sa2);
25362542
String2.log("!!! The files are the same!!!");
25372543
break;

WEB-INF/classes/com/cohort/util/TestUtil.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,10 +1887,10 @@ public static void testString2() throws Throwable {
18871887
//for (int i = 0; i < 10000000; i++)
18881888
// sb.append("a");
18891889
//String s9 = sb2.toString();
1890-
//File2.writeToFile(fileName, s9); //warm up
1891-
//File2.writeToFile(fileName, s9);
1890+
//File2.writeToFile88591(fileName, s9); //warm up
1891+
//File2.writeToFile88591(fileName, s9);
18921892
//long tTime = System.currentTimeMillis();
1893-
//File2.writeToFile(fileName, s9);
1893+
//File2.writeToFile88591(fileName, s9);
18941894
//String2.log("time=" + (System.currentTimeMillis() - tTime));
18951895
//sb2 = null;
18961896
//s9 = null;
@@ -2973,13 +2973,13 @@ public static void interactiveTestCalendar2() throws Exception {
29732973
"\nOracle Java versus AdoptOpenJDK may be slightly different for these.");
29742974
}
29752975

2976-
String2.log("getCurrentISODateTimeString = " + Calendar2.formatAsISODateTimeT(Calendar2.newGCalendarLocal()));
2977-
String2.log(" *** Check that HOUR accounts for daylight saving time!\n");
2978-
String2.log("current UTC time = " + Calendar2.formatAsISODateTimeT(Calendar2.newGCalendarZulu()));
2979-
String2.log(" *** Check that HOUR is local+7 in summer (DST), local+8 in winter (in California).");
2980-
String2.log(" See current UTC time at http://www.xav.com/time.cgi");
2981-
String2.pressEnterToContinue();
2982-
2976+
String2.pressEnterToContinue(
2977+
"getCurrentISODateTimeString = " + Calendar2.formatAsISODateTimeT(Calendar2.newGCalendarLocal()) +
2978+
" *** Check that HOUR accounts for daylight saving time!\n\n" +
2979+
"current UTC time = " + Calendar2.formatAsISODateTimeT(Calendar2.newGCalendarZulu()) + "\n" +
2980+
" *** Check that HOUR is local+7 in summer (DST), local+8 in winter (in California)\n" +
2981+
" or local+4 in summer (DST), local+5 in winter (on East Coast).\n" +
2982+
" See current UTC time at http://www.xav.com/time.cgi");
29832983
}
29842984

29852985
/**

WEB-INF/classes/com/cohort/util/Units2.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ public static HashMap<String, String> getHashMapStringString(String fileName, St
17961796
*/
17971797
public static void checkUdunits2File(String fileName) throws Exception {
17981798
String2.log("\n*** Units2.checkUdUnits2File " + fileName);
1799-
StringArray sa = StringArray.fromFile(fileName);
1799+
StringArray sa = StringArray.fromFileUtf8(fileName);
18001800
StringArray names = new StringArray();
18011801
int n = sa.size();
18021802
int nDef = 0, nPlural = 0, nSingular = 0, nSymbol = 0;
@@ -1952,7 +1952,7 @@ public static StringArray getTestUdunits() throws Exception {
19521952
f == 1? "datasetsFEDCW.xml" :
19531953
"uniqueCFUnits.txt");
19541954

1955-
ArrayList<String> lines = File2.readLinesFromFile(fileName, File2.ISO_8859_1, 1); //nAttempts
1955+
ArrayList<String> lines = File2.readLinesFromFile(fileName, File2.UTF_8, 1); //nAttempts
19561956
int nLines = lines.size();
19571957
for (int i = 0; i < nLines; i++) {
19581958
String s = String2.extractCaptureGroup(lines.get(i), pattern, 1); //captureGroupNumber
@@ -2207,7 +2207,7 @@ else if (Calendar2.isStringTimeUnits(oUnits))
22072207
* This tests if the canonical units for each unique CF unit is unique.
22082208
*/
22092209
public static void testIfCFCanonicalUnitsUnique() throws Throwable {
2210-
StringArray sa = StringArray.fromFile(cfUnique, File2.UTF_8);
2210+
StringArray sa = StringArray.fromFileUtf8(cfUnique);
22112211
Attributes atts = new Attributes(); //use it as a hashmap: canon -> source
22122212
for (int i = 0; i < sa.size(); i++) {
22132213
String s = sa.get(i);

WEB-INF/classes/gov/noaa/pfel/coastwatch/Projects.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3317,11 +3317,11 @@ public static void testHdf4() throws Exception {
33173317
String[] list = RegexFilenameFilter.recursiveFullNameList(
33183318
"c:/programs/_tomcat/webapps/cwexperimental/WEB-INF/classes/ucar4", ".*\\.java", false);
33193319
for (int i = 0; i < list.length; i++) {
3320-
String content[] = File2.readFromFile(list[i]);
3320+
String content[] = File2.readFromFileUtf8(list[i]);
33213321
if (content[0].length() == 0) {
33223322
String2.log("processing " + list[i]);
33233323
content[1] = String2.replaceAll(content[1], "ucar.", "ucar4.");
3324-
File2.writeToFile(list[i], content[1]);
3324+
File2.writeToFileUtf8(list[i], content[1]);
33253325
} else {
33263326
String2.log(content[0]);
33273327
}
@@ -6367,7 +6367,7 @@ public static void nodcPJJU(
63676367
for (int f = 0; f < fileNames.length; f++) {
63686368
try {
63696369
String2.log("\n#" + f + " " + fileNames[f]);
6370-
ArrayList<String> lines = File2.readLinesFromFile(inDir + fileNames[f], null, 2);
6370+
ArrayList<String> lines = File2.readLinesFromFile(inDir + fileNames[f], File2.ISO_8859_1, 2);
63716371

63726372
//BOTTLE,20030711WHPSIODMB
63736373
//#code : jjward hyd_to_exchange.pl
@@ -6984,10 +6984,9 @@ public static String makeNetcheckErddapTests(String erddapUrl) throws Throwable
69846984
*/
69856985
public static void fixKeywords(String fileName) throws Exception {
69866986
String2.log("fixKeywords " + fileName);
6987-
String charset = File2.ISO_8859_1;
69886987
String attKeywords = "<att name=\"keywords\">";
69896988
int attKeywordsLength = attKeywords.length();
6990-
StringArray lines = StringArray.fromFile(fileName, charset);
6989+
StringArray lines = StringArray.fromFileUtf8(fileName);
69916990
int linesSize = lines.size();
69926991
for (int i = 0; i < linesSize; i++) {
69936992
//start keywords?
@@ -7012,7 +7011,7 @@ public static void fixKeywords(String fileName) throws Exception {
70127011
}
70137012
}
70147013
}
7015-
lines.toFile(fileName);
7014+
lines.toFile(fileName, File2.UTF_8, null);
70167015
}
70177016

70187017
/**
@@ -7339,7 +7338,7 @@ public static void convertGlobecCsvToNc() throws Exception {
73397338
public static void splitRockfish() throws Exception {
73407339
String2.log("\n*** splitRockfish");
73417340
String fileDir = "c:/data/globec/";
7342-
StringArray sa = StringArray.fromFile(fileDir + "rockfish_view.csv");
7341+
StringArray sa = StringArray.fromFile88591(fileDir + "rockfish_view.csv");
73437342
int size = sa.size();
73447343

73457344
//this file has \N for missing values. change to ""
@@ -7352,7 +7351,7 @@ public static void splitRockfish() throws Exception {
73527351
while (size > 1) {
73537352
int stop = Math.min(100000, size - 1);
73547353
sa.subset(subset, 0, 1, stop); //stop is inclusive
7355-
subset.toFile(fileDir + "rockfish" + (chunk++) + ".csv");
7354+
subset.toFile(fileDir + "rockfish" + (chunk++) + ".csv", File2.ISO_8859_1, null);
73567355
sa.removeRange(1, stop + 1); //end is exclusive
73577356
size = sa.size();
73587357
}
@@ -9504,7 +9503,7 @@ public static void makePH2Ncml(String sstdn)
95049503

95059504
//String names[] = RegexFilenameFilter.list(dir, regex);
95069505
ArrayList<String> names = File2.readLinesFromFile(
9507-
"/u00/satellite/PH2/" + sstdn + "/names.txt", null, 1);
9506+
"/u00/satellite/PH2/" + sstdn + "/names.txt", File2.ISO_8859_1, 1);
95089507

95099508
//for each file
95109509
int nNames = names.size();
@@ -9559,7 +9558,7 @@ public static void makePH53Ncml()
95599558
for (int daynight = 0; daynight < 2; daynight++) {
95609559

95619560
ArrayList<String> names = File2.readLinesFromFile(
9562-
ncmlDir + dayNight[daynight] + "names" + year + ".txt", null, 1);
9561+
ncmlDir + dayNight[daynight] + "names" + year + ".txt", File2.ISO_8859_1, 1);
95639562
HashMap<String,String> hm = new HashMap();
95649563
//for each file
95659564
//19811101145206-NODC-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.2_NOAA07_G_1981305_day-v02.0-fv01.0.nc

0 commit comments

Comments
 (0)