Edge+start exceeds dimension bound

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

Edge+start exceeds dimension bound

#1 Unread post by nacholibre »

Hello,
I am getting the following error. Apparently the get_2dfld.f90 cannot read the variable.

Code: Select all

 GET_2DFLD   - error while reading variable: tide_Eamp   at TIME index =    7

 ROMS/TOMS - Input error ............. exit_flag:   2
...

Code: Select all

Analytical header files used:

     ROMS/Functionals/ana_initial.h

 ERROR: Abnormal termination: NetCDF INPUT.
 REASON: Edge+start exceeds dimension bound 
I double checked a few things and also tried to include 6 constituents instead of 7. Then I get

Code: Select all

 GET_2DFLD   - error while reading variable: tide_Eamp   at TIME index =    6

 ROMS/TOMS - Input error ............. exit_flag:   2
I am using ADCIRC to force get the forcings. What else can I do to find the reason of the error.
Thanks,
Zafer

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

#2 Unread post by kate »

REASON: Edge+start exceeds dimension bound
This seems to be a Netcdf error rather than a ROMS error. What are the dimensions of your grid and tides netcdf files? Can you cut and paste that part of an ncdump here? Can you go in with a debugger and see exactly where it is failing?

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#3 Unread post by nacholibre »

Thank you for your reply Kate. I have a 400x300 grid with 8 layers. I thought that the errror mesage was straight forward so did not use a debugger. Do you mean debugging the f90 code in the Build folder?
Thanks a lot!

Code: Select all

 
%% ncdump('clyo_tide.nc')   %% Generated 30-Oct-2007 19:31:06
 
nc = netcdf('clyo_tide.nc', 'noclobber');
if isempty(nc), return, end
 
%% Global attributes:
 
nc.type = ncchar('DATA file');
nc.history = ncchar('Data from OSCR Tuesday - October 30, 2007 - 7:23:37.9839 PM');
 
%% Dimensions:
 
nc('xi_rho') = 400;
nc('xi_u') = 399;
nc('xi_v') = 400;
nc('eta_rho') = 300;
nc('eta_u') = 300;
nc('eta_v') = 299;
nc('time') = 0; %% (record dimension)
nc('tide_period') = 7;
 
%% Variables and attributes:
 
nc{'time'} = ncdouble('time'); %% 0 elements.
nc{'time'}.long_name = ncchar('surface momentum time\0\0\0\0\0\0\0');
nc{'time'}.units = ncchar('Julian day');
nc{'time'}.field = ncchar('time, scalar, series');
 
nc{'Usur'} = ncdouble('time', 'eta_u', 'xi_u'); %% 0 elements.
nc{'Usur'}.long_name = ncchar('surface u-momentum component');
nc{'Usur'}.units = ncchar('meter second-1');
nc{'Usur'}.field = ncchar('u-surface, scalar, series');
 
nc{'Vsur'} = ncdouble('time', 'eta_v', 'xi_v'); %% 0 elements.
nc{'Vsur'}.long_name = ncchar('surface v-momentum component');
nc{'Vsur'}.units = ncchar('meter second-1');
nc{'Vsur'}.field = ncchar('v-surface, scalar, series');
 
nc{'Esur'} = ncdouble('time', 'eta_rho', 'xi_rho'); %% 0 elements.
nc{'Esur'}.long_name = ncchar('error for surface momentum');
nc{'Esur'}.units = ncchar('nondimensional');
nc{'Esur'}.field = ncchar('Esur, scalar, series');
 
nc{'tide_period'} = ncdouble('tide_period'); %% 7 elements.
nc{'tide_period'}.long_name = ncchar('tide angular period');
nc{'tide_period'}.units = ncchar('hours');
nc{'tide_period'}.field = ncchar('tide_period, scalar');
 
