Hi, Please help me. I am trying to get information on "soi" from the NetCDF file (please see the attached).
The file is showing this info- float soi(time=2001, *MCrun=20, members=100*); :description = "soi"; :long_name = "Southern Oscillation Index"; :units = ""; :level = "sfc"; And Dimentions---- 5 dimensions: *time Size:2001* description: time long_name: Time standard_name: time units: *days since 0000-01-01 00:00:00* calendar: noleap actual_range: 0 *actual_range: 730000* * MCrun Size:20* I am not aware of *MCrun* and *members *gaven in a file. I wants to create csv output and ggplot (line) in form of years. like this format--- *Longitude Latitude Year soi* Please help me, my script is here- rm(list=ls(all=TRUE)) library(ncdf4) library(ggplot2) library(ncdf4.helpers) setwd("D:/work/") ncfile <-nc_open("posterior_climate_indices_MCruns_ensemble_full_LMRv2.1.nc ") head(ncfile) lon <- ncvar_get(ncfile, "lon_npac") lat<- ncvar_get(ncfile, "lat_npac", verbose = F) tt<- ncvar_get(ncfile, "time") units<- ncatt_get(ncfile, "time", "units") soi <- ncvar_get(ncfile, "soi") soi_final = data.frame(cbind(lon, lat, tt, soi)) #output write.csv(amo_final, "soi.csv", row.names = FALSE) #plot ggplot(data = soi_final, aes(x = time, y = soi)) + geom_line() + xlab("Year") + ylab("soi") + ggtitle("SOI from 1-2001") + theme_classic() thank you wish you good health. Regards S. Singh posterior_climate_indices_MCruns_ensemble_full_... <https://drive.google.com/file/d/1r5PzXxShmeOcoBDXUk7Nfr3EzCqmQwGb/view?usp=drive_web> [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.