RE: [ncl-talk] Interpolating hourly values from a monthly value

From: Tummuri, Spandana <spandana.tummuri_at_nyahnyahspammersnyahnyah>
Date: Mon, 24 Sep 2007 23:29:22 -0500

Hello Dennis,
 
My bad. I worked on that since yesterday and fixed that problem. Initially my soil data were available as one file per month. I combined files for 12 months and created a yearly file with 12 values.
 
I could fix the problem by doing so I think as I get the following result when I did printVarSummary of zDay and z6hr.
Thanks.
 
Spandana Tummuri
 
Variable: zDay
Type: float
Total Size: 2890800 bytes
            722700 values
Number of Dimensions: 4
Dimensions and sizes: [levsoi | 10] x [lat | 22] x [lon | 9] x [day | 365]
Coordinates:
            levsoi: [0.007100635..2.864607]
            lat: [20.31112..49.72712]
            lon: [90..101.25]
            day: [1..365]
Number Of Attributes: 6
  long_name : soil temperature
  units : K
  cell_method : time: mean
  _FillValue : 1e+36
  missing_value : 1e+36
  info : NCL: clmMon2clmDay

Variable: x6hr
Type: float
Total Size: 11563200 bytes
            2890800 values
Number of Dimensions: 4
Dimensions and sizes: [10] x [22] x [9] x [1460]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
 

 

________________________________

From: Dennis Shea [mailto:shea_at_ucar.edu]
Sent: Mon 9/24/2007 11:18 PM
To: Tummuri, Spandana
Cc: ncl-talk_at_ucar.edu
Subject: Re: Interpolating hourly values from a monthly value

No. This will not work.

[1] How can you interpolate in time when you give it
     one time value? You must have at least two points
     for interpolation.

[2] clmMon2clmDay works *only* on climatologies.

http://www.ncl.ucar.edu/Document/Functions/Contributed/clmMon2clmDay.shtml

     It requires that the leftmost dimension [time] be 12.
     Clearly, your
        zDay = clmMon2clmDay(TSOI(0,:,:,:), 1, 0)
     does not satisfy this requirement.

[3] You could probably try something like

     x6hr = new ( (/nlevsoi,nlat,mlon,ntime/), typeof(TSOI) )
     x6hr(:,:,:,2::4) = (/ TSOI /) ; fill every 4th value
     x6hr = linmsg( x6hr , 1)

good luck

Tummuri, Spandana wrote:
> Hello everyone,
>
> I am trying to interpolate 6-hourly values using a monthly value. The file SOIL-2020-01.nc has TSOI as a function of (time,levsoi,lat,lon). In the given file, variable TSOI is written for one timestep, 10 levels, several latitudes and longitudes. TSOI is considered as a monthly average for entire month and I need to interpolate 6-hourly values for the month from the single value. Can anyone please check the code below and tell me if I got it correct?
>
> Thanks in advance
> Spandana
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> fn ="/home/stummuri/CCSM-INPUTS/SOIL-2020-01.nc"
>
> in = addfile(fn, "r")
>
> lat = in->lat
>
> lon = in->lon
>
> time = in->time
>
> levsoi = in->levsoi
>
> tsoi = in->TSOI
>
> nlat = dimsizes(lat)
>
> mlon = dimsizes(lon)
>
> ntime = dimsizes(time)
>
> nlevsoi = dimsizes(levsoi)
>
> zDay = clmMon2clmDay(TSOI(0,:,:,:), 1, 0)
>
> x6hr = new ( (/nlevsoi,nlat,mlon,4*31/), typeof(zDay) )
>
> x6hr(:,:,:,::4) = (/ zDay /) ; fill every 4th value
>
> x6hr = linmsg(x6hr, 4)
>
> end
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 24 2007 - 22:29:22 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 26 2007 - 10:02:41 MDT