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
votes
3 answers

netCDF4 and Basemap package on Python 3.7

I hope someone can help me with this. I am plotting netcdf data on a map using the mpl_toolkits.basemap and netCDF4.Dataset packages. They worked perfectly a few month ago and I successfully plotted what I wanted. Now I want to update my work with…
-1
votes
1 answer

Numpy 3D array (NetCDF data) slicing same element - the fastest way

I need to slice the same element in 3D numpy array (actually masked array, but works the same). I usually do it with iterations - however current data is so huge and it needs repeating the process on thousands of datasets - it will take weeks (raw…
Curtis
  • 1,157
  • 4
  • 17
  • 30
-1
votes
1 answer

How to find maximum daily temperature from hourly data netcdf file in Python?

I am trying to find the maximum daily temperature from hourly data (3 hour intervals). I am new to netcdf files and python so I'm not sure where to start. How would I find the maximum daily value? Can I use max() for that? file='air.2m.2018.nc' ncin…
-1
votes
2 answers

GeoTIFF to NetCDF with time variable enabled

I have thousand GeoTIFF files (monthly precipitation from 1981) and would like to convert it into single NetCDF with time dimension enabled. I have read various similar thread in StackOverflow and GIS StackExchange, but could not find the best…
user97103
  • 235
  • 1
  • 7
-1
votes
1 answer

Extract data from NetCDF4 file with regional mask file

I am working on multiple NetCDF4 file and want to extract the monthly_rain values from it. Here is my code: import numpy import netCDF4 with netCDF4.Dataset('abc.nc', 'r') as mask_dataset: mask_data = mask_dataset.variables['mask'][:] results…
-1
votes
1 answer

How to write OrderedDict into netcdf with python netcdf4?

I resampled NetCDF data and organized in OrderedDict(This is the original organization of original data). But when I use the following script to write it in a new netcdf file: ncout.createDimension('lat', len(y)) ncout.createDimension('lon',…
-1
votes
1 answer

Visualize and filter large NetCDF file using logic

I have a very large dataset in a NetCDF file. RZSC = xr.open_dataset('/home/chandra/data/RZSC_250m_SA.nc') RZSC = RZSC.Band1 RZSC [Output]: [668112074 values with dtype=float32] Coordinates: *…
Ep1c1aN
  • 683
  • 9
  • 25
-1
votes
1 answer

nc.variables[i].units is showing an error while extracting datat from netcdf file

nc.variables[i].units is showing an error attribute not found. i am trying to extract data from netcdf file. how to extract data of a particular longitude or latitude? from netCDF4 import Dataset nc=Dataset("test.nc",'r') for i in…
-1
votes
1 answer

Code successfully runs on one machine, but on another yields "TypeError: cannot concatenate 'str' and 'int' objects"

I have a script which utilizes the Py-ART package to read in airborne weather radar data and then perform quality control on said data. I'll note that I suspect this is not an issue with that package, otherwise I'd just post an issue to that…
dstex
  • 1
-1
votes
1 answer

netCDF array size too big

so i am trying to unpack a netCDF file and i have gotten to a point where i have put the variables that i am interested in, in a np array. However, my problem comes in for the size of the array that i am trying to analyse. The folowing are the…
-1
votes
1 answer

How can I put a coordinate system into a NetCDF using R?

I have been working with NetCDF files from Daymet and my project involves extracting data from various files, modifying them and creating new files in R which will then be analyzed in Arcmaps. Using the make NetCDF raster layer tool with with x and…
-1
votes
1 answer

trouble looping xarray dataframe through subdirectories

I am trying to make a big data frame by looping through sub-directories. I want to: i) read data from all the files (with .nc extension) in the subdirectories, ii) select a particular chunk of it iii) save it in a output.nc file. import os import…
SMaj
  • 81
  • 1
  • 1
  • 3
-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

How to create netcdf file from excel sheet contain one variable values with corresponding lat long?

I am trying to create a nc file from excel file containing values in three column (lat, long and Precipitation). The data is gridded value of 0.05 degree resolution. The total number of grids is 1694. The data extent is 57 columns and 52 rows. I am…
Diwan
  • 1
  • 3
-1
votes
1 answer

Change data source from THREDDS Catalouge for NetCDF

Hi i am using this code from here How to read NetCDF file and write to CSV using Python I want to be able to pull out the "Mean_period_of_swell_waves_ordered_sequence_of_data" from from the THREDDS Catalog here but am recieving the below error. I am…
1 2 3
43
44