Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to read CMORPH precipitation data (NOAA)?

315 views
Skip to first unread message

martin claverie

unread,
Feb 11, 2014, 4:10:11 PM2/11/14
to
I am trying to read CMORPH precipitation data from NOAA (http://www.cpc.ncep.noaa.gov/products/janowiak/cmorph_description.html).

After many try, I was not able to manage to read the data and could not understand why. I also search on internet, and did not find any specific help.

I attach a sample file, but more file can be found in the ftp below.
https://dl.dropboxusercontent.com/u/2768652/20140205_dly-025deg_cpc%2Bcomb.Z
ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/daily_025deg/

I did many try, but my what I found the more consistent was :

%%
nlat = 480;
nlon =1440;

fid=fopen(['20140205_dly-025deg_cpc+comb'],'r');
a2=fread(fid,'real*4',4,'ieee-be'); % I skip 4 because there are 2 data sets in the file
fclose all;

LonL = 0.125:0.25:360-0.125;
LatL = 59.875:-0.25:-59.875;

b=reshape(a2,[nlat nlon ]);

imagesc(LonL,LatL,b)

%%

The provider give a sample Fortran code that help me to understand how the data is organized.
ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.025deg_daily

The image below (found on a trusted website) should be taken as reference.
https://dl.dropboxusercontent.com/u/2768652/20140205.gif

Thank you to all of you that could help me to solve this problem...

Martin

Francisco

unread,
Jun 22, 2014, 11:00:18 PM6/22/14
to
"martin claverie" wrote in message <lde3jj$90e$1...@newscl01ah.mathworks.com>...

dawittes

unread,
Feb 15, 2015, 11:17:41 PM2/15/15
to
Hi Martin
I am facing the same issue as you encountered. I want to read data from cmorph using MATLAB if you can help me it would be very helpful.
I appreciate your cooperation in advance.
Dawit


Abanjo

unread,
Feb 26, 2015, 4:30:27 PM2/26/15
to
Took me a bit, but saw your message and figured I'd share...

fid=fopen([path 'CMORPH_V1.0_ADJ_0.25deg-3HLY_' ctime],'r','b');
rain=fread(fid,1440*480*8,'real*4',0,'ieee-le'); % This is for the 3-hourly data
fclose(fid);

You'll have to reshape it to 1440 x 480 x 8. I am sure the hourly data is similar, although I did read that they changed some things in the new version.

Good luck.

dawittes <dawitte...@gmail.com> wrote in message <FYadnVQ3CdzD8nzJ...@giganews.com>...

Job de Vries

unread,
Jan 22, 2017, 1:37:07 AM1/22/17
to
Dear all,

I found a similar approach for Matlab which i'll post below. I'm very much struggeling with the orientation of the resulting matrix, lets say I want to extrac precipitation values in Amman, Jordan I'm unclear if I extract the correct values. I end up for coordinaate 31.97 lat and 35.91 for cell index 385 and 493, but unsear If i do it correct here. Love to hear your thoughts.

% translate latitude/longitude to correct indexes
Lat_list=59.963614:-0.072771377:-60;
Lon_list=0.036378335:0.072756669:360;
Latitude = 31.973192;
Longitude = 35.909407;
lat_index = round(abs(59.963614 - Latitude) / 0.072771377);
lon_index = round(abs(0.036378335 - Longitude) / 0.072756669);

for file_nr=1:numel(All_files);
% Extract filename and date attributes
filename = All_files(file_nr).name;

% Return fid and message from the opened file
[fid, message] = fopen(filename, 'r', 'l');

% Each file contains 2 layers for each half hour there is one layer
for i = 1:2
% fread the openen rainfall binary data with dimensions 4948*1648
% use real*4 for floating points with 32 bytes
Rain = fread(fid, [4948, 1649], 'real*4');
Rain = Rain';

% Hear you read rainfall data for the relevan lat cel index and lon index cel
% Based on value from lat_list and Lon List
Rainfall = Rain(lat_index, lon_index) * 0.2;

end
fclose(fid);
end

Liya Weldegebriel

unread,
Feb 14, 2017, 8:58:32 AM2/14/17
to
Hello Job,
I am struggling to import 8km-30 min CMORPH data into Matlab. I looked at your code and how were you able to read and import CMORPH data into Matlab? (i.e. the file you named All_files).  Would you mind sharing that code as well?  I am new to this and appreciate any suggestions.

I tried this code below but it is giving me error messages.

filename='ftp://ftp.cpc.ncep.noaa.gov/precip/CMORPH_V1.0/RAW/8km-30min/'

Lon=0.036378335:0.072756669:360;
Lat=-59.963614:0.072771377:60;

[fid, message] = fopen(filename, 'r','l')
for i=1:2

Rain= fread(fid, [4948,1649], 'real*4');

end
fclose(fid)


"Job de Vries" wrote in message <o61juf$m3c$1...@newscl01ah.mathworks.com>...
0 new messages