Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#645 closed defect (Fixed)

making read_mask.m more robust — at Version 2

Reported by: wilkin Owned by: arango
Priority: minor Milestone: Matlab Processing Scripts
Component: Matlab Version: 3.7
Keywords: Cc:

Description (last modified by arango)

editmask.m throws some errors due to conflicts with new or incomplete grid files when variable hraw has not been loaded.

These can be solved by making a few changes to read_mask.m

A grid file may have a variable hraw that has not been filled with data. This will cause an error in editmask. I suggest test for the case hraw has an empty dimension:

case {Vname.hraw}
  got.hraw=true;
  if any(V.Variables(n).Size==0)
     got.hraw=false;
  end

read_mask presently only checks for spherical in the form of a character, and always returns false even when spherical=1 (numeric). Make this robust and compatible with both conventions with:

 if (got.spher)
    spher=nc_read(ncfile,Vname.spher);
    if ischar(spher)
       if strcmpi(spher,'T')
          spherical=true;
       end
    else
       spherical=spher;
    end
  end

Change History (2)

comment:1 by arango, 10 years ago

Resolution: Fixed
Status: newclosed

comment:2 by arango, 10 years ago

Description: modified (diff)

Yes, thank for reporting these problems. Now, we have:

    case {Vname.hraw}
      if ~any(V.Variables(n).Size == 0),
        got.hraw=true;
      end

and

if (got.spher),
  spherical=nc_read(ncfile,Vname.spher);
  if (ischar(spherical)),
    if (spherical == 'T' || spherical == 't')
      spherical = true;
    else
      spherical = false;
    end
  end
end
Note: See TracTickets for help on using tickets.