I have two NetCDF-Files. One of them holds information about the temperature in 2m (t2m) , the other one about outgoing long wave radiation (olr). I want to make a scatter plot. The first part of this exercise is already done: the task was to select a lon-lat-box from each NetCDF-file. It's going from 50N to 70N with -180W to 180 E. That's where the "50N70N comes from in the file name). Both files have a lot of values.
It's the first time I am working with the package ncdf in Rstudio. So what I already have done was to get all the variables from the files. As there is only one variable within the files, this was no problem at all.
Now comes my question: I just tried to plot the two files as a scatter plot, but I have the feeling that the program is plotting for each point all temperature and radiation values. I have too many points. Of course this is not what I want. I want that every box has only one t2m to one olr value.
Can you guys help me how to say in the script that it should only plot one temperature value to one radiation value? How can I say to plot separately box by box ? I hope you guys understand my question. I will upload the current plot.
Maybe I am all wrong and the program is already doing it like I want. Here are the print.ncdf from both files:
"file olr_50N70N.nc has 3 dimensions:" "lon Size: 144" "lat Size: 9" "time Size: 366" "------------------------" "file olr_50N70N.nc has 1 variables:" "float var179[lon,lat,time] Longname:var179 Missval:1e+30"
"file t2m_50N70N.nc has 3 dimensions:" "lon Size: 144" "lat Size: 9" "time Size: 366" "------------------------" "file t2m_50N70N.nc has 1 variables:" "float var167[lon,lat,time] Longname:var167 Missval:1e+30"
Here is my script:
library(ncdf) library(maps) t2m_50N70N <- open.ncdf("t2m_50N70N.nc") float_t2m_50N70N <- get.var.ncdf(t2m_50N70N,"var167") print.ncdf(t2m_50N70N) olr_50N70N <- open.ncdf("olr_50N70N.nc") float_olr_50N70N <- get.var.ncdf(olr_50N70N,"var179") print.ncdf(olr_50N70N) plot(float_t2m_50N70N, float_olr_50N70N, type="p", pch=20, col="red", lty=3)