Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

"Abort with message NetCDF: Invalid dimension ID or name in file"

samrabin

Sam Rabin
Member
I'm trying to add some new variables to the Restart() subroutine in the CropType module:

Code:
call restartvar(ncid=ncid, flag=flag, varname='sdates_thisyr', xtype=ncd_double,  &
     dim1name='pft', dim2name='mxgrowseas', switchdim=.true., &
     long_name='crop sowing dates for this patch this year', units='day of year', &
     scale_by_thickness=.false., &
     interpinic_flag='interp', readvar=readvar, data=this%sdates_thisyr)

mxgrowseas is a new dimension I've added to clm_varpar, so obviously it's not present in the existing restart files. I think that's why I'm getting the following error:

Abort with message NetCDF: Invalid dimension ID or name in file /glade/u/home/samrabin/ctsm/libraries/parallelio/src/clib/pio_nc.c at line 812

Is there a way to avoid this error? My understanding is that the restart I/O is tolerant to missing variables, so hopefully there's some way to tell it to be tolerant of missing dimensions as well.
 

samrabin

Sam Rabin
Member
I tried wrapping it in if (nf90_inq_dimid(ncid, 'mxgrowseas', mxgrowseas) == 0) then, but that function wants ncid as an integer, not type(file_desc_t).
 

samrabin

Sam Rabin
Member
Ahh, looks like this was what I needed instead:
Code:
call check_var_or_dim(ncid, 'mxgrowseas', is_dim=.true., exists=found)
if (found) then
 
Top