Page 1 of 1

Having trouble importing time series temperature data

Posted: Mon Apr 07, 2008 1:47 am
by wattsup
Hi,

First let me say I'm overall satisfied with the program, it has been very useful to me in climate science research.

Second, I'm running into a snag due to the way Dplot handles import. I don't think it is a bug, but simply something not envisioned.

The data I use is historical monthly temperature records, which are in the format:

YYYY.mm temp temp temp

Where YYYY.mm would look like this:

1950.1
1950.2
1950.3
...
1950.12
1951.1
1951.2
...

etc

or this:

1950 1
1950 2
1950 3
...
1950 12

The problem is of course that Dplot can't handle using these values for the X axis. So I have to discard these and simply let Dplot handle the data as "months" by automatically figuring out the x axis from the data. This of course leaves me to plot years manually and to have to always set the tick interval on the x axis to 12 so that I can count years.

Unfortunately, I don't have control over the data format as it is provided by the National Weather Service and other agencies, and thus it presents a bit of a quandary as to what to do to handle this better. I run new plots 4-5 times a month, so any sort of solution would be welcome.

Here is sample data file for you to test with:

ftp://ftp.ssmi.com/msu/monthly_time_ser ... _v03_1.txt

Posted: Mon Apr 07, 2008 9:46 am
by DPlotAdmin
Yuck :-)

I started to reply that you could use Edit>Operate on X with the dates in the form Y.M. But that won't work because January would be indistinguishable from October. For the Y.M form it's hopeless; I'll need to write a plugin to handle those.

For the space-separated year and month you can still make this work, though it requires a bit of hoop-jumping. Open the file with "Pick columns to Plot" checked. Enter 0 for "Use column _ as X axis" and check the first curve (the year) in the "Use these columns for Y" list (all others should already be checked - leave them checked).

Now use Generate>Y=f(X,Y1,Y2,...) and enter Y=DATE(Y1,Y2,1) from (for this file) X=0 to 350 with an increment of 1.

Click the Erase button and delete the first two curves (year and month).

Select Generate>Switch Independent Variable and select the last curve (which should be labeled DATE(Y1,Y2,1)).

Right-click any of the numbers on the X axis and select "Calendar date".

Wasn't that fun? :-)

DPlot doesn't interpret your column headings correctly, but those are fairly easily entered manually. I'll put all this on my to-do list for a plugin that removes all the tedium above, but I can't promise when that might be available.

Posted: Mon Apr 07, 2008 10:05 pm
by jsc
A little work with excel to turn the first two columns into a date with the =date(year,month,day) formula, and then for column labels concatenate the first two rows, would get you a little further than totally manual manipulation. A bit of a macro in excel, or using a macro in a good text editor like UltraEdit would get you 99% there, though not as neatly as David writing a plugin, to be sure!

Thanks

Posted: Tue Apr 08, 2008 9:43 pm
by wattsup
I'm VERY appreciative of the ideas. Perhaps by making the . separator selectable (I found one using /) but this could go on ad infinitum.

Now for the really ugly one, NASA GISS data:

http://data.giss.nasa.gov/gistemp/table ... s+dSST.txt

Any ideas on how to take this train wreck and make a plot of monthly data?

Posted: Tue Apr 08, 2008 10:39 pm
by DPlotAdmin
Any ideas on how to take this train wreck and make a plot of monthly data?
Please go away :-)

Just kidding. No, there's no easy (or hard) way I can see to import that into DPlot and get it as it is intended. If I personally had an immediate need to plot that data I'd probably import the table into Excel and write a VBA routine to do the dirty work. Long term I'll at least think about creating a file import plugin to handle that arrangement. But please don't expect anything real soon, as my plate is currently overflowing.