Skip to content

Commit

Permalink
v2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Simons committed Nov 6, 2020
1 parent 71f3aa9 commit d5cdd45
Show file tree
Hide file tree
Showing 49 changed files with 638 additions and 446 deletions.
17 changes: 12 additions & 5 deletions WEB-INF/classes/com/cohort/util/Calendar2.java
Original file line number Diff line number Diff line change
Expand Up @@ -2334,9 +2334,11 @@ public class Calendar2 {
"EEE, d MMM yyyy HH:mm:ss'Z'",
"[a-zA-Z]{3}, [0123]?[0-9] [a-zA-Z]{3} [0-9]{4} [012][0-9]:[0-5][0-9]:[0-5][0-9]",
"EEE, d MMM yyyy HH:mm:ss",
//Tue Dec 6 17:36:16 2017
"[a-zA-Z]{3} [a-zA-Z]{3} [0123]?[0-9] [012][0-9]:[0-5][0-9]:[0-5][0-9] [0-9]{4}",
"EEE MMM d HH:mm:ss yyyy",
//Tue Dec 6 17:36:16 2017 some variety in how single digit date and hour are written
"[a-zA-Z]{3} [a-zA-Z]{3} [ 0123][0-9] [ 012][0-9]:[0-5][0-9]:[0-5][0-9] [0-9]{4}", //2 digits
"EEE MMM dd HH:mm:ss yyyy",
"[a-zA-Z]{3} [a-zA-Z]{3} [0123]?[0-9] [012]?[0-9]:[0-5][0-9]:[0-5][0-9] [0-9]{4}", //variable nDigits
"EEE MMM d H:mm:ss yyyy",

// "Sun, 06 November 1994 08:49:37 GMT"
//GMT is literal. java.time.format.DateTimeFormatter (was Joda) doesn't parse z
Expand Down Expand Up @@ -4521,12 +4523,17 @@ else if (!String2.isDigit(s.charAt(sPo)))
} else {
//get specified number of digits
for (int i = 0; i < nCh; i++) {
if (sPo >= sLength)
if (sPo >= sLength)
throw new RuntimeException(
parseErrorUnexpectedEndOfContent(s, format));
else if (!String2.isDigit(s.charAt(sPo)))

char tch = s.charAt(sPo);
if (tch == ' ' && i == 0 && nCh == 2 && "dHh".indexOf(ch) >= 0) { //first 'digit' of dd, HH, hh may be a space
ospo++;
} else if (!String2.isDigit(tch)) {
throw new RuntimeException(
parseErrorUnexpectedContent(s, format, sPo));
}
sPo++;
}
}
Expand Down
6 changes: 3 additions & 3 deletions WEB-INF/classes/com/cohort/util/File2.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,12 @@ public static int deleteIfOld(String dir, long time,
int nDeleted = files.length - nDir + nRemain;
if (nDir != 0 || nDeleted != 0 || nRemain != 0)
String2.log("File2.deleteIfOld(" +
String2.left(dir, 50) +
String2.left(dir, 55) +
(time == Long.MAX_VALUE? "" :
", " + Calendar2.safeEpochSecondsToIsoStringTZ(time / 1000.0, "" + time)) +
") nDir=" + String2.right("" + nDir, 3) +
") nDir=" + String2.right("" + nDir, 4) +
" nDeleted=" + String2.right("" + nDeleted, 4) +
" nRemain=" + String2.right(nRemain < 0? String2.ERROR : "" + nRemain, 3));
" nRemain=" + String2.right(nRemain < 0? String2.ERROR : "" + nRemain, 4));
return nRemain;
} catch (Exception e3) {
String2.log(MustBe.throwable(String2.ERROR + " in File2.deleteIfOld(" +
Expand Down
8 changes: 4 additions & 4 deletions WEB-INF/classes/com/cohort/util/ScriptCalendar2.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public static double unitsSinceToEpochSeconds(double baseSeconds,
* This converts an epochSeconds value into a unitsSince value.
* This properly handles 'special' factorToGetSeconds values (for month and year).
*
* @param baseSeconds
* @param factorToGetSeconds
* @param epochSeconds
* @return seconds since 1970-01-01 (or NaN if epochSeconds is NaN)
* @param baseSeconds from getTimeBaseAndFactor[0]
* @param factorToGetSeconds from getTimeBaseAndFactor[1]
* @param epochSeconds seconds since 1970-01-01 (or NaN if epochSeconds is NaN)
* @return a numeric time value in source units "<i>units</i> since <i>baseTime</i>"
*/
public static double epochSecondsToUnitsSince(double baseSeconds,
double factorToGetSeconds, double epochSeconds) {
Expand Down
20 changes: 12 additions & 8 deletions WEB-INF/classes/com/cohort/util/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3400,17 +3400,21 @@ public static void testCalendar2() throws Throwable {
Test.ensureEqual(Calendar2.suggestDateTimeFormat(
"Sun, 20 Nov 1994 08:49:37 -0800"),
"EEE, d MMM yyyy HH:mm:ss xx", "");
dtfr = DateTimeFormatter.ofPattern( "EEE, d MMM yyyy HH:mm:ss xx");
dtfr.parse( "Sun, 20 Nov 1994 08:49:37 -0800");
dtfr = DateTimeFormatter.ofPattern( "EEE, d MMM yyyy HH:mm:ss xx");
dtfr.parse( "Sun, 20 Nov 1994 08:49:37 -0800");
Test.ensureEqual(Calendar2.tryToIsoString("Sun, 20 Nov 1994 08:49:37 -0800"), "1994-11-20T16:49:37Z", "");
Test.ensureEqual(Calendar2.tryToIsoString("sun, 06 nov 1994 08:49:37 -0800"), "1994-11-06T16:49:37Z", "");
Test.ensureEqual(Calendar2.tryToIsoString("SUN, 6 NOV 1994 08:49:37 -0800"), "1994-11-06T16:49:37Z", "");

Test.ensureEqual(Calendar2.tryToIsoString("Fri Jun 5 2:22:20 2020"), "2020-06-05T02:22:20Z", ""); //variable nDigits
Test.ensureEqual(Calendar2.tryToIsoString("Fri Jun 5 2:22:20 2020"), "2020-06-05T02:22:20Z", ""); //2 digits (first may be ' ')
Test.ensureEqual(Calendar2.tryToIsoString("Fri Jun 15 10:22:20 2020"), "2020-06-15T10:22:20Z", "");

Test.ensureEqual(Calendar2.suggestDateTimeFormat(
"Wed Dec 20 17:36:16 2017"),
"EEE MMM d HH:mm:ss yyyy", "");
dtfr = DateTimeFormatter.ofPattern( "EEE MMM d HH:mm:ss yyyy");
dtfr.parse( "Wed Dec 20 17:36:16 2017");
"EEE MMM dd HH:mm:ss yyyy", "");
dtfr = DateTimeFormatter.ofPattern( "EEE MMM dd HH:mm:ss yyyy");
dtfr.parse( "Wed Dec 20 17:36:16 2017");
Test.ensureEqual(Calendar2.tryToIsoString("Wed Dec 20 17:36:16 2017"), "2017-12-20T17:36:16Z", "");
Test.ensureEqual(Calendar2.tryToIsoString("WED DEC 06 17:36:16 2017"), "2017-12-06T17:36:16Z", "");
Test.ensureEqual(Calendar2.tryToIsoString("wed dec 6 17:36:16 2017"), "2017-12-06T17:36:16Z", "");
Expand Down Expand Up @@ -4204,9 +4208,9 @@ public static void testCalendar2() throws Throwable {
Test.ensureEqual(Calendar2.suggestDateTimeFormat("Sun, 06 Nov 1994 08:49:37 -08:00"),
"EEE, d MMM yyyy HH:mm:ss xxx", "");
Test.ensureEqual(Calendar2.suggestDateTimeFormat("Sun Nov 20 17:36:16 1994"),
"EEE MMM d HH:mm:ss yyyy", "");
Test.ensureEqual(Calendar2.suggestDateTimeFormat("Sun Nov 6 17:36:16 1994"),
"EEE MMM d HH:mm:ss yyyy", "");
"EEE MMM dd HH:mm:ss yyyy", "");
Test.ensureEqual(Calendar2.suggestDateTimeFormat("Sun Nov 6 7:36:16 1994"),
"EEE MMM d H:mm:ss yyyy", "");

Test.ensureEqual(Calendar2.suggestDateTimeFormat("Sunday, 06 November 1994 08:49:37 GMT"),
"EEEE, d MMMM yyyy HH:mm:ss 'GMT'", "");
Expand Down
17 changes: 10 additions & 7 deletions WEB-INF/classes/gov/noaa/pfel/coastwatch/TestAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,15 @@ public static void main(String args[]) throws Throwable {

// "-h" (header), "-c" (coord. vars), "-vall" (default), "-v var1;var2", "-v var1(0:1,:,12)"
// String tFileName = "/data/melanie/o2_ATMassim_10NS_100err_WOA_0.1_3rd.196001-201712.nc";
// String2.log(tFileName + "\n" + NcHelper.ncdump(tFileName, "-h"));
// String2.log(NcHelper.ncdump("/u00/soda3/soda3_ice/soda3.3.1_mn_ice_reg_2014.ncml", "-v time"));

// DasDds.main(new String[]{"nmspWcosTemp", "-verbose"});
// DasDds.main(new String[]{"erdSoda331icemday", "-verbose"});
// DasDds.main(new String[]{"erdSoda331oceanmday", "-verbose"});

// String2.log(EDDTableFromAsciiFiles.generateDatasetsXml("/data/biddle/", "684362_v1_PRS_bacteria_identification.tsv",
// "", "", 1, 2, "\t", 10080, "", "", "", "", "", "", "myInfo", "myInstitution", "mySummary", "myTitle",
// 0, "", null));
// GenerateDatasetsXml.main(new String[0]); //interactive
// GenerateDatasetsXml.main(new String[0]); //interactive

// { //find file in dataset with insane min_time
// Table table = new Table();
Expand Down Expand Up @@ -266,7 +267,9 @@ public static void main(String args[]) throws Throwable {
// os.close();
//
// s = EDDGridFromNcFilesUnpacked.generateDatasetsXml(
// "/data/melanie/", ".*.nc", "", "", -1, "", null);
// "/u00/soda3/soda3_ice/", "soda3.3.1_mn_ice_reg_....\\.ncml", "",
// "", "", //group, dimensionsCSV
// -1, "", null);
// String2.setClipboardString(s); String2.log(s);
// DasDds.main(new String[]{"access_r2", "-verbose"});

Expand Down Expand Up @@ -637,7 +640,7 @@ public static void main(String args[]) throws Throwable {
EDDGridFromNcFiles.testGenerateDatasetsXmlAwsS3(); //slow!
EDDGridFromNcFiles.testGenerateDatasetsXmlCopy(); //requires erdMWchla1day in localhost erddap
EDDGridFromNcFiles.testGenerateDatasetsXmlWithRemoteThreddsFiles();
//EDDGridFromNcFiles.testGenerateDatasetsXmlWithRemoteThreddsFiles(); //inactive, because source is unreliable
EDDGridFromNcFiles.testGenerateDatasetsXml5();
EDDGridFromNcFilesUnpacked.testGenerateDatasetsXml();
EDDGridLonPM180.testGenerateDatasetsXmlFromErddapCatalog();
Expand Down Expand Up @@ -680,7 +683,7 @@ public static void main(String args[]) throws Throwable {
EDDTableFromSOS.testGenerateDatasetsXml(true); //useCachedInfo);
EDDTableFromSOS.testGenerateDatasetsXmlFromOneIOOS(true); //useCachedInfo);
EDDTableFromSOS.testGenerateDatasetsXmlFromIOOS(true); //useCachedInfo);
EDDTableFromThreddsFiles.testGenerateDatasetsXml();
//EDDTableFromThreddsFiles.testGenerateDatasetsXml(); //source is unreliable
EDDTableFromWFSFiles.testGenerateDatasetsXml(true); //developmentMode (read from file, not source)
/* */

Expand Down Expand Up @@ -739,7 +742,7 @@ public static void main(String args[]) throws Throwable {
// DasDds.main(new String[]{"erdMWpp3day", "-verbose"});

// SimpleXMLReader.testValidity(
// "/programs/_tomcat/content/erddap/datasetsFED31UAF.xml", "erddapDatasets");
// "/programs/_tomcat/content/erddap/datasetsFEDCW.xml", "erddapDatasets");

// SSR.downloadFile(
// "http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0",
Expand Down
Binary file not shown.
10 changes: 6 additions & 4 deletions WEB-INF/classes/gov/noaa/pfel/coastwatch/pointdata/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -31116,6 +31116,8 @@ public String directoryListing(String localDir, String showUrlDir, String userQu
PrimitiveArray modifiedPA = getColumn(1);
PrimitiveArray sizePA = getColumn(2);
PrimitiveArray descriptionPA = getColumn(3);
modifiedPA.setMaxIsMV(true);
sizePA.setMaxIsMV(true);

//ensure column types are as expected
String tcssv = getColumn(0).elementTypeString() + ", " +
Expand Down Expand Up @@ -32917,22 +32919,22 @@ public static void testOpendapSequence() throws Exception {
"\t\tabund_m3:units = \"count m-3\" ;\n" +
"\tfloat latitude(row) ;\n" +
"\t\tlatitude:_CoordinateAxisType = \"Lat\" ;\n" +
"\t\tlatitude:_FillValue = NaNf ;\n" +
"\t\tlatitude:_FillValue = 214748.36f ;\n" +
"\t\tlatitude:actual_range = 42.4733f, 44.6517f ;\n" +
"\t\tlatitude:axis = \"Y\" ;\n" +
"\t\tlatitude:ioos_category = \"Location\" ;\n" +
"\t\tlatitude:long_name = \"Latitude\" ;\n" +
"\t\tlatitude:missing_value = NaNf ;\n" +
"\t\tlatitude:missing_value = 214748.36f ;\n" +
"\t\tlatitude:standard_name = \"latitude\" ;\n" +
"\t\tlatitude:units = \"degrees_north\" ;\n" +
"\tfloat longitude(row) ;\n" +
"\t\tlongitude:_CoordinateAxisType = \"Lon\" ;\n" +
"\t\tlongitude:_FillValue = NaNf ;\n" +
"\t\tlongitude:_FillValue = 214748.36f ;\n" +
"\t\tlongitude:actual_range = -125.1167f, -124.175f ;\n" +
"\t\tlongitude:axis = \"X\" ;\n" +
"\t\tlongitude:ioos_category = \"Location\" ;\n" +
"\t\tlongitude:long_name = \"Longitude\" ;\n" +
"\t\tlongitude:missing_value = NaNf ;\n" +
"\t\tlongitude:missing_value = 214748.36f ;\n" +
"\t\tlongitude:standard_name = \"longitude\" ;\n" +
"\t\tlongitude:units = \"degrees_east\" ;\n" +
"\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public String resultsToString() {
}

/**
* This returns an empty table with columns suitable for the instance table or oneStep.
* This returns an empty table with Dir,Name,LastMod,Size columns suitable for the instance table or oneStep.
*/
public static Table makeEmptyTable() {
Table table = new Table();
Expand Down
Loading

0 comments on commit d5cdd45

Please sign in to comment.