forcing files

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
wenping

forcing files

#1 Unread post by wenping »

i tried to simulate wind effect on inlet dynamics.
i created a forcing file with variables Uwind, Vwind, sustr, svstr.
when i ran the model, it showed like:
GET_VARCOORDS - Cannot find "coordinates" attribute for variable: sustr
in file: frc_inlet.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" ;
GET_2DFLD - error while reading variable: sustr at TIME index = 1
i don't why the variable sustr needs to have a coordinates attribute, while Uwind and Vwind don't.
how i can fix this problem? thanks a lot.

3/9

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

Re: forcing files

#2 Unread post by kate »

ROMS is probably not reading your Uwind/Vwind at all. It will use either the winds or the wind-stress, not both. Here is part of an ncdump on a (working) wind file:
float Uwind(wind_time, lat, lon) ;
Uwind:missing_value = -1.e+34f ;
Uwind:_FillValue = -1.e+34f ;
Uwind:long_name = "10m Uwind component" ;
Uwind:units = "m/s" ;
Uwind:coordinates = "lon lat" ;
How to fix? I would use ncatted from the NCO package to fix up the attributes.

mistral
Posts: 23
Joined: Wed Jan 16, 2008 11:17 pm
Location: Privat

Re: forcing files

#3 Unread post by mistral »

hi
I have the same problem.
this is my netcdf initial "template":

