Extract wave watch III significant wave height data

347 views
Skip to first unread message

lzh...@mail.usf.edu

unread,
Mar 4, 2015, 3:17:15 PM3/4/15
to ncto...@googlegroups.com
Hi, Rich,

I download wave watch III significant height data "multi_1.at_4m.hs.201412.grb2'.  Then I used the following matlab code to extract longitude, latitude, time, and significant height data:

fname='multi_1.at_4m.hs.201412.grb2';
nc=ncgeodataset(fname);
%  using nc.variables to check the variable names in this grb2 file.

lon=nc{'lon'}(:);
lat=nc{'lat'}(:);
ttt=nc{'time'}(:);
param='Significant_height_of_combined_wind_waves_and_swell_surface';
hss=nc{param}(:);

The longitude, latitude, and time can be correctly extracted, but significant wave height cannot and the following error message is shown:

Error using ncdataset/readdata (line 501)
Java exception occurred:
java.lang.OutOfMemoryError: Java heap space

Error in ncdataset/data (line 165)
                    d = obj.readdata(variable, first, last, stride);

Error in ncgeodataset/subsref (line 378)
                            B = builtin('subsref',obj,g);


Error in ncvariable/somedata (line 353)
                data = obj.dataset.data(name, first, last, stride);

Error in ncvariable/data (line 174)
                d = somedata(obj, 1, first, last, stride);

Error in ncgeovariable/subsref (line 1028)
                                        sref = obj.data(first, last, stride);


Error in ncgeodataset/subsref (line 408)
                        B = v.data(s(2).subs{:});

I know the array size of hss is 249x481x576.  I can use loop to extract them by using the following code:

for i=1:249
 hss(i,:,:)=squeeze(nc{param}(i,:,:));
end

but it is much slower. 

By the way, I can extract the first 100x481x576 by using hss=nc{param}(1:100,:,:);  Does this mean that the array size 249x481x576 exceeds the array defined in NCTOOLBOX?

Please advice;

Thanks,
Lianyuan


Brian Schlining

unread,
Mar 4, 2015, 3:53:53 PM3/4/15
to ncto...@googlegroups.com

Hi Lianyuan,

You just need to increase the Java Heap size in Matlab. From the Matlab menu go to Preferences -> MATLAB -> General -> Java Heap Memory

More details can be found at http://blogs.mathworks.com/community/2010/04/26/controlling-the-java-heap-size/

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

Rich Signell

unread,
Mar 5, 2015, 12:46:40 PM3/5/15
to ncto...@googlegroups.com
Don't try to load all time steps at once. Process each time step in a loop

nc{param}(istep,:,:)


--
Rich Signell
81 Queen St
Falmouth, MA 02540

eduardo sierra

unread,
Feb 17, 2016, 9:40:19 PM2/17/16
to nctoolbox, ri...@signell.us
Hi all, this posts have been very helpful. I am also trying to download sig wave height using this code:

nc=ncgeodataset('multi_1.ak_10m.hs.201507.grb2');
nc.variables
>>ans = 

    'Significant_height_of_combined_wind_waves_and_swell_surface'
    'lat'
    'lon'
    'time'

Same as Lianyuan I can extract the longitude, latitude, and time, but significant wave height cannot be extracted and I get the following error message is shown:
ttt=nc{'time'}(:);
lat=nc{'lat'}(:);
lon=nc{'lon'}(:);
for i=1:249
 hss(i,:,:)=squeeze(nc{param}(i,:,:));
end

Undefined function or variable 'escapeName'.

Error in ncdataset/findvariable (line 447)
                v = obj.netcdf.findVariable(ucar.nc2.NetcdfFile.escapeName(variable))

Error in ncdataset/attributes (line 256)
                v = obj.findvariable(variable);

Error in ncgeodataset/geovariable (line 147)
                att = obj.attributes(variableName);

Error in ncgeodataset/subsref (line 410)
                    v = obj.geovariable(s(1).subs);


Do you have any suggestion?

Best Regards and thanks in advance!

Eduardo
To unsubscribe from this group and stop receiving emails from it, send an email to nctoolbox+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
-- 
Brian Schlining

--
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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Brian Schlining

unread,
Feb 18, 2016, 11:48:12 AM2/18/16
to eduardo sierra, ncto...@googlegroups.com, ri...@signell.us

Hi Eduardo,

Can you post a file somewhere I can get it so I can duplicate the issue?

Thanks

Brian



-- 
Brian Schlining
To unsubscribe from this group and stop receiving emails from it, send an email to nctoolbox+...@googlegroups.com.

eduardo sierra

unread,
Feb 19, 2016, 7:28:07 PM2/19/16
to Brian Schlining, ncto...@googlegroups.com, ri...@signell.us
Thanks for responding Brian. I solved it. I was using the wrong name for the param variable.

Cheers to all contributors!

ES

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
--
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.


--
Rich Signell
81 Queen St
Falmouth, MA 02540

--
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.




--

          .~`` ' .  
       . `  . `
` `  
_ . -'     ' . . .
Eduardo Sierra


Reply all
Reply to author
Forward
0 new messages