Questions tagged [netcdf]

NetCDF (Network Common Data Form) is a binary file format for storing array-oriented scientific data. Use this tag for questions about programmatically encoding and/or decoding data to/from NetCDF files.

NetCDF (Network Common Data Form) is a binary file format for storing array-oriented scientific data.

From version 4, NetCDF files use the HDF5 format as container, and therefore can be read by HDF5 readers. Reliance on the HDF5 format also enabled easy parallel I/O and efficient compression.

References

2306 questions
74
votes
7 answers

Opinions on NetCDF vs HDF5 for storing scientific data?

Anyone out there have enough experience w/ NetCDF and HDF5 to give some pluses / minuses about them as a way of storing scientific data? I've used HDF5 and would like to read/write via Java but the interface is essentially a wrapper around the C…
Jason S
  • 184,598
  • 164
  • 608
  • 970
64
votes
5 answers

Joblib UserWarning while trying to cache results

I get the following UserWarning when trying to cache results using joblib: import numpy from tempfile import mkdtemp cachedir = mkdtemp() from joblib import Memory memory = Memory(cachedir=cachedir, verbose=0) @memory.cache def…
user308827
  • 21,227
  • 87
  • 254
  • 417
52
votes
8 answers

Creating a nested dictionary from a flattened dictionary

I have a flattened dictionary which I want to make into a nested one, of the form flat = {'X_a_one': 10, 'X_a_two': 20, 'X_b_one': 10, 'X_b_two': 20, 'Y_a_one': 10, 'Y_a_two': 20, 'Y_b_one': 10, …
ThomasNicholas
  • 1,273
  • 11
  • 21
41
votes
3 answers

Import netCDF file to Pandas dataframe

Merry Christmas! I am still very new to Python and Pandas, so any help is appreciated. I am trying to read in a netCDF file, which I can do and then import that into a Pandas Dataframe. The netcDF file is 2D so I just want to 'dump it in'. I have…
user1911866
  • 769
  • 1
  • 9
  • 13
29
votes
4 answers

R: Write RasterStack and preserve layer names

I have a raster stack, stk, consisting of three raster images in R. Here is a simple example # set up a raster stack with three layers > library(raster) > r <- raster(nrows=10,ncols=10) > r[] <- rnorm(100) > stk <- stack(r,r,r) # layer names are…
kguay
  • 391
  • 1
  • 3
  • 7
27
votes
4 answers

What are the disadvantages of using .Rdata files compared to HDF5 or netCDF?

I have been asked to change a software that currently exports .Rdata files so that it exports in a 'platform independent binary format' such as HDF5 or netCDF. Two reasons were given: Rdata files can only be read by R binary information is stored…
David LeBauer
  • 31,011
  • 31
  • 115
  • 189
23
votes
2 answers

How to properly plot projected gridded data in ggplot2?

I've been using using ggplot2 to plot climatic gridded data for years. These are usually projected NetCDF files. Cells are square in model coordinates, but depending on which projection the model uses, might not be so in the real world. My usual…
AF7
  • 3,160
  • 28
  • 63
22
votes
2 answers

How to get the parent node name of the current node?

what's the right syntax to get the current node's parent node's name? I know it's about the AxisName parent but what's the right syntax? for example of the following xml
user851380
  • 339
  • 1
  • 7
  • 10
19
votes
3 answers

Speeding up reading of very large netcdf file in python

I have a very large netCDF file that I am reading using netCDF4 in python I cannot read this file all at once since its dimensions (1200 x 720 x 1440) are too big for the entire file to be in memory at once. The 1st dimension represents time, and…
user308827
  • 21,227
  • 87
  • 254
  • 417
17
votes
3 answers

combining spatial netcdf files using xarray python

Is there a way to merge 2 or more netCDF files with the same time dimension but different spatial domains into a single netCDF file? The spatial domains are specified by latitude and longitude coordinates? In the documentation for xarray concat,…
user308827
  • 21,227
  • 87
  • 254
  • 417
17
votes
6 answers

python netcdf: making a copy of all variables and attributes but one

I need to process a single variable in a netcdf file that actually contains many attributes and variable. I think it is not possible to update a netcdf file (see question How to delete a variable in a Scientific.IO.NetCDF.NetCDFFile?) My approach is…
Bruno von Paris
  • 882
  • 1
  • 7
  • 26
16
votes
2 answers

How to extract variable names from a netCDF file in R?

I am writing a function in R to extract some air quality modelling data from netCDF files. I have the Package "ncdf" installed. In order to allow other users or myself to choose what variables to extract from a netCDF file, I would like to extract…
elarry
  • 521
  • 2
  • 7
  • 20
15
votes
4 answers

Resample xarray object to lower resolution spatially

Use xarray to resample to lower spatial resolution I want to resample my xarray object to a lower spatial resolution (LESS PIXELS). import pandas as pd import numpy as np import xarray as xr time =…
Tommy Lees
  • 1,293
  • 3
  • 14
  • 34
15
votes
3 answers

How to take a subset from a netCDF file using latitude/longitude boundaries in R

I have a netCDF file that I wish to extract a subset from defined by latitude/longitude boundaries (i.e. a lat/long defined box), using the ‘ncdf’ package in R. A summary of my netCDF file is below. It has two dimensions (latitude and longitude)…
Emily
  • 859
  • 5
  • 14
  • 31
15
votes
3 answers

Faster reading of time series from netCDF?

I have some large netCDF files that contain 6 hourly data for the earth at 0.5 degree resolution. There are 360 latitude points, 720 longitude points, and 1420 time points per year. I have both yearly files (12 GB ea) and one file with 110 years of…
David LeBauer
  • 31,011
  • 31
  • 115
  • 189
1
2 3
99 100