Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Thu Aug 16, 2018 4:32 am




Post new topic Reply to topic  [ 4 posts ] 

All times are UTC

Author Message
PostPosted: Fri Aug 10, 2018 12:06 am 
Offline

Joined: Tue Aug 04, 2015 4:42 pm
Posts: 33
Location: UMAR, Mexico
Hi everybody!
I want to run a model with wind forcing.
But when I run my model I get:

GET_VARCOORDS - Cannot find "coordinates" attribute for variable: Uwind
in file: /media/SCRATCH/Data/HyCom/ROMS_FILES/GT_wind.nc

This attribute is needed to interpolate input data
to model grid. Following CF compliance, we need:

float my_var(time, lat, lon) ;
my_var:long_name = "my variable long name" ;
my_var:units = "my variable units" ;
my_var:coordinates = "lon lat" ;
my_var:time = "my_var_time" ;


This is my netcdf header...

%% ncdump('/media/SCRATCH/Data/HyCom/ROMS_FILES/ocean_clim/GT_wind.nc') %% Generated 09-Aug-2018 18:54:22

nc = netcdf('/media/SCRATCH/Data/HyCom/ROMS_FILES/ocean_clim/GT_wind.nc', 'noclobber');
if isempty(nc), return, end

%% Global attributes:

nc.title = ncchar(''Tehuantepec_2001 Wind Forcing'');
nc.date = ncchar(''09-Aug-2018'');
nc.grd_file = ncchar(''/media/SCRATCH/Data/HyCom/ROMS_FILES/GT8s_roms_grd.nc'');
nc.type = ncchar(''ROMS forcing file'');

%% Dimensions:

nc('xi_u') = 431;
nc('eta_u') = 240;
nc('xi_v') = 432;
nc('eta_v') = 239;
nc('xi_rho') = 432;
nc('eta_rho') = 240;
nc('xi_psi') = 431;
nc('eta_psi') = 239;
nc('s_rho') = 32;
nc('sms_time') = 12;

%% Variables and attributes:

nc{'sms_time'} = ncdouble('sms_time'); %% 12 elements.
nc{'sms_time'}.long_name = ncchar(''surface momentum stress time'');
nc{'sms_time'}.units = ncchar(''days'');
nc{'sms_time'}.cycle_length = ncdouble(360);

nc{'sustr'} = ncdouble('sms_time', 'eta_u', 'xi_u'); %% 1241280 elements.
nc{'sustr'}.long_name = ncchar(''surface u-momentum stress'');
nc{'sustr'}.units = ncchar(''Newton meter-2'');
nc{'sustr'}.time = ncchar(''sms_time'');

nc{'svstr'} = ncdouble('sms_time', 'eta_v', 'xi_v'); %% 1238976 elements.
nc{'svstr'}.long_name = ncchar(''surface v-momentum stress'');
nc{'svstr'}.units = ncchar(''Newton meter-2'');
nc{'svstr'}.time = ncchar(''sms_time'');

nc{'Uwind'} = ncdouble('sms_time', 'eta_u', 'xi_u'); %% 1241280 elements.
nc{'Uwind'}.long_name = ncchar(''surface u-wind component'');
nc{'Uwind'}.units = ncchar(''meter second-1'');
nc{'Uwind'}.time = ncchar(''sms_time'');

nc{'Vwind'} = ncdouble('sms_time', 'eta_v', 'xi_v'); %% 1238976 elements.
nc{'Vwind'}.long_name = ncchar(''surface v-wind component'');
nc{'Vwind'}.units = ncchar(''meter second-1'');
nc{'Vwind'}.time = ncchar(''sms_time'');

endef(nc)
close(nc)

and this is the script that makes my wind forcing file...

function create_winforc(frcname,grdname,N,title,smst,smsc)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Create an empty netcdf forcing file
% frcname: name of the forcing file
% grdname: name of the grid file
% title: title in the netcdf file
%
% Further Information:
% http://www.brest.ird.fr/Roms_tools/
%
% This file is part of ROMSTOOLS
%
% ROMSTOOLS is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published
% by the Free Software Foundation; either version 2 of the License,
% or (at your option) any later version.
%
% ROMSTOOLS is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston,
% MA 02111-1307 USA
%
% Copyright (c) 2001-2006 by Pierrick Penven
% e-mail:Pierrick.Penven@ird.fr
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nc=netcdf(grdname);
L=length(nc('xi_psi'));
M=length(nc('eta_psi'));
close(nc);
Lp=L+1;
Mp=M+1;

nw = netcdf(frcname, 'clobber');
redef(nw);