nc{'tide_Ephase'} = ncdouble('tide_period', 'eta_rho', 'xi_rho'); %% 840000 elements.
nc{'tide_Ephase'}.long_name = ncchar('tidal elevation phase angle');
nc{'tide_Ephase'}.units = ncchar('degrees, time of maximum elevation with respect chosen time origin');
nc{'tide_Ephase'}.field = ncchar('tide_Ephase, scalar');
 
nc{'tide_Eamp'} = ncdouble('tide_period', 'eta_rho', 'xi_rho'); %% 840000 elements.
nc{'tide_Eamp'}.long_name = ncchar('tidal elevation amplitude');
nc{'tide_Eamp'}.units = ncchar('meter');
nc{'tide_Eamp'}.field = ncchar('tide_Eamp, scalar');
 
nc{'tide_Cphase'} = ncdouble('tide_period', 'eta_rho', 'xi_rho'); %% 840000 elements.
nc{'tide_Cphase'}.long_name = ncchar('tidal current phase angle');
nc{'tide_Cphase'}.units = ncchar('degrees, time of maximum velocity with respect chosen time origin');
nc{'tide_Cphase'}.field = ncchar('tide_Cphase, scalar');
 
nc{'tide_Cangle'} = ncdouble('tide_period', 'eta_rho', 'xi_rho'); %% 840000 elements.
nc{'tide_Cangle'}.long_name = ncchar('tidal current inclination angle');
nc{'tide_Cangle'}.units = ncchar('degrees between semi-major axis and East');
nc{'tide_Cangle'}.field = ncchar('tide_Cangle, scalar');
 
nc{'tide_Cmin'} = ncdouble('tide_period', 'eta_rho', 'xi_rho'); %% 840000 elements.
nc{'tide_Cmin'}.long_name = ncchar('minimum tidal current, ellipse semi-minor axis');
nc{'tide_Cmin'}.units = ncchar('meter second-1');
nc{'tide_Cmin'}.field = ncchar('tide_Cmin, scalar');
 
nc{'tide_Cmax'} = ncdouble('tide_period', 'eta_rho', 'xi_rho'); %% 840000 elements.
nc{'tide_Cmax'}.long_name = ncchar('maximum tidal current, ellipse semi-major axis');
nc{'tide_Cmax'}.units = ncchar('meter second-1');
nc{'tide_Cmax'}.field = ncchar('tide_Cmax, scalar');
 
endef(nc)
close(nc)


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

#4 Unread post by kate »

I take it you have Lm=398, Mm=298? If you go in with a debugger (yes, the f90 sources in Build are the ones), ask it for the sizes of MTC and NTC as seen by get_idata.f90. If you get into get_2dfld, make sure special is set to true for the tidal fields. Here are my tidal dimensions for a file which works:

Code: Select all

