Cannot find "coordinates" attribute for variable: Uwind

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Cannot find "coordinates" attribute for variable: Uwind

#1 Unread post by Scarlett »

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.

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

Re: Cannot find "coordinates" attribute for variable: Uwind

#2 Unread post by kate »

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: Select all

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 ;

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#3 Unread post by Scarlett »

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.

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

Re: Cannot find "coordinates" attribute for variable: Uwind

#4 Unread post by kate »

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.

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#5 Unread post by Scarlett »

Hi Kate!
I did my forcing files with d_ecmwf2roms.m tool. I get 156 files (13 each month).

I wrote the forcing files names in my ocean.in file, like this:

! Input forcing NetCDF file name(s). The USER has the option to enter
! several file names for each nested grid. For example, the USER may
! have different files for wind products, heat fluxes, tides, etc.
! The model will scan the file list and will read the needed data from
! the first file in the list containing the forcing field. Therefore,
! the order of the file names is very important. If using multiple forcing
! files per grid, first enter all the file names for grid 1, then grid 2,
! and so on. It is also possible to split input data time records into
! several NetCDF files (see prologue instructions above). Use a single line
! per entry with a continuation (\) or vertical bar (|) symbol after each
! entry, except the last one.

! NFFILES == 4 ! number of unique forcing files
! FRCNAME == ocean_frc.nc ! forcing file 1, grid 1

! FRCNAME == /media/SCRATCH/Data/HyCom/ROMS_FILES/GT_tidfrc.nc\
! /media/SCRATCH/Data/HyCom/ROMS_FILES/GT_genfrc.nc\
! /media/SCRATCH/Data/HyCom/ROMS_FILES/GT_wind.nc

NFFILES == 13 ! number of unique forcing files

FRCNAME == /media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_latent_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_lwrad_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Pair_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Qair_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_rain_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sensible_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_shflux_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_sms_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swflux_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_swrad_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_Tair_era_01_12.nc\
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_01.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_02.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_03.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_04.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_05.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_06.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_07.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_08.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_09.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_10.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_11.nc|
/media/SCRATCH/input_forcing_ECMWF/gt_wind_era_01_12.nc

But when I run my model, I get:


CHECK_MULTIFILE - Error while checking input Forcing file:
/media/SCRATCH/input_forcing_ECMWF/gt_cloud_era_01_12.nc
last data time record available is for day: 0001-02-01 00:00:00.00
but data is needed to finish run until day: 0001-12-30 00:00:00.00

Elapsed CPU time (seconds):

Thread # 5 CPU: 1.113
Thread # 17 CPU: 1.113
Thread # 0 CPU: 1.113
Thread # 11 CPU: 1.113
Thread # 9 CPU: 1.113
Thread # 7 CPU: 1.113
Thread # 13 CPU: 1.113
Thread # 8 CPU: 1.113
Thread # 14 CPU: 1.113
Thread # 18 CPU: 1.113
Thread # 21 CPU: 1.113
Thread # 16 CPU: 1.113
Thread # 19 CPU: 1.113
Thread # 10 CPU: 1.113
Thread # 15 CPU: 1.113
Thread # 4 CPU: 1.113
Thread # 6 CPU: 1.113
Thread # 2 CPU: 1.113
Thread # 23 CPU: 1.113
Thread # 3 CPU: 1.113
Thread # 12 CPU: 1.113
Thread # 1 CPU: 1.112
Thread # 22 CPU: 1.113
Thread # 20 CPU: 1.113
Total: 26.717

Nonlinear model elapsed time profile, Grid: 01

Allocation and array initialization .............. 491.395 (******* %)
2D/3D coupling, vertical metrics ................. 0.218 ( 0.8158 %)
Omega vertical velocity .......................... 0.059 ( 0.2203 %)
Equation of state for seawater ................... 0.312 ( 1.1684 %)
Total: 491.983 ********

All percentages are with respect to total time = 26.717


ROMS/TOMS - Output NetCDF summary for Grid 01:

ROMS/TOMS - I/O error ............... exit_flag: 4


ERROR: I/O related problem.

It's like only read the January file, I already check and do again each file... But the error continues.
Why I get this ? How can I fix it?.. Do I write something wrong?
Thanks in advance for your help...
Cheers.
Scarlett Mar.Mo.

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

Re: Cannot find "coordinates" attribute for variable: Uwind

#6 Unread post by kate »

Did you check the times in all your files? Are you sure you have all twelve months there? What are the time units in those files?

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Cannot find "coordinates" attribute for variable: Uwind

#7 Unread post by c.drinkorn »

HI Scarlett,

