Opened 6 years ago

Closed 6 years ago

#626 closed bug (Fixed)

Change to check_multifile prevents (or complicates) use of single-record forcing files

Reported by: m.hadfield Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description

For a long time now it has been my practice to specify time-independent variables in forcing files by means of a single-record netCDF variable at zero time. For example:

netcdf roms_frc_dqdsst {
dimensions:
        time_fixed = 1 ;
variables:
        float time_fixed(time_fixed) ;
        float dQdSST(time_fixed) ;
                dQdSST:time = "time_fixed" ;
                dQdSST:long_name = " surface net heat flux sensitivity to SST" ;
                dQdSST:units = "Watt metre^-2 Celsius^-1" ;

// global attributes:
                :type = "ROMS forcing file" ;
}

In ticket 622 an extra check was added to check_multifile.F as follows:

Improved check_multifile.F to report when the input data time records from NetCDF files is not enough to finish the simulation. Persisting the last available data record is not possible in ROMS. Users need to provide enough data to cover the simulation period from start to finish. Many thanks to Kate Hedstrom for bringing this to my attention.

This prevents the above usage. Is this intended? Should the check be bypassed for single-record netCDF variables?

Change History (2)

comment:1 Changed 6 years ago by m.hadfield

I see that I can suppress the above check by adding a cycle_length attribute to the time variable. However this has the unwanted consequence that the value is recalculated (with a message) at every time step.

comment:2 Changed 6 years ago by arango

  • Resolution set to Fixed
  • Status changed from new to closed

I checked the CF conventions for the NetCDF attribute calendar in the time variables. We can have calendar = "none" for perpetual time axis. For the case that you discussed above, we can have:

netcdf roms_frc_dqdsst {
dimensions:
        time_fixed = 1 ;
variables:
        float time_fixed(time_fixed) ;
                time_fixed:calendar = "none" ;

I made changes in check_multifile.F to also turn off the Lcheck switch for perpetual time axis: the calendar attribute is none or the number of records in the time dimension is one (Nrec=1). Notice that in subroutine check_file, we have now:

      Nrec=var_Dsize(1)              ! time is a 1D array
      DO i=1,nvatt
        IF (TRIM(var_Aname(i)).eq.'units') THEN
          Tunits=TRIM(var_Achar(i))
          IF (Tunits(1:3).eq.'day') THEN
            Tscale=day2sec
          ELSE IF (Tunits(1:4).eq.'hour') THEN
            Tscale=3600.0_r8
          END IF
        ELSE IF (TRIM(var_Aname(i)).eq.'calendar') THEN
          IF ((Nrec.eq.1).or.                                           &
     &        (INDEX(TRIM(var_Achar(i)),'none').ne.0)) THEN
            Lperpetual=.TRUE.
          END IF
        ELSE IF (TRIM(var_Aname(i)).eq.'cycle_length') THEN
          Lcycle=.TRUE.
        END IF
      END DO
      IF (Lcycle.or.Lperpetual) THEN
        Lcheck=.FALSE.
      END IF

It will be very easy to add the calendar attribute or change its value using the repository Matlab script nc_attadd.m. In your case, you just type:

status = nc_attadd('roms_frc_dqdsst.nc', 'calendar', 'none', 'time_fixed')

This works nicely. Thank you for bringing this to my attention.

Note: See TracTickets for help on using tickets.