netcdf roms_wind_frc {
dimensions:
wind_time = 49 ;
sms_time = 49 ;
eta_rho = 156 ;
xi_rho = 114 ;
variables:
float Uwind(wind_time, eta_rho, xi_rho) ;
Uwind:_FillValue = 1.e+35f ;
Uwind:units = "m s-1" ;
Uwind:long_name = "Wind velocity, u-component (m s-1)" ;
float Vwind(wind_time, eta_rho, xi_rho) ;
Vwind:_FillValue = 1.e+35f ;
Vwind:units = "m s-1" ;
Vwind:long_name = "Wind velocity, v-component (m s-1)" ;
float sustr(sms_time, eta_rho, xi_rho) ;
sustr:_FillValue = 1.e+35f ;
sustr:units = "m2 s-2" ;
sustr:long_name = "Kinematic wind stress, u-component (m2 s-2)"
;
float svstr(sms_time, eta_rho, xi_rho) ;
svstr:_FillValue = 1.e+35f ;
svstr:units = "m2 s-2" ;
svstr:long_name = "Kinematic wind stress, v-component (m2 s-2)" ;
double wind_time(wind_time) ;
wind_time:units = "days since 1968-05-23" ;
wind_time:_FillValue = 1.e+35 ;
double sms_time(sms_time) ;
sms_time:units = "days since 1968-05-23" ;
sms_time:_FillValue = 1.e+35 ;

// global attributes:
:title = "ROMS wind forcing file" ;
:type = "FORCING file" ;
:author = "USGS" ;
:date = "16-Mar-2010 20:26:12" ;
:history = "Copied from roms_wind_frc_template_iniziale.cdl by make_lake.m\n",
"" ;
data:
...



after reading this post I have edited the file .cdl to:

netcdf roms_wind_frc {
dimensions:
wind_time = 49 ;
sms_time = 49 ;
eta_rho = 156 ;
xi_rho = 114 ;
variables:
float Uwind(wind_time, eta_rho, xi_rho) ;
Uwind:missing_value = -1.e+34f ;
Uwind:_FillValue = -1.e+34f ;
Uwind:long_name = "10m Uwind component" ;
Uwind:units = "m/s" ;
Uwind:coordinates = "xi_rho eta_rho" ;
float Vwind(wind_time, eta_rho, xi_rho) ;
Vwind:missing_value = -1.e+34f ;
Vwind:_FillValue = -1.e+34f ;
Vwind:long_name = "10m Vwind component" ;
Vwind:units = "m/s" ;
Vwind:coordinates = "xi_rho eta_rho" ;
float sustr(sms_time, eta_rho, xi_rho) ;
sustr:missing_value = -1.e+34f ;
sustr:_FillValue = -1.e+34f ;
sustr:long_name = "sustr component" ;
sustr:units = "m2 s-2" ;
sustr:coordinates = "xi_rho eta_rho" ;
float svstr(sms_time, eta_rho, xi_rho) ;
svstr:missing_value = -1.e+34f ;
svstr:_FillValue = -1.e+34f ;
svstr:long_name = "svstr component" ;
svstr:units = "m2 s-2" ;
svstr:coordinates = "xi_rho eta_rho" ;
double wind_time(wind_time) ;
wind_time:units = "days since 1968-05-23" ;
wind_time:_FillValue = 1.e+35 ;
double sms_time(sms_time) ;
sms_time:units = "days since 1968-05-23" ;
sms_time:_FillValue = 1.e+35 ;

// global attributes:
:title = "ROMS wind forcing file" ;
:type = "FORCING file" ;
:author = "USGS" ;
:date = "16-Mar-2010 19:32:02" ;
:history = "Copied from roms_wind_frc.cdl by make.m\n",
"" ;
...


but I got this errors :

NETCDF_INQ_VAR - requested variable: xi_rho
not found in input file: Data/ROMS/Forcing/roms_wind_frc.nc
call from: get_varcoords.F

GET_2DFLD - error while reading variable: sustr at TIME index = 1




where is the error???

thanks a lot

mathieu
Posts: 74
Joined: Fri Sep 17, 2004 2:22 pm
Location: Institut Rudjer Boskovic

Re: forcing files

#4 Unread post by mathieu »

What happens is the following. There is a mechanism in ROMS named regridding where you put as input to ROMS the non-interpolated output of a meteorological model and ROMS does the interpolation by himself. The code is fairly hackish as opposed to the rest of ROMS but it is useful to save disk space.

In this scheme you have the following header

Code: Select all

netcdf wind {
dimensions:
        iSize = 82 ;
        jSize = 88 ;
        wind_time = 3665 ;
variables:
        double LONcoord(iSize, jSize) ;
        double LATcoord(iSize, jSize) ;
        double wind_time(wind_time) ;
                wind_time:units = "days since 1968-05-23" ;
                wind_time:_FillValue = 1.e+35 ;
        float Uwind(wind_time, iSize, jSize) ;
                Uwind:_FillValue = 1.e+35f ;
                Uwind:units = "m/s" ;
                Uwind:coordinates = "LONcoord LATcoord" ;
        float Vwind(wind_time, iSize, jSize) ;
                Vwind:_FillValue = 1.e+35f ;
                Vwind:units = "m/s" ;
                Vwind:coordinates = "LONcoord LATcoord" ;
}
That is ROMS reads the variable Uwind, Vwind sees that the variable coordinates contains the longitude, latitude of the meteorological model and thus does the interpolation.
This is as opposed to the classical header

Code: Select all

netcdf aladin_wet_wind {
dimensions:
        eta_rho = 291 ;
        xi_rho = 266 ;
        wind_time = 489 ;
variables:
        double wind_time(wind_time) ;
                wind_time:units = "days since 1968-05-23" ;
                wind_time:_FillValue = 1.e+35 ;
        float Uwind(wind_time, eta_rho, xi_rho) ;
                Uwind:_FillValue = 1.e+35f ;
                Uwind:units = "m/s" ;
        float Vwind(wind_time, eta_rho, xi_rho) ;
                Vwind:_FillValue = 1.e+35f ;
                Vwind:units = "m/s" ;
}
So, you have triggered the regridding scheme and ROMS is searching for the variable of coordinates xi_rho, eta_rho, which of course it does not find and triggers the error.
Now of course the question is what tripwire did you touched. For that we have to look at the code Utility/regrid.F and Utility/nf_fread2d.F. There you see that the interpolate variable is set by the size of the grid that you used, i.e. implicitly not explicitly. So in your place I would probably check the dimensions 156, 114 with the grid file and the ocean.in file and make sure that all is ok there.
Also, I would remove the variable attribute coordinates = "xi_rho eta_rho" ;

mistral
Posts: 23
Joined: Wed Jan 16, 2008 11:17 pm
Location: Privat

Re: forcing files

#5 Unread post by mistral »

oookkk!!!

I solved by NCO


I extracted lat_rho and lon_rho from file grid.nc.
then I copied forcing.nc.
1)ncks -C-v lat_rho, lon_rho grid.nc coo.nc
2)ncks coo.nc forcing.nc (this is not the best command)

of course I modified the file .cdl in this way

float Uwind(wind_time, eta_rho, xi_rho) ;
Uwind:missing_value = -1.e+34f ;
Uwind:_FillValue = -1.e+34f ;
Uwind:long_name = "10m Uwind component" ;
Uwind:units = "m/s" ;
Uwind:coordinates = "lon_rho lat_rho" ;

Perhaps this is not the best way but it works in my case with my kind of script...that creates the forcing to roms and Swan...

many thanks to Mathieu and Kate!!!


best regards!!!

Post Reply