AESINDAT='/home/jallen/aes_data/1154410.001.out' REANINDAT='/home/jallen/reanal_data/daily/1154410.001' AESINDAT='/home/jallen/aes_data/1096450.001.out' REANINDAT='/home/jallen/rdata_modified/1096450.001' PLOTOUT='PG_JA.ps.test' STATOUT='PG_JA.stat.test' DATAOUT="PG_JA.dat.test" HREANLAB='Reanalysis Temperature at 00Z(oC)' HAESLAB='Station Maximum Daily Temperature (oC)' HTITLE="Comparison of Reanalysis and Station Data, Maximum Daily Temperature, PG" BYLAB='Temperature (oC)' BXLAB='Station Data; Reanalysis Data' BTITLE="Station and Reanalysis Data, Maximum Daily Temperature, PG" #collumn contents, if different from above* #---------------------Start of Program-------------------------------- #Read the files AESINDAT and REANINDAT, which contain station (aes) and #reanalysis data for the station and element indicated; assign this information #to the arrays 'aes' and 'rean'. outa<-"Reading data files.";print(outa,quote=F) aes<-read.table(AESINDAT, header=F) rean<-read.table(REANINDAT, header=F) #initialize counter variables i<-1;k<-1;s<-0;numdat<-0;nummissing<-0;totaldat<-0 outb<-"Searching for dates in July and August.";print(outb,quote=F) #This loop locates the relevant data and writes it to the file DATAOUT i<-1;k<-1;s<-0;numdat<-0;nummissing<-0;totaldat<-0 while(i<=length(aes[,1])){ if(aes[i,2]==7||aes[i,2]==8){ if(aes[i,4]*0.1!=-99.9){ print(i) while(s!=1){ # print(k) if(rean[k,1]==aes[i,1]){ if(rean[k,2]==aes[i,2]){ if(rean[k,3]==aes[i,3]){ out<-array(c(aes[i,1],aes[i,2],aes[i,3],aes[i,4]*0.1, (rean[k,5]-273.1)), dim=c(1,5)) write(out, file=DATAOUT, append=T) numdat<-numdat+1 s<-1 } } } k<-k+1 if(k==length(rean[,1])){ s<-1 k=1 } } s<-0 }else{nummissing<-nummissing+1} totaldat<-totaldat+1 } i<-i+1 } #Read the file DATAOUT; store this information in the array 'res'. res<-read.table(DATAOUT, header=F) #Create a scatter plot of reanalysis data as a function of station #data, and boxplots of station and reanalysis data. Save the #resultant graphs to the file PLOTOUT, in postscript format. postscript(PLOTOUT) plot(res[,4],res[,5], ylab=HREANLAB, xlab=HAESLAB, main=HTITLE) boxplot(res[,4], res[,5], ylab=BYLAB, xlab=BXLAB, main=BTITLE) dev.off() #Perform a linear regression on reanalysis data as a function of #station data. Save a summary of the results to the file STATOUT. sink(STATOUT) out1<-"The number of non-missing data points is" out2<-"The number of missing data points is" print(out1,quote=F);print(numdat) print(out2,quote=F);print(nummissing) comp.lm<-lm(res[,5] ~ res[,4]) sum<-summary(comp.lm) print(sum) sink() CompJ: ISOLATE='inv_rean.dates' SDATA='inv_rean.date' OUTDAT='compositePrec.dat' OUTTALLY="/home/jallen/compare/PrinceGeorge/compositePrec.tal" OUTPLOT="/home/jallen/compare/PrinceGeorge/compositePrec.ps" TITLE='Time series Composite for Daily Precipitation, Prince George' YLAB="Precipitation (mm)" XLAB='D-3 D-2 D-1 D D+1 D+2 D+3' ycol<-3 mcol<-4 dcol<-5 #---------------------Start of Program-------------------------------- #read in a table containing the desired dates, in PST. The year, month, and #day are found in collumns ycol, mcol, and dcol, respectively; this #information is saved in the array 'iso'. iso<-read.table(ISOLATE, header=FALSE) out1<-"Reading input data";print(out1, quote=F) #read station data file; this data is saved as the array sdata. sdata<-read.table(SDATA, header=FALSE) #set counter variables i<-1;j<-1;numdata<-0;ok<-1 #find the first entry in iso for which station data is present while(iso[j,ycol]