I worked with the ecmwf2roms script a lot recently. How do you loop through the monthly input files? Maybe you accidentally call the same file all the time (i.e. January)? Just a thought...
ADD: I looked into the ecmwf2roms file you shared in the other post and can see that you run the script for each moth manually, right? Or why is there a fix Feb starting and ending day? Are your input files also monthly or is it a concatenated file now? I think in the latter case the script will start reading the file always from the beginning each time...
I'd make an annual file and run the code for the entire year once.

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#8 Unread post by Scarlett »

Kate and Catherine many thanks for your help.

Kate
Did you check the times in all your files?
Yes, I checked them. The files that I download from ECMWF and the files that the d_ecmwf2roms.m tool crate.
Are you sure you have all twelve months there?
Yes all the files that d_ecmwf2roms.m did are in the input_forcing_ECMWF folder.
What are the time units in those files?
For example January and December:
the download file

January
nc{'time'} = nclong('time'); %% 249 elements.
nc{'time'}.units = ncchar(''hours since 1900-01-01 00:00:0.0'');
nc{'time'}.long_name = ncchar(''time'');
nc{'time'}.calendar = ncchar(''gregorian'');

December
nc{'time'} = nclong('time'); %% 249 elements.
nc{'time'}.units = ncchar(''hours since 1900-01-01 00:00:0.0'');
nc{'time'}.long_name = ncchar(''time'');
nc{'time'}.calendar = ncchar(''gregorian'');

the input file
January
nc{'cloud_time'} = ncdouble('cloud_time'); %% 249 elements.
nc{'cloud_time'}.long_name = ncchar(''cloud fraction time'');
nc{'cloud_time'}.units = ncchar(''days since 2001-01-01 00:00:00'');
nc{'cloud_time'}.calendar = ncchar(''gregorian'');

December
nc{'cloud_time'} = ncdouble('cloud_time'); %% 249 elements.
nc{'cloud_time'}.long_name = ncchar(''cloud fraction time'');
nc{'cloud_time'}.units = ncchar(''days since 2001-12-01 00:00:00'');
nc{'cloud_time'}.calendar = ncchar(''gregorian'');

my input file have 8 times for day (8 times*31 days=248) and the first time for the next day (248+1=249)
January file start in 2001-01-01 and end in 2001-02-01
December file start in 2001-01-01 and end in 2002-12-01

It's possible that the model reads only one file and wants that all the year information were in one file, and not in twelve?
How can I say it: It's month by month!! Or what else could be causing this problem?

Catherine
How do you loop through the monthly input files?
I modified the script and I'm telling it month by month which one it should occupy.
Maybe you accidentally call the same file all the time (i.e. January)?
It's possible, but I was so careful and I did the files many times more, and I got the same error

Are your input files also monthly or is it a concatenated file now? I think in the latter case the script will start reading the file always from the beginning each time...
I'd make an annual file and run the code for the entire year once.
Yes, my inputs files (the files that I downloaded from ECMWF) are monthly, and it was easier for me to modify the script to read them and create them monthly. I think that the better solution is make an annual file and run the code for the entire year once, like you suggest. If you could give me the script that does this or how can I modify this, I'll be eternally grateful.


Thanks in advance and Cheers!
Scarlett

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

Re: Cannot find "coordinates" attribute for variable: Uwind

#9 Unread post by kate »

The problem is that ROMS doesn't know the units "hours" at this time. It knows days and seconds. There is code in get_cycle.F to read the time units, with a default of days. You can add a new case for hours, setting Tscale to 1/24.

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#10 Unread post by arango »

The ECMWF data has a minimal interval of 3 hours; you can easily create annual files instead monthly. It will be more efficient in ROMS to avoid inquiring and open so many NetCDF files.

The time units for forcing file is usually days since the reference date (epoch). However, you can have any time units by manipulating the metadata file for ROMS (varinfo.dat).

The coordinates and time attribute for any variable that ROMS process is crucial if you are regridding inside ROMS. You can easily add those attributes to your NetCDF files. There is various software that you can use. We provided a Matlab script to process the ECMWF data (d_ecmwf2roms.m). This data is quite peculiar, and you need to know what are you doing.

Anyway, in the Matlab scripts repository, there is a script to add or modify the values of a NetCDF variable attribute. It is very simple to use:

Code: Select all

nc_attadd('myfile.nc', 'time', 'mytime', 'myvar')
nc_attadd('myfile.nc', 'coordinates', 'lon lat mytime', 'myvar')
You are using Matlab scripts that were not developed by us and probably are not maintained. We never used the awkward nc object in Matlab. Nowadays, Matlab has their native NetCDF interface. Also, there are several Python packages developed by others. We don't distribute those in our repositories.

