Home > Uncategorized > Ha More Charts and graphs and a bug

Ha More Charts and graphs and a bug

I hate programming 2D graphics. 3D is a whole nother thing

Anyways I hate this whole process of position text and picking font sizes and axis labels and grids and colors and all that crap. It’s mind numbing. I want to design a chart with a free form tool and have the code just generated to gimme the picture I want. Like NOW. That would be a cool tool. A package where you positioned graphical elements of your chart VISUALLY and then ploink, hit a button and generate code. Feasible, somebody get on that task..

We are slouching toward Moshtemp202 and so I have to check things as I build them. Basically I’m taking all my previous code and building the system again, making little changes here and there. for grins I thought I would throw in some graphics. Pitiful. I’ll do a proper post tonight. but for now a couple of charts.

When we read in V2Anomalies.Rdata ( I made an addition to the data structure.. so beware..) we have the ability to count the stations that report by month. Like this familiar chart

Click to Inflate

So, we know that everything is working just fine. Code to count the stations is a snap.

stationCount<-function(anomalies){

output<-zoo(rowSums(!is.na(anomalies)), order.by=time(anomalies))

return(output)

}

Basic. V2Anomalies is a matrix(time,station) of anomalies in 1/10 C. Take that data and turn every temperature into a TRUE value and then SUM the TRUES by row. Since every column is a station, you get a count of stations reporting a temperature by Month.

Station 1,2,3,4,5,6

month1      T,T,F,T,T,F

month2      F,F,F,F,F,T

sum those T/F according to the row they are on and you’ve counted the stations reporting

Next, I threw v2anomalies at an old plot function I wrote. No JOY. The stupid thing failed on the regression for the slope. Also, I used a triangular filter for the smoothing and that showed a funny thing

click at your own risk. na, just makes the chart bigger

A quick check of the data and we see that this station has a year with NA. not a problem except for the part of my graphing that draws a slope from the output of glm(). anyways, that line is commented out. Get back to it later. No code drop yet, I’m writing some more test programs for the Land Mask that we imported.  And that change I made to the data structures to make them self documenting: here is a hint, every object gets this:

v2$Parameters
$Title
[1] “BASELAND1900-2009”
$Cellsize
[1] 3
$Years
$Years$Start
[1] 1900
$Years$End
[1] 2009
$Cam
$Cam$Start
[1] 1961
$Cam$End
[1] 1990
$Cam$Years
[1] 15
$Cam$Threshold
[1] 12
$Landmask
[1] TRUE
$SourceData
[1] “v2.mean.Z”
$SourceDate
[1] “2010-08-16 15:23:38 PDT”
$AnomalyData
[1] “V2Anomalies.Rdata”
$AnomalyDate
[1] 0
$Stations
NULL
$Time
[1] “2010-08-18 14:09:13 PDT”
$Author
[1] “Steven Mosher”

v2$Parameters$Title[1] “BASELAND1900-2009”
$Cellsize[1] 3
$Years$Years$Start[1] 1900
$Years$End[1] 2009

$Cam$Cam$Start[1] 1961
$Cam$End[1] 1990
$Cam$Years[1] 15
$Cam$Threshold[1] 12

$Landmask[1] TRUE
$SourceData[1] “v2.mean.Z”
$SourceDate[1] “2010-08-16 15:23:38 PDT”
$AnomalyData[1] “V2Anomalies.Rdata”
$AnomalyDate[1] 0
$StationsNULL
$Time[1] “2010-08-18 14:09:13 PDT”
$Author[1] “Steven Mosher”

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: