[gradsusr] create missing day, save as netcdf file, reopen with ctl file

Westberg, David J. David.J.Westberg at nasa.gov
Tue Dec 2 16:52:08 EST 2014


I'm working with CMIP5 BCC-CSM1-1 historical and rcp85 surface temperature (tas) data, and I'm trying to create a time series from 1976 to 2100.  I'm using open_grads and here is the configuration:

Config: v2.0.1.oga.1 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn athena geotiff shapefile
Grid Analysis and Display System (GrADS) Version 2.0.1.oga.1

These are the netcdf files I'm using:

tas_day_bcc-csm1-1_historical_r1i1p1_18500101-20121230.nc
tas_day_bcc-csm1-1_rcp85_r1i1p1_20060101-20991230.nc
tas_day_bcc-csm1-1_rcp85_r1i1p1_21000101-21991231.nc

This is my ctl file (BCC-CSM1-1_TAS_hist_rcp85.ctl) to link the above files together:

DSET TAS/tas_day_bcc-csm1-1_%ch.nc
# below goes from 1850 to 2005, skipping hist 2006-2012
CHSUB     1 56940 historical_r1i1p1_18500101-20121230.nc
CHSUB 56941 91250 rcp85_r1i1p1_20060101-20991230.nc
CHSUB 91251 127750 rcp85_r1i1p1_21000101-21991231.nc
OPTIONS template
DTYPE netcdf
OPTIONS 365_day_calendar
TDEF time 127750 LINEAR 00z1Jan1850 1440mn

The second file is missing 20991231 (31 Dec 2099), so I thought I would average 20991230 and 21000101 to replace the missing day (20991231) and save it as a new netcdf file.
ga-> define newgrid = (tas(t=91249)+tas(t=91251))/2
ga-> set sdfwrite tas_day_bcc-csm1-1_rcp85_r1i1p1_20991231.nc
ga-> sdfwrite newgrid

This is my new ctl file (BCC-CSM1-1_TAS_hist_rcp85_with31dec2099.ctl) to link the above files together:

DSET TAS/tas_day_bcc-csm1-1_%ch.nc
# below goes from 1850 to 2005, skipping hist 2006-2012
CHSUB     1 56940 historical_r1i1p1_18500101-20121230.nc
CHSUB 56941 91249 rcp85_r1i1p1_20060101-20991230.nc
CHSUB 91250 91250 rcp85_r1i1p1_20991231.nc
CHSUB 91251 127750 rcp85_r1i1p1_21000101-21991231.nc
OPTIONS template
DTYPE netcdf
OPTIONS 365_day_calendar
TDEF time 127750 LINEAR 00z1Jan1850 1440mn

I use xdfopen on the above ctl file.  Plotting on either side time wise of 00z31Dec2099 works, but I can't get a plot for 00z31Dec2099.

ga-> set t 91249
Time values set: 2099:12:30:0 2099:12:30:0 
ga-> d tas
Contouring: 245 to 310 interval 5 
ga-> set t 91251
Time values set: 2100:1:1:0 2100:1:1:0 
ga-> d tas      
Contouring: 245 to 315 interval 5 
ga-> set t 91250
Time values set: 2099:12:31:0 2099:12:31:0 
ga-> d tas      
NetCDF Error (gancrow, nc_get_vara_double): NetCDF: Variable not found
Data Request Error:  Error for variable 'tas'
  Error ocurred at column 1
DISPLAY error:  Invalid expression 
  Expression = tas
ga-> d newgrid  
Syntax Error:  Invalid Operand 
  'newgrid' not a variable or function name
  Error ocurred at column 1
DISPLAY error:  Invalid expression 
  Expression = newgrid

So I tried another method.  I created a ctl file (tas_day_bcc-csm1-1_rcp85_r1i1p1_20991231.ctl; see below) for the tas_day_bcc-csm1-1_rcp85_r1i1p1_20991231.nc file, and added this control file to the main ctl file (BCC-CSM1-1_TAS_hist_rcp85_with31dec2099.ctl).

[tas_day_bcc-csm1-1_rcp85_r1i1p1_20991231.ctl]
dset tas_day_bcc-csm1-1_rcp85_r1i1p1_20991231.nc
dtype netcdf
options 365_day_calendar
tdef lat 1 linear 00Z31DEC2099 1440mn


[BCC-CSM1-1_TAS_hist_rcp85_with31dec2099.ctl]
DSET TAS/tas_day_bcc-csm1-1_%ch
# below goes from 1850 to 2005, skipping hist 2006-2012
CHSUB     1 56940 historical_r1i1p1_18500101-20121230.nc
CHSUB 56941 91249 rcp85_r1i1p1_20060101-20991230.nc
CHSUB 91250 91250 rcp85_r1i1p1_20991231.ctl
CHSUB 91251 127750 rcp85_r1i1p1_21000101-21991231.nc
OPTIONS template
DTYPE netcdf
OPTIONS 365_day_calendar
TDEF time 127750 LINEAR 00z1Jan1850 1440mn

This time, I get this:

ga-> set t 91250                                        
Time values set: 2099:12:31:0 2099:12:31:0 
ga-> d tas
Cannot contour grid - all undefined values 

Any suggestions???

David Westberg
SSAI / NASA Langley Research Center
david.j.westberg at nasa.gov





More information about the gradsusr mailing list