Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Mon Sep 23, 2019 9:32 am




Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Author Message
PostPosted: Fri May 11, 2018 11:28 am 
Offline
User avatar

Joined: Tue May 01, 2018 3:56 pm
Posts: 56
Location: Tsinghua University
I'm a beginner at computer programming. I use the frc_uvstress.cdl file in ".../trunk/Data/ROMS/CDL" , and I transfered it into forcing netcdf file.

Then I use a matlab file(which named str_cdl_nc.m) to write values(sms time, sustr, svstr) into the ncfile.

But when I check the forcing.nc file. The value of sms time is very strange, and the dimension of it is incorrect.( I just want to calculate in 2 days since 0:00:00 0)

So I wonder if there is anything wrong in my matlab file(which used to write value into ncfile) ? Thank you so much!


Paddy


Attachments:
frc_uvstress.nc [15.15 MiB]
Downloaded 58 times
str_cdl_nc.m [1.64 KiB]
Downloaded 64 times
Top
 Profile  
Reply with quote  
PostPosted: Fri May 11, 2018 11:28 am 
Offline
User avatar

Joined: Tue May 01, 2018 3:56 pm
Posts: 56
Location: Tsinghua University
And here is my frc_uvstress.cdl

netcdf frc_uvstress {

dimensions:
xi_rho = 100 ;
xi_u = 99 ;
xi_v = 100 ;
eta_rho = 200 ;
eta_u = 200 ;
eta_v = 199 ;
sms_time = UNLIMITED ; // (0 currently)

variables:
float sms_time(sms_time) ;
sms_time:long_name = "surface momentum stress time" ;
sms_time:units = "days since 1992-01-01 00:00:00" ;
sms_time:interval = "367 daily data" ;
sms_time:start_date = "01-Jan-1993" ;
sms_time:end_date = "07-Jan-1994" ;
short sustr(sms_time, eta_u, xi_u) ;
sustr:long_name = "surface u-momentum stress" ;
sustr:units = "Newton meter-2" ;
sustr:time = "sms_time" ;
sustr:scale_factor = 0.0005 ;
short svstr(sms_time, eta_v, xi_v) ;
svstr:long_name = "surface v-momentum stress" ;
svstr:units = "Newton meter-2 * 1000" ;
svstr:time = "sms_time" ;
svstr:scale_factor = 0.0005 ;

// global attributes:
:type = "ROMS FORCING file" ;
:title = "NCEP/NCAR Global Atmospheric Re-analyses v4/97" ;
:grd_file = "afirst_grid.nc" ;
:source_file = "../natl/ncepflx1_NATL1993.nc" ;
:source_file_history = "extraction from grib files using NCEP_GRBdaily - 27-Mar-2002 17:08:28" ;
}


Top
 Profile  
Reply with quote  
PostPosted: Fri May 11, 2018 12:22 pm 
Offline
User avatar

Joined: Tue May 01, 2018 3:56 pm
Posts: 56
Location: Tsinghua University
And here is my matlab file which used to write values into forcing.nc file:

%1) Enter start time of forcing file, in seconds.
% This time needs to be consistent with model time (ie dstart and time_ref).
% See *.in files for more detail.
time = [0 1 2];
sms_time = [0 1 2];


%4) Obtain grid information.
grid_file='/home/hpd14/Documents/COAWST_V3.2/Projects/afirst/afirst_grid.nc' %<-enter name of grid here
lon_rho=ncread(grid_file,'lon_rho');
lat_rho=ncread(grid_file,'lat_rho');
[ix iy]=size(lon_rho);
t=length(sms_time);
xrho = ix;
yrho = iy;


%5) Forcing sustr, svstr.

% Forcing values for sustr, svstr.
display('Forcing sustr, svstr')
%
sustr(1:length(sms_time),1:xrho,1:yrho) = 0.15;
svstr(1:length(sms_time),1:xrho,1:yrho) = 0;


%now write the data from the arrays to the netcdf file
disp(' ## Filling Variables in netcdf file with data...')

ncwrite('frc_uvstress.nc','sms_time',sms_time);
ncwrite('frc_uvstress.nc','sustr',sustr);
ncwrite('frc_uvstress.nc','svstr',svstr);


%close file
disp(['created ', 'frc_uvstress.nc'])


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

All times are UTC


Who is online

Users browsing this forum: No registered users 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:  
cron
Powered by phpBB® Forum Software © phpBB Group