Re: reading NCEP reanalysis 4x times daily data

From: Adam Phillips (asphilli AT XXXXXX)
Date: Wed Feb 06 2002 - 15:58:04 MST

  • Next message: Dennis Shea: "Re: reading NCEP reanalysis 4x times daily data"

    Matt,

    When reading in original NCEP Reanalysis data, you need to use the add_offset
    and the scale factor accompanying the data array to obtain the correct form of
    the data. From your print statement I see that this particular data array has
    both.

    Here is a section of code that will convert the data to the correct form, and
    change the array from short to float (easier to use NCL functions that way):

    begin

    fdir="/data/matt/reanalysis/"
    fnam="air.2m.gauss.1987.nc"
    f = addfile(fdir+fnam,"r")

    air=f->air
    printVarSummary(air)

    airnew = new ((/dimsizes(air)/),float,1.e+20)

    airnew = (/ (air*air@scale_factor)+air@add_offset /)

    copyVarCoords(air,airnew) ;in contributed.ncl
    delete(air)
    printVarSummary(airnew)
    end

    That should do it. Hope that helps.
    Adam

    > Date: Wed, 06 Feb 2002 17:49:42 -0500
    > From: Matt Fearon <matthew.fearon@unh.edu>
    > X-Accept-Language: en
    > MIME-Version: 1.0
    > To: ncl-talk@UCAR.EDU
    > Subject: reading NCEP reanalysis 4x times daily data
    > Content-Transfer-Encoding: 7bit
    >
    > Dear NCL users:
    >
    > I am trying to read NCEP reanalysis 4x times daily data using
    > NCL. I am working on sgi machine running irix 6.5. Here is
    > my script for reading surface temperature;
    >
    > begin
    >
    > fdir="/data/matt/reanalysis/"
    > fnam="air.2m.gauss.1987.nc"
    > f = addfile(fdir+fnam,"r")
    >
    > air=f->air
    > print(air(0,1:10,2))
    >
    > end
    >
    > here is the output from the print;
    >
    > Variable: air (subsection)
    > Type: short
    > Total Size: 20 bytes
    > 10 values
    > Number of Dimensions: 1
    > Dimensions and sizes: [lat | 10]
    > Coordinates:
    > lat: [86.6531..69.5217]
    > Number Of Attributes: 18
    > lon : 3.75
    > time : 17408952
    > parent_stat : Individual Obs
    > I
    > statistic : Mean
    > M
    > level_desc : 2 m
    > O
    > dataset : NMC Reanalysis
    > L
    > var_desc : Air temperature
    > A
    > GRIB_name : TMP
    > GRIB_id : 11
    > least_significant_digit : 1
    > precision : 2
    > missing_value : 32766
    > scale_factor : 0.01
    > add_offset : 477.65
    > units : degK
    > actual_range : <ARRAY>
    > valid_range : <ARRAY>
    > long_name : 4xDaily Air temperature at 2 m
    > (0) -23925
    > (1) -22905
    > (2) -22345
    > (3) -21395
    > (4) -21125
    > (5) -20865
    > (6) -20735
    > (7) -20765
    > (8) -20735
    > (9) -20535
    >
    >
    > The data is incorrect, but I am not sure why. Do I need to declare the
    > array using new a certain way. Any suggestions would be greatly
    > appreciated.
    >
    > thank you,
    > Matt
    >
    >

    -------------------------------------------------------------
    Adam Phillips email: asphilli@ucar.edu
    Climate and Global Dynamics Division tel: (303) 497-1726
    National Center for Atmospheric Research fax: (303) 497-1333
    P.O. Box 3000
    Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli



    This archive was generated by hypermail 2b29 : Wed Feb 06 2002 - 15:57:22 MST