Project

General

Profile

Changing 1 variable in nc file

Added by Wim Thiery over 12 years ago

Hello,

I would like to change 1 variable in a nc file, e.g. set the surface height to 0 without touching the other variables.

In order to do so, I am using the following three commands:

cdo mulc,0 -selname,HSURF laf2007051700.nc HSURF_zero.nc
cdo delname,HSURF laf2007051700.nc laf2007051700_noHSURF.nc
cdo merge laf2007051700_noHSURF.nc HSURF_zero.nc laf2007051700_final.nc

However, when I apply these commands other variables (lat, lon) are duplicated and renamed, and others are removed (vcoord, tbounds). Is there a way of avoiding this problem?

Many thanks in advance for your help!

Kind regards,
Wim


Replies (2)

RE: Changing 1 variable in nc file - Added by Uwe Schulzweida over 12 years ago

There is no way to avaid this problem, sorry.
Variables could be lost if the structure is unsupported or if it is a coordinate variable and not used by a data variable (see: Lost-netCDF-variables).

Variables are never renamed. CDO changes "only" some names of netCDF dimensions.

Best regards,
Uwe

RE: Changing 1 variable in nc file - Added by Wim Thiery over 12 years ago

Dear Uwe,

Thank you very much for your answer. We finally figured out a way to circumvent this problem by importing the files in R.

Kind regards,
Wim

    (1-2/2)