[R] filtering of CO2 observation time series residuals using FFT

2017-07-10 Thread Yogesh Tiwari via R-help
Hi, I have CO2 observations time series, I can calculate residuals by removing seasonal cycle and trend. But how to filter residuals using Fast Fourier Transform (FFT) which transforms the data into the frequency domain. And then apply a low pass filter function to the frequency data, then transfo

[R] how to calculate spatial correlation between two data sets

2016-03-19 Thread Yogesh Tiwari via R-help
Dear R Users, I am using R on Windows. 1) How to calculate spatial correlation between point observation at one location and model simulated data over some particular region. For example, observation is at only one location 18N, 72 E and model is at 0.5x0.5 grid. So how to calculate correlation b

Re: [R] how to read netcdf file in R

2012-04-13 Thread Yogesh Tiwari
S_2002_10_added-all-years.nc has 1 variables:" [1] "float co2[lon,lat,time] Longname:co2 Missval:1e+30" On Mon, Apr 2, 2012 at 9:20 PM, David William Pierce wrote: > On Mon, Apr 2, 2012 at 1:54 AM, Yogesh Tiwari > wrote: > > > How to read netcdf files in R ? > > Which

[R] how to read netcdf file in R

2012-04-02 Thread Yogesh Tiwari
Dear R Users, I am using R 2.14.1 on windows How to read netcdf files in R ? Which packeges do we need to install for this, and what commands are used for reading netcdf files. Thanks, Best Regards, Yogesh Tiwari -- Yogesh K. Tiwari (Dr.rer.nat), Scientist, Centre for Climate Change

[R] how do we read netcdf / hdf files in R?

2011-03-16 Thread Yogesh Tiwari
Dear R Users, How do we read netcdf / hdf format files in R ? Also, can we convert netcdf to hdf format in R? Great Thanks, Best Regards, Yogesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/m

[R] how to plot average line of a var at y-axis

2011-02-15 Thread Yogesh Tiwari
Dear R Users, I have a time series of CO2 (1993-2002) x-axis as time y-axis as CO2 I would like to over plot a CO2 average line at y-axis on the time series plot. How to do it. Kindly help, Thanks, Regards, Yogesh [[alternative HTML version deleted]]

Re: [R] how to control ticks

2010-12-21 Thread Yogesh Tiwari
ented, > minimal, self-contained, reproducible code). > > > > On Tue, Dec 21, 2010 at 7:36 AM, Yogesh Tiwari > wrote: > > Hi, > > I want 12 ticks at axis 1 and want to write Jan-Dec on each. > > > > something like: > > > > axis(1, at=1:12, >

[R] how to control ticks

2010-12-21 Thread Yogesh Tiwari
Hi, I want 12 ticks at axis 1 and want to write Jan-Dec on each. something like: axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) I could omit default ticks but now how to control ticks. plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, ylab=NA,col

[R] time in year, month, day, hour ?

2010-09-30 Thread Yogesh Tiwari
Dear R Users, I did not get any reply on my question so I am re-asking. This time I am giving sample data: 160.3162 -13.5993 -0.4353 46.09380.1877 -0.194E-07 260.3713 -13.5992 -0.4423 46.12410.2057 -0.231E-06 360.3430 -13.5981 -1.6163

[R] how to convert time axis in year, month, day, hour ?

2010-09-29 Thread Yogesh Tiwari
Dear R Users, I have model simulated data for 240 days. The day 1 is Jan 1, 2009, 00:00 hrs and then with 3-hourly interval and so on. The time axis is 1,2,3,4..1920; so the total rows in the data are 1920. How to convert above time axis in "year" "month" "day" "hour" format Great Thank

[R] how to write legend of a plot

2010-07-22 Thread Yogesh Tiwari
Dear R Users, If we issue simple plot command in R we don't get legend of the plot automatically. For example, following lines plots two curves, but to write a legend of these two curves there is no simple command. I checked with ?legend but it seems bit complicated for me. Does anyone know how t

Re: [R] how to use 'points' function to plot two curves with errbar

2010-06-15 Thread Yogesh Tiwari
=== > Also we really should have some sample data., It have to be the entire data > set or even the real data as > long as it has the same format and layout. > > Have a look at ?dput for way to include some easily useable data. > > So

[R] how to use 'points' function to plot two curves with errbar

2010-06-05 Thread Yogesh Tiwari
Dear R Users, I am using R on windows. how to use 'points' function to plot two curves with errbar I am doing like: x.val <- as.integer(names(co2mean)) errbar(x.val, co2mean, co2mean + co2sd, co2mean - co2sd, xaxt='n', col=1, xlab=NA,ylab=NA)# obs error bar lines(x.val, co2mean, col=1, lwd=2) e

[R] how to calculate growth rate of a variable

2009-07-24 Thread Yogesh Tiwari
Dear R Users, If a variable, say CO2(ppm), is varying with time. Then how to calculate CO2 (ppm) growth rate /a-1 I have CO2 time series (1991-2000), as: time, year, month, day, hour, min, sec, lat, long, height, CO2 1991.476722 1991 6 24 0 5 0 -38.93 145.15 4270 353.680 1991.476741 1991 6 24 0 15

