How to set 'time' in the input NETCDF files (COAWSTv3.1)

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
xwu
Posts: 13
Joined: Fri Jul 11, 2014 3:01 pm
Location: University of South Carolina

How to set 'time' in the input NETCDF files (COAWSTv3.1)

#1 Unread post by xwu »

Hi!

Can someone tell me how to set or create the 'time' string within the netcdf file?

Now i try to use COAWSTv3.1, and i can find there is a new file 'check_multifile.F' (COAWST/ROMS/Utility) that do the file checking. But i dont know how to create such netcdf files (One example is that i want to create two forcing files, one for tide, another for wind stresses. In the previous version, i set 'sms_time' within the second file and it works, but in the new version it shows error message: 'unable to find time variable in input NetCDF file'.....'variable name does not contains the 'time' string').

I hope that someone could help me. Thanks! :)

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: How to set 'time' in the input NETCDF files (COAWSTv3.1)

#2 Unread post by kate »

The current ROMS (now in COAWST) gets its time by one of two ways:
  • 1. The "time" attribute on the variable. Here's an example with a non-default time, needing a "time" attribute:

    Code: Select all

    	double ocean_time(ocean_time) ;
    		ocean_time:long_name = "time" ;
    		ocean_time:units = "days since 1900-01-01 00:00:00" ;
    		ocean_time:field = " " ;
    	double vbar_south(ocean_time, xi_v) ;
    		vbar_south:_FillValue = 1.26765060022823e+30 ;
    		vbar_south:long_name = "2D v-momentum south boundary condition" ;
    		vbar_south:units = "meter second-1" ;
    		vbar_south:field = "vbar_south, scalar, series" ;
    		vbar_south:time = "ocean_time" ;
    2. Having a time variable that agrees with that listed in the varinfo.dat file. Here's an example without a "time" attribute:

    Code: Select all

    	double wind_time(wind_time) ;
    		wind_time:units = "days since 1900-01-01 00:00:00" ;
    		wind_time:calendar = "LEAP" ;
    	float Vwind(wind_time, lat, lon) ;
    		Vwind:_FillValue = 1.e+15f ;
    		Vwind:missing_value = 1.e+15f ;
    		Vwind:long_name = "Northward wind at 2 m above the displacement height" ;
    		Vwind:units = "m/s" ;
    		Vwind:coordinates = "lon lat" ;
    which then depends on this in the varinfo.dat:

    Code: Select all

    'Uwind'                                            ! Input
      'surface u-wind component'
      'meter second-1'                                 ! [m/s]
      'u-wind, scalar, series'
      'wind_time'
      'idUair'
      'r2dvar'
      1.0d0
Anyway, I don't know why yours failed since it has the default sms_time. The tides file has "tide_period", right?

xwu
Posts: 13
Joined: Fri Jul 11, 2014 3:01 pm
Location: University of South Carolina

Re: How to set 'time' in the input NETCDF files (COAWSTv3.1)

#3 Unread post by xwu »

Thanks very much!
I just figure out my problem. The problem comes from the code that i used to create the NetCDF file for wind stress.

The original matlab code was written as:
v1 = netcdf.defVar(nc,'sms_time','double',[time_steps one]);
% Here 'time_steps' is a self-defined parameter.

Because the new 'check_multifile.F' 'Search for the time variable: any 1D array variable with the string 'time' in the variable name'. So, the code above is not reasonable any more. It should be modified as:
v1 = netcdf.defVar(nc,'sms_time','double',time_steps);

I made the modification, and now it works. Hope i make myself clear. Thanks!

Post Reply