netcdf NEP4_tides_otps {
dimensions:
        namelen = 4 ;
        tide_period = 8 ;
        eta_rho = 642 ;
        xi_rho = 226 ;

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#5 Unread post by nacholibre »

Hello Kate,
The problem is at

Code: Select all

            IF (status.ne.nf90_noerr) THEN
              IF (Master) THEN
                WRITE (stdout,70) TRIM(Vname(1,ifield)), Trec
              END IF
              exit_flag=2
              ioerror=status
              RETURN
            END IF
at the very end after the comment

Code: Select all

!  Read in 2D-grided or point data. Notice for special 2D fields, Vtype
!  is augmented by four indicating reading a 3D field. This rational is
!  used to read fields like tide data.
I believe it comes form this line of the get_2dfld.f90. a few lines above it,

Code: Select all

                status=nf90_get_var(ncid, Vid, Fval, start, total)
because I get status =-57.
Still working on it. Do you know if any of those values
(ncid, Vid, Fval, start, total)
entered in any input or header files? Maybe I am doing a mistake there. :? Because after all this was working with some other case I did before.
Thanks a lot.
Zafer

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

#6 Unread post by kate »

nacholibre wrote:

Code: Select all

                status=nf90_get_var(ncid, Vid, Fval, start, total)
because I get status =-57.
Still working on it. Do you know if any of those values
(ncid, Vid, Fval, start, total)
entered in any input or header files? Maybe I am doing a mistake there. :? Because after all this was working with some other case I did before.
Thanks a lot.
Zafer
From netcdf.h:

Code: Select all

#define NC_EEDGE        (-57)   /* Edge+start exceeds dimension bound */
As for (ncid, Vid, Fval, start, total), none of them come from outside. ncid is an integer referring to that file, Vid is an integer referring to the variable in the file, start and total come from the size of an array it should be reading. Can you find out the values in those two arrays?

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#7 Unread post by nacholibre »

start and total read the ng (nested grid number) and it is equal to 1. So I have

Code: Select all

                start(1)=Trec
                total(1)=1
where Trec =7. The 7 tidal constituents that i am using in my model. I don't know if this is what you were asking Kate. I hope I did not lose you completely at this point. :?
Thank you for your time.

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

#8 Unread post by kate »

In get_2dfld, the tides should have "special" set to true. In that case it calls:

Code: Select all

              IF (special) THEN
                Vsize(3)=Irec
                status=nf_fread3d(ng, model, ncid, Vid, 0, Vtype+4,     & 
     &                            Vsize, LBi, UBi, LBj, UBj, 1, Irec,   &
     &                            Fscale(ifield,ng), Fmin, Fmax,        &
#ifdef MASKING
     &                            Fmask(LBi,LBj),                       &       
#endif
     &                            Fout(LBi,LBj,1))
In nf_fread3d before the call to nf90_get_var, we have stuff like this:

Code: Select all

        start(1)=1
        total(1)=Ilen
        start(2)=1
        total(2)=Jlen
        start(3)=1
        total(3)=Klen
        start(4)=tindex
        total(4)=1
So just before that call, what values are in those start, total arrays?

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#9 Unread post by nacholibre »

Hello Kate,
The values I have are as follows:

Code: Select all

 start
           7
           0
           0
           0
 total
           1
           0
           0
           0
That is in

Code: Select all

IF (Lgrided) THEN
loop, therefore, before

Code: Select all

                status=nf_fread3d(ng, model, ncid, Vid, 0, Vtype+4,     &
     &                            Vsize, LBi, UBi, LBj, UBj, 1, Irec,   &
     &                            Fscale(ifield,ng), Fmin, Fmax,        &
     &                            Fmask(LBi,LBj),                       &
     &                            Fout(LBi,LBj,1))
It does not go into the loop starting with

Code: Select all

              IF (InpThread) THEN
after that.
I believe the problem is with the tidal interpolation. Maybe there is a problem with the grids or masking? Below is a picture of how it looks,
Image
red=masking, green=masked are that I am studying,
blue= matlab input file from ADCIRC
I checked the procdure again and nothing seems to be wrong. This does not make any sense to me. I start to believe that there is a BUG somewhere in the codes... :(
Can it be related to the size of the grid? Maybe I have to increase some value, somewhere, some how :?
Last edited by nacholibre on Thu Nov 01, 2007 11:56 pm, edited 1 time in total.

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

#10 Unread post by kate »

Did you step into nf_fread3d? I asked about values there, before the call to nf90_get_var.

What is Lm and Mm in the model?

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#11 Unread post by nacholibre »

kate wrote:Did you step into nf_fread3d? I asked about values there, before the call to nf90_get_var.

Code: Select all

start
           1
           1
           1
           0
total
         300
         400
           7
           1
What is Lm and Mm in the model?
Lm=298
Mm=398

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

#12 Unread post by kate »

That looks good. So next I guess we ask what version of netcdf? What system? What compiler? Have you tried another combination of the above?

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#13 Unread post by nacholibre »

Finally my desktop crashed down! Well, I cannot say I am surprised!!! :lol:
Last thing I was doing was trying to find the version information for netcdf.
I am using a Linux desktop, an intel compiler and netcdf 3.6.1 I guess?
I am not very confident with the file structure of ROMS. How can I tell which version I am using?
It'll take quite a long time for it to boot up, so I guess I will call it a day for now. 8)
Thank you very much Kate!

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

#14 Unread post by arango »

The code that read ROMS input files is very generic. We have been using this routine for years to read tidal forcing and never get the errors that you are getting. This is telling me that your tidal forcing NetCDF file is not correct or it is corrupt. The tidal arrays are dynamically allocated internally to the appropiate size and number of tidal components.

This looks like a NetCDF file/library problem and not a ROMS problem. Maybe your NetCDF library is inconsistent with your compiler or not installed correctly.

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#15 Unread post by nacholibre »

I agree, that might be the case. I remember moving the ROMS directory to a different HARD DISK on the same computer a month ago. Do you think the problem might be related to that? I did the svn update after that, and I tried some of the old cases that I ran before , they worked all right. I have a netCDF 3.6.1 directory. But when I type

Code: Select all

ncdump --version
I get version as 3.6.0. How can I tell which one is the one that ROMS uses. I am planning to install version 3.6.2. Do I have to uninstall previous version before installing the new version :?:
I laso wonder if it has got sth to do with the enabling large files option in netCDF :?:
Thank you very much... :?: [/code]

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

#16 Unread post by kate »

If there is more than one version, you can set these environment variables in your login scripts (.bashrc, etc.) to point to the desired location:

Code: Select all

    NETCDF_INCDIR ?= /usr/local/pkg/netcdf/netcdf-3.6.1/include
    NETCDF_LIBDIR ?= /usr/local/pkg/netcdf/netcdf-3.6.1/lib
Otherwise you can edit the Compilers/Linux-blah.mk file to point to the desired one. Or else set them in the build.xx script if you are using that.

nacholibre
Posts: 81
Joined: Thu Dec 07, 2006 3:14 pm
Location: USGS
Contact:

#17 Unread post by nacholibre »

Well things got messier now. I downloded netCDF 3.6.2 and tried building it but the files in folder usr/local didn't seem to update. Then I downloaded the pre-built binary files and put them in the relted folders in usr/local and I get the following error message now. (which is pretty straightforward and I actually anticipated sth like this ) 8)

Code: Select all

cd Build; ifort -c  -ip -O3 -pc80 -xW -free mod_netcdf.f90
fortcom: Error: mod_netcdf.f90, line 19: This module file was not generated by any release of this compiler.   [NETCDF]
I feel like the more I play with it the more I get in trouble. Problems are very easy when you know the answers to them. To give you an idea
netcdf does not have any documentation on how to uninstall a version (and they admit it). On the other hand, even such a simple command took me a while to figure it out... :roll:
zafer

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

#18 Unread post by kate »

You need to compile it with your compiler. When you build it, you can do "make install" to get it to put stuff in /usr/local (or wherever you tell it to go with the --prefix option to configure). You should probably "make test" or "make check" before doing "make install".

You don't have to put it in /usr/local if you want to keep more than one version around. We've got a different directory for each compiler, each version, plus I'll put it under my home if I build my own copy.

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

#19 Unread post by wilkin »

Looking back at your plot of the land/sea mask and the ADCIRC mesh points I wonder whether the triangulation of ADCIRC and interpolation to ROMS has left missing_values or fill_values in the ROMS tide file, and these are causing trouble on input.

As Hernan and Kate say, the netcdf IO code has had a lot of use and your problem rather points to trouble with your tide netcdf file.

Have you tried:

1. turning off tides and seeing if roms passes by that file and proceeds to correctly read other netcdf files

2. trivially filling an empty tide file with zeros to eliminate all possible missing or fill values.

I ask because I fear you're delving deeply into netcdf libraries when the problem may lie in your specific inpt file.

There are some newly documented codes to create roms inputs from ADCIRC on the Wiki:
https://www.myroms.org/wiki/index.php/Tidal_Forcing

John.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Post Reply