An R package as an interface to Unidata netCDF (Version 4 or earlier) format data files.
Questions tagged [ncdf4]
98 questions
0
votes
1 answer
Write a matrix of strings to netCDF file in R
Is it possible to write a matrix of string variables to a netCDF file in R? When I run the following the R session aborts.
library(ncdf4)
# define a small set of netCDF dimensions
lon3 <- seq(0, 2.0, 0.5)
nlon3 <- length(lon3)
lat3 <- seq(0, 0.5,…

Dave_L
- 363
- 2
- 10
0
votes
1 answer
How to read this .nc file (from NCAR)
To proceed my study, I downloaded the NCAR datasets from the CMIP website, including tasmax, tasmin, pr, and rsds variables. However, I cannot read these datasets properly using R codes though those outcomes that look wrong can be obtained. The NCAR…

zongxu li
- 1
- 2
0
votes
2 answers
How i can convert ncdf (of Sentinel_5_L2) files to geotiff?
I am trying to do a geotiff file with a netcdf file. I have this file (Sentinel_5_L2). But my code is not run. Anyone know as create the geotiff file?
File https://wetransfer.com/downloads/7c5692bef082bc64999e10d8a7a91e8f20211116115821/7774f8
This…

Bryan Alemán
- 37
- 4
0
votes
1 answer
How to correctly get a NCDF file into a data.frame?
Since a couple of weeks ive been trying to get a NetCDF file into a dataframe. Even though Im succesfull in extracting the variables/dimensions and plotting a slice from the ncdf file, all the data is husseled when cbinding it into a dataframe and…

HeinB
- 1
- 2
0
votes
1 answer
Is there a way to check if a variable exists in a netcdf file already in R?
I created a NetCDF file with a number of variables in it. While debugging and testing writing out new variables to the files I created the variable 'RH' in some files, but the majority still have no 'RH' in them. Now I want to run my script that…

matlabcat
- 172
- 2
- 12
0
votes
2 answers
Extract the data from NC file using R studio
I have the NC file with 0.5 resolution containing yearly PDSI index from 1900 to 2013 of globe. how can I get the one value for each year for entire Europe/Asia/America.
thanks a lot
0
votes
2 answers
Passed a filename that is NOT a string of characters! (RMarkdown)
I'm accessing ncdf files directly from a website [here][1] into my RMarkdown.
When I try to read the file using the nc_open functions as in the code below, I get the error 'Passed a filename that is NOT a string of characters!'
Any idea how I can…

Kami
- 3
- 2
0
votes
1 answer
loop to open, get variables and export multiple nc files in r
I have over 60 nc files for specific coordinates which contain only one variable. I want to extract the variables (tasmax) from them in a csv file.
The code for one file is:
ncdata <-…

Korina
- 41
- 5
0
votes
1 answer
How to get date and depth from netcdf file and merge into a data frame?
I downloaded temperature data from
https://www.nodc.noaa.gov/cgi-bin/OC5/woa18/woa18.pl
and I opened it in R. I am trying to create a data frame Temp where all the temperature, depth and date information are merged into a single data frame .
I can…

L55
- 117
- 8
0
votes
1 answer
R Memory Management: Getting values of large RasterFile prompts error: cannot allocate vector of size n GB
I am aware that there are similar questions and problems around but mine is very specific.
I'm working with the WorldClim and Chelsa Climate data sets in 30 arc-second resolution. In the process I want to put the specific datasets into a ncdf4 file.…

Helge
- 3
- 3
0
votes
1 answer
Looping through nc files in R
Good morning everyone,
I am currently using the code written by Antonio Olinto Avila-da-Silva on this link: https://oceancolor.gsfc.nasa.gov/forum/oceancolor/topic_show.pl?tid=5954
It allows me to extract data of type sst/chlor_a from nc file. It…

Gaspard
- 1
- 1
0
votes
0 answers
why am I getting error $ operator is invalid without using $ in my code (in R)?
I'm creating an array from netcdf files and I keep getting this error at the start of the for loop: Error: $ operator is invalid for atomic vectors.
This is my code:
vec0 <- vector()
time <- c(vec0,1:1952)
vec1 <- vector()
temp <-…

Ktass
- 47
- 1
- 1
- 7
0
votes
0 answers
Including a map on "levelplot" in R?
I'm trying to include a map of the shoreline, and possibly also the country boundaries, on top of a levelplot with latitude and longitude coordinates.
The code I have so far for the levelplot is:
library(lattice)
library(ncdf4)
ncin <-…

AlexLee
- 429
- 4
- 11
0
votes
1 answer
How to extract data as raster from binary file
I have the binary file and its control file is provided in figure Control File. I want to extract the rain with latitude and longitude as raster in r. Can anybody help?
library(weathercan)
library(rNOMADS)
library(rgdal)
…

Sikandar Ali
- 11
- 4
0
votes
1 answer
Gaps in RasterLayer using R
I have this shapefile, from where I took the first two columns (left and top) to acess another database and get values of elevation.
Simple feature collection with 959 features and 5 fields
geometry type: MULTIPOINT
dimension: XY
bbox: …

Fabio Seixas
- 1
- 1