Questions tagged [ncdf4]

An R package as an interface to Unidata netCDF (Version 4 or earlier) format data files.

98 questions
1
vote
1 answer

Incorrect date/time conversion when reading netcdf file

I have a netcdf file (nc.in) containing 30 years of 3-hourly temperature data from 1981-2010. When I convert time to the gregorian calendar the resulting dates are incorrect. The output starts on 02/13/04 (should be 01/01/1981) and then skips three…
DJ-AFC
  • 569
  • 6
  • 16
1
vote
1 answer

R - Extracting all variables of ncdf4 file into separate variable names

I am opening a netcdf file and want to extract all variables into their own variable names using a non-repetitive method. Currently I can do this using the following #route of file we want to open fn <- "grid_T_19800105.nc" #opens netCDF file nc <-…
Fish_Person
  • 107
  • 5
1
vote
1 answer

stars::read_stars and raster::raster have different projections when reading the same .nc file

I'm trying to read a .nc raster file in R. The older function raster::raster() reads the data perfectly fine. I'd like to reproduce the results using a newer function stars::read_stars(), but somehow it does not work for me. The data…
Miao Cai
  • 902
  • 9
  • 25
1
vote
2 answers

terra not reading .nc files (GDAL error 4)

I'm trying to open a .nc file with terra, but I'm getting the following error: '' not recognised as a supported file format. (GDAL error 4) Reproducible example here (16mb nc file): if (!file.exists("HadISST_ice.nc")) { …
1
vote
0 answers

Error while converting netcdf data into a raster brick

I'm trying to visualize monthly averages of RegCM output I joined using CDO but I'm not being able to do it. In order to do that I was trying to find a way to plot de monthly averages of my variable "pr" as you could do using GrADS. I found that a…
jnava1612
  • 71
  • 8
1
vote
2 answers

How to add variable from nc1 to nc2 file without deleting/removing the variables in nc2?

I have two kinds of variables in two different nc files. The dimension and other things are same, I just have to add one more variable in the existing nc file, How can I do this (using CDO or R or any other) I used the command line (cdo…
1
vote
1 answer

Accessing netcdf files from a URL linkwith ncdf4 in R

Are there any workarounds to the problem with ncdf4::nc_open not being able to access some .nc files from a URL? I would like to avoid having to download the file first since this is for a shiny app deployed on a server and so I want to avoid users…
Danny
  • 448
  • 3
  • 15
1
vote
3 answers

r ncdf4 "I could not find the requsted var!"

I am getting a 'could not find the requested var' error, even though the variable name is valid - it works with other netcdf libraries - including NCO, the R netcdf4 library, and Panoply: This example uses a file called test2.nc: This works as…
David LeBauer
  • 31,011
  • 31
  • 115
  • 189
1
vote
2 answers

How to fix C function R_nc4_get_vara_double returned error in ncdf4 parallel processing in R

I want to download nc data through OPENDAP from a remote storage. I use parallel backend with foreach - dopar loop as follows: # INPUTS inputs=commandArgs(trailingOnly =…
Hai nguyen
  • 43
  • 4
1
vote
0 answers

extract climate time series from E-OBS from multiple closest points to the point of interest

I would like to update the following codes to extract daily climate time series of E-OBS database to multiple (user defined) closest points: I use ncdf4 package to read E-OBS data: library(ncdf4) obsdata <-…
naRuser
  • 13
  • 3
1
vote
0 answers

R: Converting excel spreadsheet to netCDF, beginner

I am completely new to R (and stack overflow) and have the following problem. I have an excel spreadsheet containing environmental variables and I need to convert it to a netCDF file (.nc). I found the manual on R but am not able to implement it.…
Charlotte
  • 21
  • 2
1
vote
1 answer

accessing large dataset from NetCDF4 file using R

I am trying to use data from this file (MOD13.A2010.unaccum.nc4) in a project. I have installed and loaded the ncdf4, raster, ggplot2, and viridis librarys. I open the file successfully using: mcd_file <- nc_open("C:\\Program…
Lerner54
  • 31
  • 2
1
vote
1 answer

How to read NetCDF file "NDVI NOAA AVHRR" as raster in R?

I would like to display the NDVI parameter with R and subsequently extract the values of this parameter in each region. My file is in NetCDF (.nc) format downloaded under the following link:…
tazrart
  • 167
  • 1
  • 15
1
vote
0 answers

Pixel-wise Standardized Precipitation Index (SPI) calculation of monthly rainfall raster in R

I want to calculate Standardized Precipitation Index (SPI) of monthly rainfall raster in R. I have seen one question related to this in SO (R Standardized Precipitation Index .nc file), but it was not having any answers. So, I am putting a new…
UseR10085
  • 7,120
  • 3
  • 24
  • 54
1
vote
1 answer

Extracting data from NetCDF file

I'm working in R trying to use the data found here (https://datadryad.org/resource/doi:10.5061/dryad.dk1j0; two top files) to create a table similar to this: [administrative_name, GDP2010, GDP2011....., GDP 2015] As far as i can see i need to…
minium
  • 43
  • 5