Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 21, 2014
@jiwalker-usgs jiwalker-usgs adding new format test files
ebff937
@jiwalker-usgs jiwalker-usgs added post-processed file to test
b6808db
@jiwalker-usgs jiwalker-usgs wrote quick perl script to turn "new format" to old format
45104dc
Commits on Feb 24, 2014
@jiwalker-usgs jiwalker-usgs Merge pull request #16 from jiwalker-usgs/master
I'm going to merge this in (no changes to working code).  The new test can be changed to look at any file from John or Randy to check whether they did it right.  The perl code is probably not that useful, but I'll leave it in for debugging purposes mostly.
c1ee424
View
31 prms-datastore/src/main/perl/tsv2fw.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $infile = shift or die "Must supply input file\n";
+open(FILE, "<$infile");
+while (my $line = <FILE>) {
+ if ($line =~ m/^#/) {
+ $line =~ s/\r\n//;
+ print "$line\n";
+ } else {
+ if ($line =~ m/^(\w+\s+)+\w+/) {
+ # var header
+ $line =~ s/\r\n//;
+ print "$line\n";
+ } elsif ($line =~ m/^(\d+\w\s+)+\d+\w/) {
+ $line =~ s/\r\n//;
+ print "$line\n";
+ } elsif ($line =~ m/^(\d{4}-\d{2}-\d{2}:\d{2}:\d{2}:\d{2})\s+\d+(\s+[\d\.]+)+/) {
+ my @elements = split(/\s+/, $line);
+ my $len = @elements;
+ printf("%s\t", $elements[0]);
+ printf("%6d", $elements[1]);
+ for (my $i=2; $i<$len; $i++) {
+ printf("\t%1.6e", $elements[$i]);
+ }
+ print "\n";
+ }
+ }
+}
View
32 prms-datastore/src/test/java/gov/usgs/cida/prms/PRMSAnimationFileMetaDataTest.java
@@ -9,28 +9,9 @@
* @author tkunicki
*/
public class PRMSAnimationFileMetaDataTest {
-
- public PRMSAnimationFileMetaDataTest() {
- }
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
-
- @Before
- public void setUp() {
- }
-
- @After
- public void tearDown() {
- }
@Test
- public void findAnimationFile() throws Exception {
+ public void testOldAnimationFile() throws Exception {
URL url = getClass().getClassLoader().getResource("pcm.a1fi.1980-2099.annual.animation.nhru");
File oldMetaData = new File(url.getPath() + ".xml");
if (oldMetaData.exists()) {
@@ -39,5 +20,16 @@ public void findAnimationFile() throws Exception {
PRMSAnimationFileMetaData result = PRMSAnimationFileMetaData.getMetaData(url);
System.out.println(result);
}
+
+ @Test
+ public void testNewAnimationFile() throws Exception {
+ URL url = getClass().getClassLoader().getResource("cccma_post-processed.nhru");
+ File oldMetaData = new File(url.getPath() + ".xml");
+ if (oldMetaData.exists()) {
+ oldMetaData.delete();
+ }
+ PRMSAnimationFileMetaData result = PRMSAnimationFileMetaData.getMetaData(url);
+ System.out.println(result);
+ }
}
View
14,575 prms-datastore/src/test/resources/cccma_cgcm3_1.sresa1b.2046-2065.annual.animation.nhru
14,575 additions, 0 deletions not shown
View
14,575 prms-datastore/src/test/resources/cccma_post-processed.nhru
14,575 additions, 0 deletions not shown

No commit comments for this range

Something went wrong with that request. Please try again.