Trouble with reading binary precipitation file

From: Erik Noble <enoble_at_nyahnyahspammersnyahnyah>
Date: Tue, 15 Jul 2008 16:11:27 -0400

Dear NCL world,

I am trying to use the ncl sample script at
http://www.ncl.ucar.edu/Applications/r-binary.shtml to read in a
precipitation binary file (one day, 16 records)
I keep getting an error when trying to use ispan() for the data. The
data (described below) is described as 1440 x 480 REAL*4 array of data
which is oriented
from 0.125E EASTward and from 59.875N SOUTHward, with a grid increment
of 0.25 degrees of latitude and longitude.
ncl has a problem with this line in my code: finarr&lat =
ispan(-60,60,.25). I don't understand why I'm getting this error.
Could I please have some help with fixing this?
erik

THOMASON_at_ATHENA: /usr/people/thomason> ncl *.ncl
 Copyright (C) 1995-2007 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 4.3.1
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: finarr
Type: float
Total Size: 2764800 bytes
            691200 values
Number of Dimensions: 3
Dimensions and sizes: [1] x [480] x [1440]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999

Variable: finarr
Type: float
Total Size: 2764800 bytes
            691200 values
Number of Dimensions: 3
Dimensions and sizes: [1] x [480] x [1440]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
(0) Assigning coordinate variable information
fatal:Argument type mismatch on argument (2) of (ispan) can not coerce
fatal:Execute: Error occurred at or near line 19 in file cmorph_binary_read.ncl

THOMASON_at_ATHENA: /usr/people/thomason>

;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
    nlat = 480
    nlon = 1440
    fils = systemfunc("ls 20060901_3hr-025deg_cpc+comb")
    finarr = new((/dimsizes(fils),nlat,nlon/),"float") ; predefine
array for one
        printVarSummary(finarr)
  ; year of daily data
    do gg = 0,dimsizes(fils)-1 ; loop thru each file
       finarr(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float")
    end do
        printVarSummary(finarr)
    print("Assigning coordinate variable information")
    finarr!0 = "time"
    finarr&time = ispan(1,dimsizes(fils),1)
    finarr!1 = "lat"
    finarr&lat = ispan(-60,60,.25)

    finarr&lat_at_units = "degrees_north"
    finarr!2 = "lon"
    finarr&lon = ispan(0,360,.25)
    finarr&lon_at_units = "degrees_east"

    a = addfile("sample.nc","c") ; write netCDF file
    a_at_title = "1 year of daily data"
    a_at_source = "Your program name/location"
    filedimdef(a,"time",-1,True) ; make time an UNLIMITED
dimension, always recommended
    a->precip = finarr
   end

Description of Data:

The 0.25 degree 3-hourly CMORPH can be found on the ftp.cpc.ncep.noaa.gov
server in the precip/global_CMORPH/3-hourly_025deg directory
                

The data are compressed using the standard Unix compress function (files have a
suffix of ".Z"). Each file is composed of 16 direct access binary
("big_endian") records that are defined as follows:

Record 1: contains the merged microwave precipitation only for 00 UTC
Record 2: contains the "CMORPH" precipitation estimates for 00 UTC

Record 3: contains the merged microwave precipitation only for 03 UTC
Record 4: contains the "CMORPH" precipitation estimates for 03 UTC
.
.
.
Record 15: contains the merged microwave precipitation only for 21 UTC
Record 16: contains the "CMORPH" precipitation estimates for 21 UTC

All units are "mm/hr". Missing data are denoted by values of "-9999."
Each record contains a 1440 x 480 REAL*4 array of data which is oriented
from 0.125E EASTward and from 59.875N SOUTHward, with a grid increment
of 0.25 degrees of latitude and longitude. Thus, the grid locations
are the centers od a 0.25 degree lat/lon grid box. Note that these
estimates represent spatial averages, so the data are grid-centered,
rather than lattice-centered.
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 15 2008 - 14:11:27 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 18 2008 - 08:51:52 MDT