Questions tagged [netcdf4]

Questions related to NetCDF (Network Common Data Form) format and corresponding libraries/implementations may have this tag.

In 2008, the netCDF4 format was added to support per-variable compression, multiple unlimited dimensions, more complex data types, and better performance, by layering an enhanced netCDF access interface on top of the HDF5 format.

At the same time, a fourth format variant, netCDF-4 classic model format, was added for users who needed the performance benefits of the new format (such as compression) without the complexity of a new programming interface or enhanced data mode.

Every netCDF-4 or netCDF-4 classic model file can be read or written by the HDF5 library version 1.8 or later, so in that respect netCDF-4 files are already HDF5 files and need no conversion.

According to netCDF FAQ installing the netCDF4 is required for any of the following situations:

  • you need to access netCDF data that makes use of netCDF-4 compression or chunking
  • you need to access data in all netCDF formats including netCDF-4 or netCDF-4 classic model formats
  • you need to write non-record variables larger than 4GiB or record variables with more than 4GiB per record
  • you are installing netCDF to support other software packages that require netCDF-4 features
  • you want to write data that takes advantage of compression, chunking, or other netCDF-4 features
  • you want to be able to read netCDF-4 classic model data with no changes to your current software except relinking with the new library
  • you want to benchmark your current applications with the new libraries to determine whether the benefits are significant enough to justify the upgrade
  • you need to use parallel I/O with netCDF-4 or netCDF-4 classic files
651 questions
2
votes
1 answer

Using parallel NetCDF to save a distributed 3D complex array

I have an MPI-based program written in Fortran which produces a 3D array of complex data at each node (sections of a 2D time-series). I would like to use parallel I/O to write these arrays to a single file which can be relatively easily opened in…
2
votes
0 answers

conflict between missing_value attribute type and variable type

when I try to read in a netcdf file that I have generated using python netCDF4 class, I get a message like: UserWarning: WARNING: missing_value not used since it cannot be safely cast to variable data type if I try to read in the data Q2_daily,…
2
votes
0 answers

Issues reading NetCDF4 LST files from Copernicus

I have a series of hourly LST data from Copernicus. These can be read and displayed fine in Panopoly (Windows version 4.10.6) but: Crash QGIS 2.18.13 when opening with the 'NetCDF4 Browser' plugin (V0.3) Reads LST variable incorrectly using R ncdf4…
TCampbell
  • 21
  • 1
2
votes
0 answers

Python module incompatibilities

I have just installed gdal into my Python3 root environment using conda: conda install -c conda-forge gdal Installation went fine with the usual updates of some dependencies. Now returning to some of my scripts, both netCDF4 and…
izzyrizzy
  • 43
  • 4
2
votes
0 answers

'ncdf4' R package error when getting a variable

I have 32 ncdf4 data that I wish to convert to raster. The script I used works perfectly fine for all data but two. In two of the datasets I get the following error when trying to assess a variable through the ncvar_get command. Error in…
2
votes
1 answer

reading arrays from netCDF, why I get a size of (1,1,n)

I am trying to read and later on to plot data from a netcdf file. Some of the arrays contained at the .nc file that I am trying to store as variables, are created as a (1,1,n) size variable. When printing them i see [[[ numbers, numbers,....]]]. Why…
Rania S
  • 21
  • 3
2
votes
1 answer

Python netCDF4 - adding a new variable to existing file with change in shape

I have two netCDF files: file1.nc and file2.nc The only difference is that file1.nc contains one variable 'rho' which I want to append to file2.nc but by modifying the variables. The original file2.nc does not contain 'rho' in it. I am using…
2
votes
1 answer

How to write datetime information to netcdf4?

Essentially, I would like to open a netcdf file, read out the time stamps for individual pixels and then write the timestamps into a new file. Here is my pseudo-code: f10 = Dataset(nc_f10, 'r') Time_UTC_10 =…
j_hailglim
  • 41
  • 1
  • 7
2
votes
0 answers

Kernel dies when trying to open Netcdf NARR file

I'm trying to open NARR Netcdf files using netCDF4 to read its data, but when I try to open it, the kernel keeps dying. I'm using spyder with python 2.7 # -*- coding: utf-8 -*- import netCDF4 as nc f =…
G.Couture
  • 21
  • 1
2
votes
1 answer

Select data along non-conventional dimension with CDO or NCO

I have a large number of NetCDF files from which I would like to extract a small number of variables for one location, and merge them into a new NetCDF file. The dimensions of the files are: dimensions: time = 18 ; level = 65 ; levelh =…
Bart
  • 9,825
  • 5
  • 47
  • 73
2
votes
0 answers

Load selection GFS-ensemble openDAP data into memory (Python)

I want to download a subselection from GFS-ensemble data from an OpenDAP server via netCDF and xarray. However, when trying to load the subselection into memory, the program crashes after a while returning a RuntimeError (netCDF: I/O failure). The…
2
votes
0 answers

Reading an attribute value from a NetCDF4 file with nested groups

This should be trivial but I can't for the life of me figure out how to do this: I am trying to read an attribute value from a NetCDF4 file in R. Now, my NetCDF4 file (uploaded here) is fairly complex, i.e. it contains nested groups. I would like…
philament
  • 21
  • 3
2
votes
0 answers

Cropping Netcdf rasters in R

I am still working in the same project where I asked this question. And I am getting by allright, but my processing times are too long, for each NetCDF file I am reading it, getting a stack form several of the time-slices, and then cropping each of…
Derek Corcoran
  • 3,930
  • 2
  • 25
  • 54
2
votes
1 answer

Only positive latitude and longitude when importing netcdf in R from paleoView probably wrong projection

I used the paleoview software to download some variables from past climate, including the mean temperature from 15000BP-10000BP (I could upload a file on request but its a GB at least). The main problem is that when I read the raster, it contains…
Derek Corcoran
  • 3,930
  • 2
  • 25
  • 54
2
votes
0 answers

how get the average of array extracted from several netcdf file with datetime,hour as an increment in the loop

I have been working on radar data file with netcdf as file format, the file is structured such that within the year directory is the month directory and within it is the day directory, and within the day directory are the files with inconsistent…