Error opening grb2

68 views
Skip to first unread message

fede...@gmail.com

unread,
Aug 11, 2014, 11:15:16 PM8/11/14
to ncto...@googlegroups.com
In the next piece of code:
%%% Archivo par aordenar matrices de CFSv2

 archivo=['prate.m01.jul.cfsv2.data.grb2'];
 nc=ncgeodataset(archivo);
 var=nc.variables;
geovar10=nc.geovariable('Precipitation_rate');

I get this error message:
??? Error using ==> horzcat
The following error occurred converting from char to ncgeodataset:
Error using ==> ncdataset>ncdataset.ncdataset at 89
Failed to open Failed to open

Error in ==> ncdataset>ncdataset.ncdataset at 87
                ex = MException('NCDATASET:ncdataset', ['Failed to open ' url]);

Error in ==> ncgeodataset>ncgeodataset.geovariable at 165
                    ncd = ncdataset(obj);

Error in ==> ncgeodataset>ncgeodataset.subsref at 378
                            B = builtin('subsref',obj,g);

Error in ==> pp_cfs_ci06 at 35
geovar10=nc.geovariable('Precipitation_rate');

I am running nctoolbox 20130305 in Matlab 7.6.0 R2008a, PC with Windows XP. In https://dl.dropboxusercontent.com/u/56285550/prate.m01.jul.cfsv2.data.grb2 you can find an example of the file i'm trying to open. Thanks in advance!
Best rigards,
Federico

Brian Schlining

unread,
Aug 12, 2014, 11:33:45 AM8/12/14
to ncto...@googlegroups.com

Hi Federico,

There’s no variable named Precipitation_rate in your grib file. Use Precipitation_rate_surface_1_Month_Average instead. For example:

>> ds = ncgeodataset('prate.m01.jul.cfsv2.data.grb2');
>> ds.variables

ans =  

    'time_bounds'
    'Precipitation_rate_surface_1_Month_Average'
    'lat'
    'lon'
    'time'
   
>> g = ds.geovariable('Precipitation_rate_surface_1_Month_Average')

g =  

  28x190x384 ncgeovariable array with properties:

       dataset: [1x1 ncgeodataset]
          name: 'Precipitation_rate_surface_1_Month_Average'
          axes: {3x1 cell}
    attributes: {15x2 cell}

Cheers
Brian

--
You received this message because you are subscribed to the Google Groups "nctoolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nctoolbox+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- 
Brian Schlining

fede...@gmail.com

unread,
Aug 13, 2014, 4:17:08 AM8/13/14
to ncto...@googlegroups.com
Thanks, Brian! That's something i don't understand. In a Pc with Ubuntu 12.04.4 and Matlab R2012a (7.14.0.739) 64-bit i get the same you copied. But in my Windows XP PC at home i get this answer:


>> ds = ncgeodataset('prate.m01.jul.cfsv2.data.grb2');
ds.variables

ans =

    'Precipitation_rate'
    'gaussw'
    'latLonCoordSys'
    'time'
    'lat'
    'lon'


>> g = ds.geovariable('Precipitation_rate_surface_1_Month_Average')
Warning: Could not find the variable Precipitation_rate_surface_1_Month_Average
> In ncdataset>ncdataset.attributes at 242
  In ncgeodataset>ncgeodataset.geovariable at 147
  In ncgeodataset>ncgeodataset.subsref at 378
??? Attempt to reference field of non-structure array.

Error in ==> ncdataset>ncdataset.attributes at 244
                aa = v.getAttributes();

Error in ==> ncgeodataset>ncgeodataset.geovariable at 147
                att = obj.attributes(variableName);


Error in ==> ncgeodataset>ncgeodataset.subsref at 378
                            B = builtin('subsref',obj,g);

>> g = ds.geovariable('Precipitation_rate')

??? Error using ==> horzcat
The following error occurred converting from char to ncgeodataset:
Error using ==> ncdataset>ncdataset.ncdataset at 89
Failed to open Failed to open

Error in ==> ncdataset>ncdataset.ncdataset at 87
                ex = MException('NCDATASET:ncdataset', ['Failed to open ' url]);

Error in ==> ncgeodataset>ncgeodataset.geovariable at 165
                    ncd = ncdataset(obj);

Error in ==> ncgeodataset>ncgeodataset.subsref at 378
                            B = builtin('subsref',obj,g);

For the same file, the variable name changes in PCs with differente OS and Matlab versions. I know from previous experience (a month ago, when this problem was not present) that the matrix 'Precipitation_rate' is 280x190x384, because it is composed of 10 forecast for 28 years.

Best rigards and thank you very much for your help.
Fede
Reply all
Reply to author
Forward
0 new messages