Fixing the time dimension

# 1. extract time from the original.nc file to create a new file with only time:
 ncks -v time original.nc time.nc

# 2. remove the time variable from original.nc (which removes the problematic `serial_date_number dimension`)
 ncks -C -x -v time original.nc fixed.nc

#3. Fix the time.nc file manually, with a text editor:
 ncdump time.nc > time.txt   # dump netCDF to text
    ## text-edit time.txt to fix up header, 
    ## creating time = UNLIMITED ; // (12053 currently)
 ncgen -o newtime.nc < time.txt   # remake netCDF from text

# 4. Finally, concatenate the new time variable file into fixed.nc
 ncks -A newtime.nc fixed.nc
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s