CMorph ds502.1: Difference between revisions

From MRC Centre for Outbreak Analysis and Modelling
Jump to navigation Jump to search
 
Line 43: Line 43:
   for (int record=1; record<=8; record++) {
   for (int record=1; record<=8; record++) {
     for (int i=0; i<691200; i++)      // Ignore -9999 (no data) - and 3.0* is for 3-hrly mm/hr
     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()));
      float d = dis.readFloat();
      d = Float.intBitsToFloat(Integer.reverseBytes(Float.floatToRawIntBits(d)));
       data[i]+=(3.0*Math.max(0,d));
   }
   }
   dis.close();
   dis.close();

Latest revision as of 14:37, 13 February 2017

About

What's the difference between this and the ds502.0 version? Not very sure. It seems to only contain one value per pixel instead of two, labelled just as "Precipitation estimate". Further details may follow. Anyway. Details below, which will be very similar.

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 / units: Estimated 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. It also appears that with this .1 version, bytes are now LSB-first, so we have to transform them in Java.

Each block is a 1440x480 grid of 4-byte floats, LSB-first. The ordering of the grid starts at the Northern-Western most point, and then moves East first, repeating for each latitude.

Example Code

Java Daily Accumulation

Here's Java code to calculate daily precipitation, 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<=8; record++) {
    for (int i=0; i<691200; i++)      // Ignore -9999 (no data) - and 3.0* is for 3-hrly mm/hr
      float d = dis.readFloat();
      d = Float.intBitsToFloat(Integer.reverseBytes(Float.floatToRawIntBits(d)));
      data[i]+=(3.0*Math.max(0,d));
  }
  dis.close();
 

Citation

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