%
% Create dimensions
%
nw('xi_u') = L;
nw('eta_u') = Mp;
nw('xi_v') = Lp;
nw('eta_v') = M;
nw('xi_rho') = Lp;
nw('eta_rho') = Mp;
nw('xi_psi') = L;
nw('eta_psi') = M;
nw('s_rho') = N;
nw('sms_time') = length(smst);
%
% Create variables and attributes
%
nw{'sms_time'} = ncdouble('sms_time');
nw{'sms_time'}.long_name = ncchar('surface momentum stress time');
nw{'sms_time'}.long_name = 'surface momentum stress time';
nw{'sms_time'}.units = ncchar('days');
nw{'sms_time'}.units = 'days';
nw{'sms_time'}.cycle_length = ncdouble(smsc);
nw{'sms_time'}.cycle_length = smsc;
nw{'sms_time'}(:) = smst;

nw{'sustr'} = ncdouble('sms_time', 'eta_u', 'xi_u');
nw{'sustr'}.long_name = ncchar('surface u-momentum stress');
nw{'sustr'}.long_name = 'surface u-momentum stress';
nw{'sustr'}.units = ncchar('Newton meter-2');
nw{'sustr'}.units = 'Newton meter-2';
nw{'sustr'}.time = ncchar('sms_time');
nw{'sustr'}.time = 'sms_time';

nw{'svstr'} = ncdouble('sms_time', 'eta_v', 'xi_v');
nw{'svstr'}.long_name = ncchar('surface v-momentum stress');
nw{'svstr'}.long_name = 'surface v-momentum stress';
nw{'svstr'}.units = ncchar('Newton meter-2');
nw{'svstr'}.units = 'Newton meter-2';
nw{'svstr'}.time = ncchar('sms_time');
nw{'svstr'}.time = 'sms_time';

nw{'Uwind'} = ncdouble('sms_time', 'eta_u', 'xi_u');
nw{'Uwind'}.long_name = ncchar('surface u-wind component');
nw{'Uwind'}.long_name = 'surface u-wind component';
nw{'Uwind'}.units = ncchar('meter second-1');
nw{'Uwind'}.units = 'meter second-1';
nw{'Uwind'}.time = ncchar('wind_time');
nw{'Uwind'}.time = 'sms_time';

nw{'Vwind'} = ncdouble('sms_time', 'eta_v', 'xi_v');
nw{'Vwind'}.long_name = ncchar('surface v-wind component');
nw{'Vwind'}.long_name = 'surface v-wind component';
nw{'Vwind'}.units = ncchar('meter second-1');
nw{'Vwind'}.units = 'meter second-1';
nw{'Vwind'}.time = ncchar('wind_time');
nw{'Vwind'}.time = 'sms_time';
result = endef(nw);

%
% Create global attributes
%

nw.title = ncchar(title);
nw.title = title;
nw.date = ncchar(date);
nw.date = date;
nw.grd_file = ncchar(grdname);
nw.grd_file = grdname;
nw.type = ncchar('ROMS forcing file');
nw.type = 'ROMS forcing file';

close(nw);

--------------------------------------------------------------------------------------------------
How can I add the coordinates to my file? and Do I need change to "lat" "lon" my "xi" and "eta" coordinates?

I really appreciate your help... Thanks in advance!
Cheers!
-
Scarlett Mar.Mo.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 10, 2018 2:49 am 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3485
Location: IMS/UAF, USA
The structure of the file you show is one that has already been regridded onto the ROMS grid. The structure of a winds file for ROMS to remap is more like:
Code:
dimensions:
   lon = 640 ;
   lat = 320 ;
   time = UNLIMITED ; // (2920 currently)
variables:
   double lon(lon) ;
      lon:units = "degrees_east" ;
      lon:valid_min = 0. ;
      lon:valid_max = 359.4375 ;
      lon:long_name = "longitude" ;
   double lat(lat) ;
      lat:units = "degrees_north" ;
      lat:valid_min = -89.5700895506066 ;
      lat:valid_max = 89.5700895506066 ;
      lat:long_name = "latitude" ;
   double time(time) ;
      time:units = "days since 1900-01-01 00:00:00" ;
      time:valid_min = 37620. ;
      time:valid_max = 37984.875 ;
      time:calendar = "gregorian" ;
   float Uwind(time, lat, lon) ;
      Uwind:long_name = "Eastward Near-Surface Wind" ;
      Uwind:units = "m/s" ;
      Uwind:coordinates = "lon lat" ;
      Uwind:time = "time" ;
      Uwind:_FillValue = 1.e+15f ;
      Uwind:missing_value = 1.e+15f ;


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 14, 2018 11:12 pm 
Offline

Joined: Tue Aug 04, 2015 4:42 pm
Posts: 33
Location: UMAR, Mexico
Hi Kate!
Many thanks for your help.

I will crate the forcing file with d_ecmwf2roms.m script to have the correct structure. But the script suggests annual archives, and the ECMWF link http://apps.ecmwf.int/datasets/data/interim_full_daily/ only leave me download monthly files.
Do you know how can I do for get annual files?

Thanks in advance.
Scarlett Marmo.


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 15, 2018 4:20 am 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3485
Location: IMS/UAF, USA
ROMS doesn't care if they are yearly or monthly. You just need to list them all in the correct format. Or you can use ncrcat to mash together twelve months into a year. Up to you.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group