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
1
vote
1 answer

How can I add an engine (netcdf4) to xarray's open_dataset?

I've been trying to simply open a dataset using Python's xarray : data = xr.open_dataset(datafile.nc) and I've been getting the following error: ValueError: found the following matches with the input file in xarray's IO backends: ['netcdf4',…
mattdecoat
  • 11
  • 1
1
vote
1 answer

Merging multiple observational nc files based on station attributes

I am trying to merge multiple nc files containing physical oceanographic data for different depths at different latitudes and longitudes. I am using ds = xr.open_mfdataset to do this, but the files are not merging correctly and when I try to plot…
1
vote
1 answer

How to split NetCDF file into multiple NetCDF files based on indices of dimension?

I have a single NetCDF file with some identically sized variables in it. I am trying to save all data into different NetCDF files based on dimensions. For example, each variable in a NetCDF file has data in one dimension called "row" with a size of…
1
vote
2 answers

hyper_filter (tidync R package) seems not to work for grid with two variables

I have a nc file with the following structure and I am trying to filter given a lat/lon range, but with no success. Unfortunately, I beg your pardon, but I cannot share this nc files, and I could not find a similar nc file openly available on the…
Alessandro
  • 91
  • 7
1
vote
0 answers

Is it possible to install Conda packages in AWS Glue?

I’m using AWS Glue Jobs with the PythonShell mode for processing some NetCDF4 files. I need to perform some analytics on the data using the scitools-iris package. On my local Ubuntu machine, I’ve successfully installed it using conda-forge. I tried…
zerodark
  • 11
  • 2
1
vote
1 answer

Calculate average of extreme values in Netcdf - Python

I have started working with large datasets from Copernicus Marine Service. I am downloading the netcdf files through motuclient and then i can process (using xarray) the data to calculate the mean value for each position of the grid. I would like to…
Vassilis
  • 19
  • 1
1
vote
0 answers

OSError: [Errno -128] NetCDF: Attempt to use feature that was not turned on when netCDF was built.: b'/content/test.hdf'

I downloaded MODIS data from its http server and was trying to load it in xarray on google colab. I added the netrc file and the file is not corrupted since gdalinfo on that gave no error. URL =…
Aman Bagrecha
  • 406
  • 4
  • 9
1
vote
1 answer

NetCDF fortran fails to nf90_open a netCDF file starting with a header line HDF

I am having a problem dealing with wind analysis CCMP_Wind_Analysis_yyyymmdd_V02.0_L3.0_RSS.nc downloaded from ftp.ssmi.com. NetCDF fortran library successfully opened the climatology but not the individual daily data with the provided sample…
iyui
  • 31
  • 4
1
vote
1 answer

File Not Found error when trying to open .tif file

I am trying to open a .tif raster file for my project, but Python can't seem to find it on my computer. I am using Mac OS. This is the code: import netCDF4 as nc rasterfile = ('~/Desktop/sds…
relayyyyy
  • 25
  • 4
1
vote
1 answer

xarray - MissingSpatialDimensionError (assign coordinates as dimensions)

A have a netCDF file that I opened with xarray. I want to clip the xarray data set using a shapefile; however, I cannot figure out how to properly set my spatial dimensions. I have the following data set: print(ds.keys()) Dimensions: …
1
vote
1 answer

NCO: is there any one-line command to change the index of time dimension as a whole array (not by for-loop)?

I have a netCDF file FORCING.nc containing dimension "time" with values like: [ 841512., 841513., 841514., ..., 1051893., 1051894.,1051895.]. But I want to change the time stamps from the absolute value to relative values starting from 841512, say…
Xu Shan
  • 175
  • 3
  • 11
1
vote
0 answers

splitting an xarray Dataset by number of coordinates

I have an xarray Dataset which contains some data defined on three coordinates (lat, lon, time) and some defined on only one (time). I'd like to separate this into two different datasets based on the number of coordinates per variable. It's not as…
1
vote
1 answer

Temperature and Salinty from CMEMS netcdf file for specific geographical location

I want to get the temperature ['thetao'] and salinity ['so'] of the sea surface (just the top layer) for specific geographical location. I found guidance for how to do this on this website. import netCDF4 as nc import numpy as np fn =…
Dutchie
  • 13
  • 3
1
vote
2 answers

How to download netCDF4 file from webpage?

I want to download a netCDF4 file from a webpage. I can download the datafile, but there seems to be some errors in the file I downloaded using following codes: import requests from netCDF4 import Dataset def download_file(url): local_filename…
Xu Shan
  • 175
  • 3
  • 11
1
vote
1 answer

I want to extract data from multiple netcdf files

I have a code in R that extracts daily values of every month from a single .nc4 file. I have 49 netcdf files. i want to extract the data from all those files using loop and write them in a unique csv file. I have this code for a single file but I…
Jacky_r
  • 11
  • 2