An R package as an interface to Unidata netCDF (Version 4 or earlier) format data files.
Questions tagged [ncdf4]
98 questions
1
vote
1 answer
create raster brick from ncdf of irregularly spaced x and y
I'm fairly new to using R for GIS purposes. I have a netcdf file containing several variables with multiple dimensions (x,y,z,value and time). I am trying to turn this into a raster brick. The data is quite large so I need to pull data from a…

Jdan
- 149
- 10
1
vote
2 answers
Get data from OpenDap server that requires authentication using R
I'm trying to get data from an OPeNDAP server using R and the ncdf4 package. However, the nasa eosdis server requires username / password. How can I pass this info using R?
Here is what I'm trying to do:
require(ncdf4)
f1 <-…

Daniel
- 462
- 3
- 13
1
vote
0 answers
Subset MODIS L3SMI ncdf based longitude/latitude
I have time series Global MODIS L3SMI dataset in ncdf format,
how to subset this dataset on a specific location (i.e. Indonesia regions) based on longitude/latitude range. Then I want to write this dataset into ncdf file same as the original…

Eko Susilo
- 250
- 2
- 15
1
vote
1 answer
NetCDF in R: having trouble creating a map
So I've been using the following tutorial in R, to get accustomed to NetCDF (I use the netcdf4 package): http://geog.uoregon.edu/bartlein/courses/geog607/Rmd/netCDF_01.htm
However, I am not able to create a nice image for any particular year, in my…

GIS_newb
- 21
- 1
- 5
1
vote
0 answers
R ncdf4 packages install failed
I need install ncdf4 package on R 3.4.0, but it failed and told me the error "cannot find -lnetcdf". How can I install ncdf4…

Milton_Yu
- 11
- 3
1
vote
1 answer
how to convert ncdf4 to data.frame in R
I want use the function "filled.contour", but my data file are ncdf4 file.
how to convert ncdf4 file to data.frame in R?
Some advice?
thanks

Ana Alicia
- 11
- 2
1
vote
1 answer
Reading multiple netcdf files
I am trying to read multple nc4 files in r. below is the code I am using to execute this task;
library(ncdf4)
OSND_gpmr.df<-NULL
GPM_R.files= list.files(path,pattern='*.nc4',full.names=TRUE)
for(i in seq_along(GPM_R.files)) {
nc_data =…
0
votes
0 answers
changing time axis values of netcdf4 file using R
I'm tried to change time axis of given netcdf4 file with given .csv table, like pasting all contents of table into the netcdf4 file. however, every method I took using R with ncdf4 or python cdo failed so far. and ncvar_put command dosen't seems to…

Dongil Kim
- 1
- 1
0
votes
0 answers
How to put 2-D fitted SPI6 back to 3-D array, add lon and lat dimensions and write it as nc file
I have Netcdf data file called "P_monthly.nc", which contains monthly CHIRPS rainfall data (1981-2022). The file is light (just 49 MB).
I have reshaped the array to matrix to calculate SPI6 using SPEIpackage. I then calculated SPI6 by splitting data…

Mukhtar Abdi
- 391
- 1
- 12
0
votes
1 answer
Change longitude from 20 to 380 to -180 to 180 in r raster file
I'm trying to work with a raster file which has longitude extending from 20 to 380 degrees.
library(raster)
library(ncdf4)
raspH <- raster('~/Downloads/GLODAPv2.2016b_MappedClimatologies/GLODAPv2.2016b.pHts25p0.nc', varname = 'pHts25p0', band =…

Lukas
- 655
- 8
- 20
0
votes
0 answers
How to find specific values in a nc file?
So I have time, latitude, longitude and variable data in my nc file. I am trying to correlate it to distribution data. Is there any way to search/filter rows per lat and longitude or by date?
0
votes
1 answer
How to export print output as csv in R?
I have a .nc file which contains time series data of 2010-2020 for a region. I want to export the time series in a .csv format. I am using following code in R to do the same. I am able to print the output. Could anyone please help me how can I…

Alexia k Boston
- 97
- 6
0
votes
0 answers
Problems creating NetCDF file from data.frame in R
I am having problems creating a NetCDF file from my data.
The data.frame is massive (110142 rows) and looks something like this:
df <- data.frame(
lon = c(-11.0, -10.9, -10.8, -10.7, -10.6, -10.5, 30.6, 30.7, 30.8, 30.9, 31.0, 31.1),
lat = c(34,…

sofl
- 1
- 1
0
votes
1 answer
Problem in processing with multiple .nc files in R
I am using following code in R to subset a 1 .nc file while extracting 1 variable. The code is running successfully.
I want to modify the existing code to input and process multiple .nc files. I tried but no success. Could anyone please…

Alexia k Boston
- 97
- 6
0
votes
2 answers
R - Matching two datasets using closest lat / lon coordinates
Edit: I tried the following nested loop but I keep getting errors:
install.packages("hutilscpp")
library(hutilscpp)
# Initialize an empty list to store the matching results
matching_results <- list()
# Nested for loop to match each point in…

AS1
- 1
- 3