Skip to content

Commit a611ca9

Browse files
author
Bob Simons
committed
v1.68
1 parent 1a234c6 commit a611ca9

Some content is hidden

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

46 files changed

+2666
-542
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public static String allStackTraces(boolean hideThisThread, boolean hideTomcatWa
371371
(ste0.startsWith("sun.misc.Unsafe.park(Native Method)") ||
372372
ste0.startsWith("java.lang.Object.wait(Native Method)"))) {
373373
if (ste2.startsWith("org.apache.tomcat.util.threads.ThreadPool") || //linux
374-
String2.lineStartsWith(ste, "org.apache.tomcat.util.threads.TaskQueue.poll(") >= 0 || //linux, added 2015-12-04
374+
String2.lineStartsWith(ste, "org.apache.tomcat.util.threads.TaskQueue.") >= 0 || //linux, added 2015-12-04
375375
ste2.startsWith("org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:") || //Mac
376376
(threadName.startsWith("http-apr-8080-exec-") &&
377377
"WAITING".equals(t.getState().toString()))) { //windows
@@ -403,11 +403,11 @@ public static String allStackTraces(boolean hideThisThread, boolean hideTomcatWa
403403

404404
//write to StringBuilder
405405
StringBuilder sb = new StringBuilder();
406-
sb.append("Number of " +
406+
sb.append("Number of threads: " +
407407
(hideTomcatWaitingThreads?
408-
"non-Tomcat-waiting (" + tomcatWaiting +
409-
") non-inotify (" + inotify + ") " : "") +
410-
"threads in this JVM = " + count + "\n" +
408+
"Tomcat-waiting=" + tomcatWaiting +
409+
", inotify=" + inotify + ", other=" : "") +
410+
count + "\n" +
411411
"(format: #threadNumber Thread[threadName,threadPriority,threadGroup] threadStatus)\n\n");
412412
for (int i = 0; i < count; i++)
413413
sb.append("#" + (i + 1) + " " + sar[i]);

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,25 @@ public static String[] extractAllRegexes(String s, String regex) {
515515
return al.toArray(new String[0]);
516516
}
517517

518+
/**
519+
* This returns the specified capture group from s.
520+
*
521+
* @param s the source String
522+
* @param regex the regular expression, see java.util.regex.Pattern.
523+
* @param captureGroupNumber the number of the capture group (0 for entire regex,
524+
* 1 for first capture group, 2 for second, etc.)
525+
* @return the value of the specified capture group,
526+
or null if the s doesn't match the regex
527+
* @throws RuntimeException if trouble
528+
*/
529+
public static String extractCaptureGroup(String s, String regex, int captureGroupNumber) {
530+
Pattern p = Pattern.compile(regex);
531+
Matcher m = p.matcher(s);
532+
if (m.matches())
533+
return m.group(captureGroupNumber);
534+
else return null;
535+
}
536+
518537
/**
519538
* Finds the first instance of i at or after fromIndex (0.. ) in iArray.
520539
*

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,11 @@ public static void testString2() throws Exception {
14421442
Test.ensureEqual(String2.toCSSVString(sar),
14431443
"\"url=\\\"first\\\"\", \"url=\\\"second\\\"\"", "sar=" + String2.toCSSVString(sar));
14441444

1445+
//extractCaptureGroup
1446+
String2.log("test extractRegex");
1447+
Test.ensureEqual(String2.extractCaptureGroup("bc&a&", "b(\\w+)&.*", 1), "c", "a");
1448+
Test.ensureEqual(String2.extractCaptureGroup("bedad", "b(.+?)d.*", 1), "e", "b"); //reluctant
1449+
14451450
//indexOfIgnoreCase(s)
14461451
String2.log("test indexOfIgnoreCase(s)");
14471452
s = "ABCDEFGHIJK";

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ public OneOf(String tFullClassName) throws Exception {
261261
baseUrl = classRB2.getNotNothingString("baseUrl", errorInMethod);
262262
fullContextDirectory = SSR.getContextDirectory(); //with / separator and / at the end
263263
bigParentDirectory = classRB2.getNotNothingString("bigParentDirectory", errorInMethod);
264-
File2.addSlash(fullContextDirectory);
265-
File2.addSlash(bigParentDirectory);
264+
fullContextDirectory = File2.addSlash(fullContextDirectory);
265+
bigParentDirectory = File2.addSlash(bigParentDirectory);
266266

267267
Test.ensureTrue(File2.isDirectory(fullContextDirectory),
268268
errorInMethod + "fullContextDirectory (" + fullContextDirectory + ") doesn't exist.");
@@ -284,9 +284,9 @@ public OneOf(String tFullClassName) throws Exception {
284284
fullPaletteDirectory = classRB2.getNotNothingString("paletteDirectory", errorInMethod);
285285
fullPrivateDirectory = classRB2.getNotNothingString("privateDirectory", errorInMethod);
286286
fullResetFlagDirectory = classRB2.getNotNothingString("resetFlagDirectory", errorInMethod);
287-
File2.addSlash(fullPaletteDirectory);
288-
File2.addSlash(fullPrivateDirectory);
289-
File2.addSlash(fullResetFlagDirectory);
287+
fullPaletteDirectory = File2.addSlash(fullPaletteDirectory);
288+
fullPrivateDirectory = File2.addSlash(fullPrivateDirectory);
289+
fullResetFlagDirectory = File2.addSlash(fullResetFlagDirectory);
290290

291291
resetMaxMillis = classRB2.getInt("resetMaxMinutes", 60) * 60000; // millis/min
292292
resetStalledMillis = classRB2.getInt("resetStalledMinutes", 10) * 60000; // millis/min

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

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public static void main(String args[]) throws Throwable {
134134
//
135135
// Table.testReadNcCFASAProfile(false);
136136

137-
// Table.debugMode = true; DasDds.main(new String[]{"swfscTrinCTD", "-verbose"});
137+
// Table.debugMode = true; DasDds.main(new String[]{"erdSW1chla1day", "-verbose"});
138138

139139
/* if (false) { //one time fixup of scrippsGliders
140140
String dir = "/u00/data/points/scrippsGliders/batch2/";
@@ -148,7 +148,7 @@ public static void main(String args[]) throws Throwable {
148148
}
149149
} /* */
150150

151-
// String2.log(NcHelper.dumpString("/data/jplMUR/testAggregation.ncml", true));
151+
// String2.log(NcHelper.dumpString("/data/gocd/gocd_a0000755_00010v3.nc", false));
152152
// String2.log(NcHelper.dumpString("/data/jplMUR/ssta_1day.nc", true)); //short data
153153
// String2.log(NcHelper.dumpString("/data/jplMUR/ssta_1day.ncml", true)); //short data
154154

@@ -269,13 +269,18 @@ public static void main(String args[]) throws Throwable {
269269

270270
// EDDGridFromDap.testUInt16Dap();
271271
// EDDGridFromErddap.testDataVarOrder();
272-
// String2.log(EDDGridFromErddap.generateDatasetsXml("http://coastwatch.pfeg.noaa.gov/erddap",
273-
// true)); //keepOriginalID (true for generating UAF datasets)
272+
// String gx = "";
273+
// String2.setClipboardString(gx = EDDGridFromErddap.generateDatasetsXml("http://coastwatch.pfeg.noaa.gov/erddap",
274+
// true)); //keepOriginalID (true for generating UAF datasets)
275+
// String2.log(gx);
276+
274277
// String2.log(EDDGridFromErddap.generateDatasetsXml("http://oceanview.pfeg.noaa.gov/erddap", true));
275278
// String2.log(EDDGridFromErddap.generateDatasetsXml("http://upwell.pfeg.noaa.gov/erddap"));
276279
// String2.log(EDDGridFromErddap.generateDatasetsXml("http://oos.soest.hawaii.edu/erddap", true));
277280
// String2.log(EDDGridFromErddap.generateDatasetsXml("http://cwcgom.aoml.noaa.gov/erddap", true));
278-
// EDDGridFromNcFiles.testAwsS3(false);
281+
// EDDGridFromNcFiles.testSpecialAxis0Time();
282+
// EDDGridFromNcFiles.testSpecialAxis0FileNameInt();
283+
// EDDGridFromNcFiles.testSpecialAxis0GlobalDouble();
279284
// EDDGridFromNcFiles.testUInt16File();
280285
// EDDGridFromNcFilesUnpacked.testUInt16File();
281286
// String opt[] = {
@@ -320,15 +325,23 @@ public static void main(String args[]) throws Throwable {
320325
// String2.log(NcHelper.dumpString(
321326
// "/u00/satellite/MH1/sst/8day/A20030012003008.L3m_8D_SST_sst_4km.ncml", false));
322327
// String2.log(String2.noLongLines(NcHelper.dumpString(
323-
// "/u00/satellite/MH1/sst/mday/A20030012003031.L3m_MO_SST_sst_4km.ncml", "qual_sst"), 80, ""));
328+
// "/u00/satellite/SW1/1day/S1998002.L3m_DAY_CHL_chlor_a_9km.nc",
329+
// false), 80, ""));
330+
//"lat"), 80, ""));
324331
// String2.log(EDD.testDasDds("erdMBsstd1day"));
325332
// while (ds.length() > 0) {
326333
// ds = String2.getStringFromSystemIn("datasetID?");
327334
// String2.log(EDD.testDasDds(ds));
328335
// }
329-
// String2.log(EDDGridFromNcFiles.generateDatasetsXml(
330-
// "/u00/satellite/MUR41/ssta/1day/", ".*fv04\\.1\\.nc",
331-
// "/u00/satellite/MUR41/ssta/1day/20020602090000-JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1.nc", 1440, null));
336+
// if (true) {
337+
// String s = EDDGridFromNcFiles.generateDatasetsXml(
338+
// "/u00/satellite/aviso1/msla/uv/", "dt_global_allsat_msla_uv_\\d{8}_\\d{8}.nc",
339+
// "/u00/satellite/aviso1/msla/uv/1993/dt_global_allsat_msla_uv_19930101_20140106.nc", 1440, null);
340+
// String2.setClipboardString(s);
341+
// String2.log(s);
342+
// } else {
343+
// String2.log(EDD.testDasDds("avisoMSLAuv"));
344+
// }
332345

333346
/*
334347
StringBuilder sb = new StringBuilder();
@@ -359,6 +372,12 @@ public static void main(String args[]) throws Throwable {
359372
// Projects.makeNcmlCoordValues("V*.L3m_DAY_NPP_CHL_chlor_a_4km", "2012-01-02", "2013-12-31", 1, Calendar.DAY_OF_YEAR);
360373
// EDDGridFromNcFiles.testGenerateDatasetsXmlWithRemoteThreddsFiles();
361374
// EDDGridFromNcFiles.testSpeed(-1); //-1 for all
375+
376+
// String s = EDDGridLonPM180.generateDatasetsXmlFromErddapCatalog(
377+
// "http://coastwatch.pfeg.noaa.gov/erddap/", ".*");
378+
// String2.setClipboardString(s);
379+
// String2.log(s);
380+
362381
// EDDGridSideBySide.testTransparentPng();
363382

364383
// ((EDDTable)EDD.oneFromDatasetsXml(null, "erdGlobecBottle")).makeNewFileForDapQuery(null, null,
@@ -580,10 +599,10 @@ public static void main(String args[]) throws Throwable {
580599
// EDDTableFromHyraxFiles.testJpl(true); //deleteCachedInfoAndOneFile
581600

582601
// String2.log(EDDTableFromNcCFFiles.generateDatasetsXml(
583-
// "/u00/data/points/eb/", "TrinidadHeadLine_CoralSea_.*\\.nc",
584-
// "/u00/data/points/eb/TrinidadHeadLine_CoralSea_CS140116.nc", 1440,
602+
// "/data/gocd/", "gocd_a0060062_6971adc-a1h\\.nc",
603+
// "/data/gocd/gocd_a0060062_6971adc-a1h.nc", 10080,
585604
// "", "", "",
586-
// "", "",
605+
// "", "",
587606
// "", "", "", "", new Attributes()));
588607
// EDDTableFromNcCFFiles.testNoAttName();
589608
//
@@ -640,7 +659,7 @@ public static void main(String args[]) throws Throwable {
640659
// Temporarily switching off parts of McAfee : Virus Scan Console (2X speedup!)
641660
// On Access Scanner : All Processes
642661
// Scan Items: check: specified file types only (instead of usual All Files)
643-
// EDDTableFromNcFiles.bobConsolidateGtsppTgz(2015, 8, 2015, 12, false); //first/last year(1990..)/month(1..), testMode
662+
// EDDTableFromNcFiles.bobConsolidateGtsppTgz(2015, 1, 2016, 1, false); //first/last year(1990..)/month(1..), testMode
644663
// log file is c:/data/gtspp/logYYYYMMDD.txt
645664
// 2b) Email the "good" but "impossible" stations to Charles Sun
646665
// [was Melanie Hamilton, now retired]
@@ -665,7 +684,7 @@ public static void main(String args[]) throws Throwable {
665684
// EDDTableFromNcFiles.testErdGtsppBest("erdGtsppBestNc");
666685
// 6) Create ncCF files with the same date range as 2a) above:
667686
// It takes ~2 minutes per month processed.
668-
// EDDTableFromNcFiles.bobCreateGtsppNcCFFiles(2015, 8, 2015, 12); //e.g., first/last year(1990..)/month(1..)
687+
// EDDTableFromNcFiles.bobCreateGtsppNcCFFiles(2015, 1, 2016, 1); //e.g., first/last year(1990..)/month(1..)
669688
// String2.log(NcHelper.dumpString("/u00/data/points/gtsppNcCF/201406a.nc", false));
670689
// 7) * Load erdGtsppBest in localHost ERDDAP. (long time if lots of files changed)
671690
// * Generate .json file from
@@ -945,7 +964,6 @@ public static void main(String args[]) throws Throwable {
945964
// Projects.testOpendapAvailability("http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/CM/usfc/hday",
946965
// "CMusfc", 5, 1, true); //nIter, maxSec
947966
// Projects.touchUrls();
948-
// Projects2.copyKeywords();
949967

950968
//String2.log(String2.extractRegex("abc>2011-06-30T04:43:09<def",
951969
// ">\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}<", 0));
@@ -1506,14 +1524,14 @@ public static void main(String args[]) throws Throwable {
15061524
String2.pressEnterToContinue("OceanWatch Thredds too slow: " + time9);
15071525
}
15081526
//don't run often
1509-
Opendap.threddsTunnelTest(200,
1510-
"http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/CM/usfc/hday",
1511-
"CMusfc");
1527+
//Opendap.threddsTunnelTest(10, //200 for a good test
1528+
// "http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/CM/usfc/hday",
1529+
// "CMusfc");
15121530
} catch (Exception e) {
15131531
String2.pressEnterToContinue(MustBe.throwableToString(e) +
15141532
"\nUnexpected oceanwatch error.");
15151533
}
1516-
1534+
15171535
//INACTIVE: a test of thredds1 THREDDS 8081
15181536
//try {
15191537
// for (int i = 0; i < 5; i++) {
@@ -1524,7 +1542,7 @@ public static void main(String args[]) throws Throwable {
15241542
// String2.pressEnterToContinue("Thredds1 8081 Thredds too slow: " + time9);
15251543
// }
15261544
// //don't run often
1527-
// Opendap.threddsTunnelTest(200,
1545+
// Opendap.threddsTunnelTest(10, //200 for a good test
15281546
// "http://thredds1.pfeg.noaa.gov:8081/thredds/dodsC/satellite/CM/usfc/hday",
15291547
// "CMusfc");
15301548
//} catch (Exception e) {
@@ -1542,7 +1560,7 @@ public static void main(String args[]) throws Throwable {
15421560
// String2.pressEnterToContinue("Otter Thredds 8081 too slow: " + time8);
15431561
// }
15441562
// //don't run often
1545-
// Opendap.threddsTunnelTest(200,
1563+
// Opendap.threddsTunnelTest(10, //200 for a good test
15461564
// "http://161.55.17.243:8081/thredds/dodsC/satellite/CM/usfc/hday", //otter
15471565
// "CMusfc");
15481566
//} catch (Exception e) {
@@ -1581,7 +1599,7 @@ public static void main(String args[]) throws Throwable {
15811599
String2.pressEnterToContinue("Erddap too slow: " + time9);
15821600
}
15831601
//don't run often
1584-
Opendap.threddsTunnelTest(200,
1602+
Opendap.threddsTunnelTest(10, //200 for a good test
15851603
"http://coastwatch.pfeg.noaa.gov/erddap/griddap/erdCMsfc",
15861604
"eastCurrent");
15871605
} catch (Exception e) {

WEB-INF/classes/gov/noaa/pfel/coastwatch/griddata/DoubleCenterGrids.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public static void main(String args[]) throws Exception {
112112
//validate oldBaseDir and newBaseDir
113113
String oldBaseDir = args[0];
114114
String newBaseDir = args[1];
115-
File2.addSlash(oldBaseDir);
116-
File2.addSlash(newBaseDir);
115+
oldBaseDir = File2.addSlash(oldBaseDir);
116+
newBaseDir = File2.addSlash(newBaseDir);
117117
String2.log("(oldBaseDir=" + oldBaseDir + " newBaseDir=" + newBaseDir + ")");
118118

119119
boolean fast = false;
Binary file not shown.

WEB-INF/classes/gov/noaa/pfel/coastwatch/pointdata/MakeErdJavaZip.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void main(String args[]) throws Exception {
8787
//generate javadocs once so it will be in zip file
8888
String tDir = baseDir + "docs/ErdJavaDoc"; //dir to hold results
8989
SSR.dosShell("del /s /q " + //delete (/s=recursive /q=quiet) previous results
90-
String2.replaceAll(tDir, "/", "\\"), 20);
90+
String2.replaceAll(tDir, "/", "\\"), 60);
9191
String checkNames[] = {
9292
"/index.html",
9393
"/com/cohort/array/DoubleArray.html",
@@ -112,7 +112,7 @@ public static void main(String args[]) throws Exception {
112112
tDir = SSR.getContextDirectory() + //with / separator and / at the end
113113
"ErdJavaDoc"; //dir to hold results
114114
SSR.dosShell("del /s /q " + //delete (/s=recursive /q=quiet) previous results
115-
String2.replaceAll(tDir, "/", "\\"), 20);
115+
String2.replaceAll(tDir, "/", "\\"), 60);
116116
for (int i = 0; i < checkNames.length; i++)
117117
Test.ensureTrue(!File2.isFile(tDir + checkNames[i]), errorInMethod + tDir + checkNames[i] + " not deleted.");
118118
try {

0 commit comments

Comments
 (0)