CMorph ds502.0

From MRC Centre for Outbreak Analysis and Modelling
Jump to navigation Jump to search

About

This is the predecessor to the ds502.1 version, and contains for each pixel, two values. Once is the CMorph Precipitation (called CPC), and the other is Merged Microwave precipitation. They are available as binary files, and NetCDF - for universal simplicity, I'll be working with the binary version.

Getting Access

Sign up at http://rda.ucar.edu for free user account. You can then browse through all their data, tick boxes for what you want, and download a perl script that will then download your data. Edit the perl script so that it knows your password, and run it with something like perl download.pl. I use Strawberry Perl. You'll also need wget.exe in the same folder. Note that on 2015/10/28, the filename convention changed.


File Format

Pixel resolution 1440 x 480
Geographical resolution 0.25º x 0.25º
Longitude range of first pixel 0.0ºE - 0.25ºE
Latitude range of first pixel 59.75ºN - 60.0ºN
Data 1 / units: CPC - Estimated precipitation (mm per hour)
Data 2 / units: COMB - Merged Microwave precipitation (mm per hour)
No Data Value: -9999

According to the readme, these files are compressed, however, I found that not to be true; they were all uncompressed, same-length files. The binary files are ordered in blocks for each 3-hourly reading. Each block is a 1440x480 grid of 4-byte floats, MSB-first (i.e. it reads trivially into Java, but you'll need to flip the byte order for LSB-first languages like C). The ordering of the grid starts at the Northern-Western most point, and then moves East first, repeating for each latitude.

Record 1 COMB 0000-0300hrs
Record 2 CPC 0000-0300hrs
Record 3 COMB 0300-0600hrs
Record 4 CPC 0300-0600hrs
... ... ...
Record 15 COMB 2100-2400hrs
Record 16 CPC 2100-2400hrs

Example Code

Java Daily Accumulation

Here's Java code to calculate daily precipitation (CPC), by summing the CPCs.

  DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(infile))));
  float[] data = new float[691200];

  for (int record=1; record<=16; record++) {

    if (record%2==1) {       // Skip the COMB block
      long skip=691200*4;    // Below is fail-safe way to skip bytes in Java...
      while (skip>0) skip-=dis.skipBytes(skip);
    
    } else {
      for (int i=0; i<691200; i++)      // Ignore -9999 (no data) - and 3.0* is for 3-hrly mm/hr
        data[i]+=(3.0*Math.max(0,dis.readFloat()));
    }
  }
  dis.close();
 

Citation

Climate Prediction Center/National Centers for Environmental Prediction/National Weather Service/NOAA/U.S. Department of Commerce. 2011, updated daily. NOAA CPC Morphing Technique (CMORPH) Global Precipitation Analyses. Research Data Archive at the National Center for Atmospheric Research, Computational and Information Systems Laboratory. https://doi.org/10.5065/D6CZ356W. Accessed† dd mmm yyyy.