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
0
votes
1 answer

Error while reading NetCDF format data

I am having aquaMODIS chlorophyll data in NetCDF format for the whole world. I want to crop only the area of longitude 70-85 and latitude 4-18, from the whole data. Then I want to aggregate the data and I also want to plot the data after…
0
votes
1 answer

Python - basemap.contourf produces blank map

i'm trying to plot some data on a map using mpl_toolkits.basemap lib. I almost got it right, but the map comes blank when run the script: Map I get from the script My guess is that the contourf cannot find the levels on the array, here is the data…
i'mlaguiar
  • 21
  • 2
  • 7
0
votes
1 answer

ncview: Specify and correct displayed variable range

I created a netcdf file with python 3.6 and the netCDF4 module. Everything works fine except for one variable when displayed by the visual browser ncview. This variable ranges from 0 to 1000, but the displayed range remains near 0 and image is…
Marc S
  • 97
  • 2
  • 11
0
votes
1 answer

Python multiprocessing with parallel save to netCDF4 file

I am performing a simulation in which I want to save the snapshots of the state vector, and calculate do it for different parameters. I have two control parameters that I which to scan (p and a in the example bellow). I therefore save the simulation…
0
votes
1 answer

Error using netCDF4 num2date function

I am working with an nc file.The file has an array of dimensions time, number, latitude, longitude. I was trying to convert time from number to date via the num2date method. time_unit = nc.variables["time"].getncattr('units') # first read the…
Saiful Islam
  • 139
  • 5
  • 16
0
votes
1 answer

How to shift netcdf dataset relative to grid cell numbers with python?

I have a global map (Longitude, Latitude, Depth) as a netcdf file (size: 236,1440) and would like to 'shift' the longitudes from -180/180 to -270/90, so that cell number 0 = -270 etc (means that the Australian continent is located around grid cell…
IsiSa
  • 17
  • 3
0
votes
1 answer

matplotlib.basemap - Earth Science - ValueError: operands could not be broadcast together with shapes (12529,15661) (12529,15662)

Can't seem to figure out why my graph will not come out correctly. I am attempting to plot depth on a map projection using netCDF4, and mpl_toolkits.Basemap. I have attempted several projections yet none have worked. Below is the code I am…
Earthly
  • 1
  • 1
0
votes
1 answer

Modify NetCDF file to make dimension unlimited

Is it possible, with Python + netCDF4, to open an existing NetCDF file and change one of the dimensions from fixed size to an unlimited dimension, such that I can append data to it? I found this question/answer, which lists several options for doing…
Bart
  • 9,825
  • 5
  • 47
  • 73
0
votes
1 answer

Getting single variable from multiple NetCDF files using loop in R

If I have n files named nc.data_1, nc.data_2... nc.data_n, how can I get the same variable from all of the files and store them into a single array in R? (i.e. (a) getting the time then (b) getting precipitation data with dimensions: [lon, lat,…
Chow
  • 1
  • 2
0
votes
1 answer

R - plot netcdf4 data in lat and lon gridded space

I am new to this kind of plotting and therefore please forgive my inexperience. I would like to plot the max temperatures over Europe in a given n day. Data can be accessed here…
aaaaa
  • 149
  • 2
  • 18
  • 44
0
votes
1 answer

How to relate a function to a specific netCDF file based on timestamp

I have 73 netCDF files each representing 5 day intervals of a calendar year and have several variables. Each file has 120 layers representing hourly intervals. I have read them all into R and named them appropriately using the ncdf4 package like…
Jojo
  • 4,951
  • 7
  • 23
  • 27
0
votes
1 answer

reading nc files in matlab

I want to read multiple nc files from a folder. these files are in matrix form i.e. layer wise data. i have successfully read a single file and display the attributes and also extract them. but when i tried to plot them, it ends with the error. i am…
Qaim
  • 1
  • 1
0
votes
0 answers

Python netCDF4 install error

I'm trying to install netCDF4 package for python 2.7 on Ubuntu 14.04 with sudo pip install --user netCDF4 The installation crashes with the following error: error: unknown file type '.pyx' (from 'netCDF4/_netCDF4.pyx') The only hint I found from…
0
votes
2 answers

How can I get a list of netCDF variables with particular dimensions?

{ dimensions: grp = 50 ; time = UNLIMITED ; // (0 currently) depth = 3 ; scalar = 1 ; spectral_bands = 2 ; x1AndTime = 13041 ; x2AndTime = 13041 ; midTotoAndTime = 13041 ; variables: double time(time) ; double…
maximusdooku
  • 5,242
  • 10
  • 54
  • 94
0
votes
2 answers

How to invert a multidimensional array stored in NetCDF along 1 dimension?

I have netCDF containing multidimensional array of following shape: [1:424, 1:412, 1:3, 1:130] ..and I would like to invert along 2nd dimension and get: [1:424, 412:1, 1:3, 1:130] I tried: test_object <-…
Marek
  • 5
  • 1
  • 4