Hello, everyone.

I have downloaded the daily 2m temperature of ERA-40 dataset, it's .grib format. I want to calculate monthly max and min temperature, but now the data record four times a day , namely , 00:00:00,06:00:00,12:00:00 and 18:00:00. And the data ,such as september 1957, it's grib_struct format, which has 120 records, how should I write the script? Now , I can just read a record, I don't know how to write the loop? can anyone help me ? Thank you!

This is the script reading file, and attachment is the grib file.

>>grib_struct=read_grib('E:\_mars-webmars-public-svc-green-001-6fe5cac1a363ec1525f54343b6cc9fd8-R3BtDg.grib',-1);

>>dn=datenum(grib_struct(31).pds.year,grib_struct(31).pds.month,grib_struct(31).pds.day,grib_struct(31).pds.hour,grib_struct(31).pds.min,0);

>>datestr(dn,31)

>>grib_struct(31).gds

>>gds=grib_struct(31).gds;

>>lon=gds.Lo1:gds.Di:gds.Lo2;

>>lat=gds.La1:-gds.Di:gds.La2;

>>ThisUgrd=reshape(grib_struct(31).fltarray,gds.Ni,gds.Nj)';

% It has 120 records,but I don't know how to read them all once time? I can just read one record now.

>>pcolor(lon,lat,ThisUgrd)

>>R=makerefmat('RasterSize',size(ThisUgrd),'Latlim',[59 90],'Lonlim',[-74 -11])

>>[latlimits,lonlimits]=limitm(ThisUgrd,R)

%The folling scripts means that extracting temperature values from the grib.

>>lats=[72.58;75.1;71.3];

>>longs=[-34.48;-42.33;-26.7];

>>value=ltln2val(ThisUgrd,R,lats,longs)

More Saiping Jiang's questions See All
Similar questions and discussions