Displaying 9 results from an estimated 9 matches for "ncvar_get".
2018 Mar 28
3
Creating the right table from lapply list
...will be 696 to 744 (depending on how many days x 24 hours there were in the month).What I achieved is to to read the values from all 12 files stored in directory with a function and add them as vectors to a lapply-list:
Myfunction <- function(filename) {
nc <- nc_open(filename)
lon <- ncvar_get(nc, "lon")
lat <- ncvar_get(nc, "lat")
RW <- ncvar_get(nc, "X")
HW <- ncvar_get(nc, "Y")
pt.geo <- c(8.6810 , 50.1143)
dist <- sqrt( (lon - pt.geo[1])^2 + (lat - pt.geo[2])^2 )
ind <- which(dist==min(dist, na.rm=TRUE),arr.ind=TRUE)
si...
2012 Aug 28
4
[ncdf4] error converting GEIA data to netCDF
summary: I can successfully ncvar_put(...) data to a file, but when I
try to ncvar_get(...) the same data, I get
> Error in if (nc$var[[li]]$hasAddOffset) addOffset = nc$var[[li]]$addOffset else addOffset = 0 :
> argument is of length zero
How to fix or debug?
details:
R code @
https://github.com/TomRoche/GEIA_to_NetCDF
successfully (if crudely) uses R packages={ncdf4,...
2018 Mar 29
0
Creating the right table from lapply list
...nding on how many days x 24 hours there were in the month).What I achieved is to to read the values from all 12 files stored in directory with a function and add them as vectors to a lapply-list:
Myfunction <- function(filename) {
nc <- nc_open(filename)
lon <- ncvar_get(nc, "lon")
lat <- ncvar_get(nc, "lat")
RW <- ncvar_get(nc, "X")
HW <- ncvar_get(nc, "Y")
pt.geo <- c(8.6810 , 50.1143)
dist <- sqrt( (lon - pt.geo[1])^2 + (lat - pt.geo[2])^2 )
ind <- which(dist==min(dist, na.rm...
2017 Aug 28
3
Extracting subset from netCDF file using lat/lon and converting into .csv in R
...ibrary(ncdf4)
# set path and filename
setwd("D:/netcdf")
ncname <- "gfdl_preci"
ncfname <- paste(ncname, ".nc", sep = "")
dname <- "prAdjust"
# open a netCDF file
ncin <- nc_open(ncfname)
print(ncin)# get longitude and latitude
lon <- ncvar_get(ncin,"lon")
nlon <- dim(lon)
head(lon)
lat <- ncvar_get(ncin,"lat")
nlat <- dim(lat)
head(lat)
print(c(nlon,nlat))
# get time
time <- ncvar_get(ncin,"time")
time
tunits <- ncatt_get(ncin,"time","units")
nt <- dim(time)
nt
tunits...
2016 Apr 22
2
Unexpected values obtained when reading in data using ncdf and ncdf4
...basic:
for(i in 1:length(thesenames[,1])){
data <- nc_open(paste(INDIR, thesenames[i,c("wholename")], sep=""), write=F)
d.vars <- names(data$var)
d.size <- (data$var[[length(d.vars)]])$size
# Obtaining longitude and latitude values
d.lon <- as.vector(ncvar_get(data, varid="lon", start=c(1,1), count=c(d.size[1],d.size[2])))
d.lat <- as.vector(ncvar_get(data, varid="lat", start=c(1,1), count=c(d.size[1],d.size[2])))
# Obtaining climate data values
df.clim <- data.frame(rn=seq(1:length(d.lon)))
for(y in 1:d.size[3]){...
2017 Aug 28
0
Extracting subset from netCDF file using lat/lon and converting into .csv in R
...t; setwd("D:/netcdf")
> ncname <- "gfdl_preci"
> ncfname <- paste(ncname, ".nc", sep = "")
> dname <- "prAdjust"
> # open a netCDF file
> ncin <- nc_open(ncfname)
> print(ncin)# get longitude and latitude
> lon <- ncvar_get(ncin,"lon")
> nlon <- dim(lon)
> head(lon)
>
> lat <- ncvar_get(ncin,"lat")
> nlat <- dim(lat)
> head(lat)
>
> print(c(nlon,nlat))
> # get time
> time <- ncvar_get(ncin,"time")
> time
>
> tunits <- ncatt_get(ncin...
2016 Apr 22
0
Unexpected values obtained when reading in data using ncdf and ncdf4
...es[,1])){
> data <- nc_open(paste(INDIR, thesenames[i,c("wholename")], sep=""),
> write=F)
> d.vars <- names(data$var)
> d.size <- (data$var[[length(d.vars)]])$size
>
> # Obtaining longitude and latitude values
> d.lon <- as.vector(ncvar_get(data, varid="lon", start=c(1,1),
> count=c(d.size[1],d.size[2])))
> d.lat <- as.vector(ncvar_get(data, varid="lat", start=c(1,1),
> count=c(d.size[1],d.size[2])))
>
> # Obtaining climate data values
> df.clim <- data.frame(rn=seq(1:length(d.lon))...
2012 Nov 18
2
[newbie] convert 3D spatial array to dataframe
summary: how to convert a 3D array (as obtained from ncdf4::ncvar_get)
to a dataframe suitable for use by lattice::levelplot(), e.g.,
levelplot(conc ~ lon * lat | lev, data = data.frame)
details:
I have atmospheric data in netCDF files specifying gas concentrations
over a 3D space with dimensions longitude, latitude, and (vertical)
level. I need to plot the data b...
2013 Feb 05
1
ncdf4 installation problem: undefined symbol [SEC=UNCLASSIFIED]
...html
ncvar_def html
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ncvar_def.Rd:67: missing file link 'ncvar_put'
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ncvar_def.Rd:100: missing file link 'ncvar_put'
ncvar_get html
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ncvar_get.Rd:77: missing file link 'ncvar_put'
ncvar_rename html
print.ncdf4 html
** building package indices
** testing if ins...