Working with Weather Dataset using CDO and NCView

Sudheer Keshav Bhat · December 25, 2020

Data Analysis   Climate Data

Introduction

CDO (Climate Data Operators) is a set of command line Operators to manipulate and analyse Climate data. netCDF 3/4 is one of the supported formats which we demonstrate here.

NCView is a visual browser for netCDF format files. It runs on UNIX platforms under X11.

ncdump command-line utility converts netCDF data to human-readable text form.

CDO

Extract a subset of dataset. In this case, selecting months 6-9 and writing to a file.

cdo -f nc4 -selmon,6/9 Rainfall.nc Summar_Rainfall.nc

Calculate yearly mean

cdo -f nc4 -yearmean Summar_Rainfall.nc year_mean.nc

Trend analysis / linear regression

cdo -f nc4 trend year_mean.nc trend1.nc trend2.nc

Export .nc to .tsv

cdo outputtab,year,lon,lat,value year_mean.nc > year_mean.tsv

ncdump

Dump info about a dataset (similar to pandas pd.head())

ncdump -h Rainfall.nc

Dump detailed info about specific variable

ncdump -t -v lat Rainfall.nc
ncdump -t -v time Rainfall.nc

NCView

Open ncview with a dataset.

ncview Summar_Rainfall.nc