[R] how to calculate growth rate of CO2 (ppm) time series

2009-07-22 Thread Yogesh Tiwari
Dear R Users, I have CO2 mixing ratio(ppm) time series data during 1991-2000. I would like to calculate CO2 growth rate /ppm.a-1 (is it derivative dt/dco2 ??) Kindly can any one advise how to calculate above. My data file looks like; time, year, month, day, hour, min, sec, lat, long, height, CO2

[R] time series fiting and residual computing

2009-07-15 Thread Yogesh Tiwari
Dear 'R' Users, I have CO2 timeseries which I want to fit with fourth harmonic function and then would like to compute residuals. I tried with two option but not sure which one is correct, kindly any one can help correcting me: # #I would like to fit a model with Fourth harmonic function as: #m(

[R] harmonic function fiting? how to do

2009-02-10 Thread Yogesh Tiwari
Dear R Users, I have a CO2 time series. I want to fit this series seasonal cycle and trend with fourth harmonic function, and then compute residuals. I am doing something like: file<-read.csv("co2data.csv") names(file) attach(file) fit<-lm(co2~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*

[R] map geographical boundaries

2008-11-03 Thread Yogesh Tiwari
Hello, I want to crate a blanck geographical map showing continent boundary of region: latitude = -5:35 longitude = 35:100 If we create data like: lat= -5,0,5,10,.. long=35,40,45,50,. Then how to map (long,lat) and create a map plot. Many thanks, Yogesh [[alternative HTML

[R] Root-Mean-Square(RMS) Difference

2008-09-30 Thread Yogesh Tiwari
Dear R users, I am comparing two data sets (CO2 observation vs. CO2 simulation, during 1993-2002). In order to do it I am calculating Root-Mean-Square(RMS) difference with following formula: > sqrt(sum((observed_residual - simulated_residual)^2)/n) # 'n' is number of observations Residuals are co

Re: [R] climatological standard deviation- (question re-posted)

2008-09-24 Thread Yogesh Tiwari
rror bar on the ploted curve. Is this the best way for such a calculation ? Kindly help, Best Regards, Yogesh On Wed, Sep 24, 2008 at 9:41 PM, Sarah Goslee <[EMAIL PROTECTED]>wrote: > On Wed, Sep 24, 2008 at 8:43 AM, Yogesh Tiwari > <[EMAIL PROTECTED]> wrote: > > Sorry

[R] climatological standard deviation- (question re-posted)

2008-09-24 Thread Yogesh Tiwari
Sorry for re-posting the question, I did not get any reply. Kindly reply please if any one can. ### Hello R users, I have a montly time series over a several year period. It's easy to compute a monthly climatology (12 values), Now, I would like to calculate the corresponding standard deviation, i

[R] climatological standard deviation

2008-09-24 Thread Yogesh Tiwari
Hello R users, I have a montly time series over a several year period. It's easy to compute a monthly climatology (12 values), Now, I would like to calculate the corresponding standard deviation, ie the 12 values calculated from the january values, february values, etc. What's the best way for suc

[R] how to plot monthly mean data showing missing months

2008-09-12 Thread Yogesh Tiwari
Dear R users, As per my attached script I am ploting monthly mean data which has missing months. But in the plot missing months are not shown (plot attached). Kindly help how to show complete plot (Jan-Dec) with missing months. Regards, Yogesh file<-read.csv("CRI-run109-run110.csv") names(file) a

[R] how to over-plot another variable on axis-4

2008-08-14 Thread Yogesh Tiwari
Hello R Users, I am using R on Windows, I am ploting CO2 (350,380) variying with year(1993,2003) I want to over-plot rainfall (10,250) varying with year(1993,2003) on axis-4 axis-1=year(1993,2003), axis-2=CO2(350,380) axis-3=None axis-4=rainfall(10,250) Kindly help how to over-plot another varia

[R] date to decimal date conversion

2008-07-16 Thread Yogesh Tiwari
Hello R Users, I want to convert date (yr, mo, day, hr, min, sec) to decimal date, for example: Date (in six columns): yr mo dy hr minsec 1993 02 13 05 52 00 Converted to Decimal date : 1993.3542 How to write a small code in R so I can convert six column date to

[R] error bar ploting problem with 'arrows' function

2008-01-28 Thread Yogesh Tiwari
Hello, I used 'arrows' function to plot the error bar but it dosen't work always. For example: Similar commands on two different data sets gives first result OK and second result NOT (attached plot1 is OK and plot2 is NOT). Plots as well as data file is attached here. Below is the script which I

[R] error bar position setting

2008-01-22 Thread Yogesh Tiwari
Hi, I am using R on Windows XP. I am using 'arrows' funtion to plot the variance as error bar, BUT error bar goes only one side of the data point, I need to plot the error bar on both side of the data point (plot is attached), I am using following commands to plot, plot(file3$lat,file3$STotwoKm,