Quickly visualise a netcdf file
The netcdf files include metadata that describe their content. To list the metadata of a netcdf file (dimensions, variable names, attributes), you can use the ncdump command that comes with the netcdf library :
ncdump -h file.nc
To list the metadata and the values of variable var1 :
ncdump -v var1 file.nc | more
A number of people use ncview to have a quick look at variables in a netcdf file:
ncview file.nc &
Ferret is also a convenient software to have a quick look at netcdf files, e.g. :
ferret
yes? use "/home/bob/DATA/bathy_meter.nc"
yes? show data
yes? shade BATHYMETRY
yes? go land
yes? plot BATHYMETRY[i=200]
yes? plot/over BATHYMETRY[i=215]
yes? quit
Ferret is also useful for more complicated things, like regridding, see Ferret Documentation to explore possibilities.
It is also possible to use PyFerret, which works as the standard Ferret but is encapsulated in Python. This can be installed through anaconda as:
conda create -n FERRET -c conda-forge pyferret ferret_datasets --yes
Then, to use it:
conda activate FERRET
ferret
When exiting, you’ll need to leave the environment:
conda deactivate
See this page to install Ferret on your computer.