Search code examples
netcdfatmospherencocdo-climate

How to remove the scaling and offset attributes of a variable in a netcdf file to get the actual data values


I have a variable which has the dimensions time x lat x lon x levels and I am trying to read this in my global climate model. The problem I am facing is that the data is scaled and offset in the original file and it is a hassle to incorporate this inside the model. I want to modify the file so that the original data without any scaling or offset is available to read in the climate model.


Solution

  • You can use the following syntax to unpack the scale and offset in the data

    ncpdq --unpack input_file.nc out_file.nc
    

    The file out_file.nc will contain the actual values without any scaling or offset