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
In R with ncdf4, open netcdf file, modify, and save to disk
I am trying modify and save a netcdf file in R. I can modify the values, but cannot seem to get the file to save and keep the modified values. Here is what I am doing:
Open file with ncdf4 package
library(ncdf4)
nc=nc_open('RMinit_newvalues2017.nc',…

Ryan
- 316
- 2
- 14
0
votes
0 answers
R and GIS: having trouble with a loop to save files
The relevant NCDF file is here: https://www.ncdc.noaa.gov/paleo-search/study/19419
I have a NCDF file, and am using the following loop to first save each file as a CSV file, and then as a shapefile:
for (m in 1:500){
#First I want to save my CSV…

GIS_newb
- 21
- 1
- 5
0
votes
1 answer
Converting raster stack extent from meters to lat/lon coordinates
I have a raster stack in the following format which I converted to NetCDF using this method. This works but the latitude and longitude variables are in 'meters' which is the extent of the raster file, and I need them to be in decimal degrees. The R…

Pad
- 841
- 2
- 17
- 45
0
votes
2 answers
R: looping to save multiple shapefiles
When I try to use writeOGR, plus a loop, to save my shapefiles, it doesn't do anything but give me an error message:
Error in writeOGR(plot.locationsSP_DROUGHT, dsn, layer1, driver = "ESRI Shapefile") : layer exists, use a new layer…

GIS_newb
- 21
- 1
- 5
-1
votes
1 answer
Why is dot notation used when instantiating an R variable name?
I came across a piece of code from https://rpubs.com/boyerag/297592
On one line they have the following code:
ndvi.array <- ncvar_get(nc_data, "NDVI")
I do not understand what is the significance of ndvi.array. Is this some special way of creating…

Shankar Ramharack
- 13
- 3
-1
votes
1 answer
Wrong output when converting matrix to raster
I'm testing some codes of converting matrix to NetCDF file. But the output produces a strange raster/matrix that was in a completely different order. Any idea of the cause?
This is the matrix
mx <- matrix(1:162,ncol=18,byrow=T)
mx
[,1] [,2]…

LynnLatitude
- 23
- 5
-1
votes
1 answer
Merge data from NetCDF files
I am new to NetCDF files. I have daily data on global sea surface temperature from 1981-2014 from NOOA's AVHRR Pathfinder data version 5.3. The dataset consists of 365x2 .nc files for each year: one each for night and day temperatures for each day…

Mihir Sharma
- 51
- 1
- 7
-1
votes
1 answer
Three-dimensional array in R for netCDF
I need to create a three-dimensional array in R which contains the data of a raster with a resolution of 538x907 pixel. I have this raster for each hour in one month, so in January there are 744 raster files. I have to change some values by R and…

SnoopyBrown
- 51
- 8