issue with coarse2fine.m

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
nmichelet
Posts: 31
Joined: Fri Oct 02, 2015 2:24 pm
Location: Cerema

issue with coarse2fine.m

#1 Unread post by nmichelet »

hi,
I am looking for a solution for my problem with coarse2fine, I guess it is not a big one but I don't find what to do.
Here is the error it gives me

F = coarse2fine ('~/roms/Projects/Iroise_sea/agrif_parent.nc','agrif_test.nc',5,20,40,20,40)

Interpolating from coarse to fine ...

Computing grid spacing: great circle distances

Number of points: Coarse = 50 x 50, fine = 102 x 102
Error using netcdflib
The NetCDF library encountered an error during execution of 'putAttDouble'
function - 'Name contains illegal characters (NC_EBADNAME)'.

Error in netcdf.putAtt (line 79)
netcdflib(funstr,ncid,varid,attname,xtype,attvalue);

Error in nc_create (line 112)
netcdf.putAtt(ncid,varid,aname,avalue);

Error in coarse2fine (line 548)
nc_create(Gout, mode, I);

Thanks

jpringle
Posts: 107
Joined: Sun Jul 27, 2003 6:49 pm
Location: UNH, USA

Re: issue with coarse2fine.m

#2 Unread post by jpringle »

It would be easier to debug if you printed out what the attribute name is. You could add an fprint by line 112 of nc_create, and print out what aname is. This might provide insight.

Cheers,
Jamie

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

Re: issue with coarse2fine.m

#3 Unread post by wilkin »

Jamie offers good advice that tracking down the offending attribute would be instructive. In Matlab it's easy to trap the condition with the debugger:

>> dbstop if error

Then when you run the code Matlab will stop where it fails and you can interrogate the variables and values in the workspace that are arguments being passed to the function that throws the error. I anticipate a mismatch in type is the problem.

That said, I expect your problem stems from your parent grid file "agrif_parent.nc" having, or not having, global attributes or variable attributes that coarse2fine.m expects to be present in a grid file that is compatible with the myroms.org nesting code. Or, you have a type mismatch in variables. A likely candidate is "spherical" which old version of ROMS have as a string but new versions expect to be an integer.

Compare the grid file template in Data/ROMS/CDL/grd_spherical.cdl with the result of
ncdump -h agrif_parent.nc to seek obvious differences in key variables and attributes.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

nmichelet
Posts: 31
Joined: Fri Oct 02, 2015 2:24 pm
Location: Cerema

Re: issue with coarse2fine.m

#4 Unread post by nmichelet »

Thanks for your advices, I will work on this and try to find the solution

User avatar
stevenmiguelfigueroa
Posts: 22
Joined: Mon Apr 20, 2020 12:49 pm
Location: Chungnam National University

Re: issue with coarse2fine.m

#5 Unread post by stevenmiguelfigueroa »

I received the same error.
The messages above were helpful to resolve it.

Running 'dbstop if error' gave attname and attvalue as '' or [] (blank).
The problem was my input grid didn't have global attributes defined.
I defined them using nc_attadd.m following the Lake Jersey example, and coarse2fine worked.

Post Reply