:idea: ROMS users need to master the favorite software to manipulate NetCDF. Otherwise, you may expend a lot of time setting applications.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Cannot find "coordinates" attribute for variable: Uwind

#11 Unread post by c.drinkorn »

Yes, my inputs files (the files that I downloaded from ECMWF) are monthly, and it was easier for me to modify the script to read them and create them monthly. I think that the better solution is make an annual file and run the code for the entire year once, like you suggest. If you could give me the script that does this or how can I modify this, I'll be eternally grateful.
You can either use e.g. nco or cdo commands to adjust your netcdf-files. Any of these have their goods and bads, though. You can use the cdo command "cdo cat infile.nc outfile.nc" to concatenate several files to one timeseries but cdo tends to alter some attributes. e.g. delete the coordinates attribute or change the time units attributes from two integers to one integers (e.g. 1970-01-01 00:00:00 to 1970-1-1 00:00:00 - fortunately, due to the recent update of the ROMS code this is not an issue anymore :) ). The coordinates attribute you can add (again) using the nco command "ncatted -O -h -a coordinates, myvar,c,c,"lon lat mytime" infile.nc outfile.nc", e.g.
In any case you can (should!) always check the final result before preceding using e.g. "ncdump -h file.nc" and/or open it in a netcdf viewer to check the time steps etc.

In the d_ecmwf2roms code Herman mentioned you shouldn't have to change too much in order to postprocess your data, then. All is pretty much set up already. :)

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#12 Unread post by Scarlett »

Hi everybody!
So many thanks for your help.
I tried changing the Tscale but it does not work.

So the only way was mash together twelve months into a year, like each one had suggested to me.
I mash with ncrcat following the Kate suggest, the ecmwf2roms works without problem.

But now,I have an other problem... :oops:
When I run my model I get:

CHECK_MULTIFILE - Error while processing Forcing multi-files:
data does not include initialization time = 0001-01-01 00:00:00.00

0001-01-01 01:30:00.00 0001-12-31 22:30:00.00 /media/SCRATCH/annual/gt_latent_era.nc

My download atms and temp files start at the time 885360, while heat and flux file start at 885363. For that reason the files after ecmwf2roms processing start in different times.

gt_cloud_era.nc gt_Pair_era.nc gt_Qair_era.nc gt_wind_era.nc start at "0" and finish at "360"

gt_latent_era.nc gt_rain_era.nc gt_sensible_era.nc gt_shflux_era.nc gt_sms_era.nc gt_swflux_era.nc gt_swrad_era.nc start at ".0625" and finish at "364.9375"

gt_lwrad_era.nc start at "-.0625" after this, the values are positive -> -0.0625 0.4375 ... 364.9375
It should be mentioned that all the files were downloaded to the same parameters.

% Select time: 00:00:00 12:00:00
%
% Select step: 0 3 6 9 12

How can I fix this?

All my gratitude to you.
Scarlett.

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

Re: Cannot find "coordinates" attribute for variable: Uwind

#13 Unread post by kate »

I have been known to lie and change the first time in an input file to match my initialization time. Here is the script:

Code: Select all

import numpy as np
import netCDF4
import sys

ncfile = sys.argv[1]
nc = netCDF4.Dataset(ncfile, 'a', format='NETCDF3_64BIT')

time = nc.variables['ocean_time'][0]
time = 29226.5

nc.variables['ocean_time'][0] = time

nc.close()
You can change the last time too, index -1. I call it settime.py and you run it with "python settime.py myinputfile.nc"

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#14 Unread post by Scarlett »

Thanks Kate, I will follow your advice.
I have two questions.

What is your input file... the download file? or the file after the ecmwf2roms process?
And why do you time is 29226.5? is value is like my 885360 or my .0625?

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

Re: Cannot find "coordinates" attribute for variable: Uwind

#15 Unread post by kate »

The files in this case are climatology, boundary and initial files from SODA, converted to ROMS input by Python scripts. That number is time in days, rounded to half a day from the original SODA time. Change it to what makes sense in your case.

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: Cannot find "coordinates" attribute for variable: Uwind

#16 Unread post by Scarlett »

Hi all!
The problem was solved with the Kate advice. This is the code that I used in matlab, based in the Kate code.

Code: Select all

% load forcing file
ncfile='/path/forcing_file_era.nc'; 
nc=netcdf(ncfile);
ncdump(nc);
% see the forcing time
time_frc=nc{'forcing_time'}(:);

% change the fist time value (.0625 to 0)
ncwrite(ncfile,'forcing_time',0,[1]);

%change the last time value to  (364.9375 to 365)
ncwrite(ncfile,'forcing_time',365,[2920]);
All my gratitude to each one.
Scarlett.

Post Reply