tech_climate
tech_climate

Reputation: 163

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.

Upvotes: 0

Views: 2124

Answers (2)

ClimateUnboxed
ClimateUnboxed

Reputation: 8077

I think this should do the trick:

cdo -b 32 copy input_file.nc out_file.nc

or this

cdo -b f32 copy input_file.nc out_file.nc 

essentially it unpacked the data by converting it to a 32 bit float. If you want a 64 bit double precision float you can use 64 instead 32.

Upvotes: 1

Manmeet Singh
Manmeet Singh

Reputation: 400

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

Upvotes: 4

Related Questions