RE: [ncl-talk] linint1_Wrap

From: Tummuri, Spandana <spandana.tummuri_at_nyahnyahspammersnyahnyah>
Date: Thu, 15 Nov 2007 12:52:39 -0600

Hello Adam,
 
Thanks for the confirmation.
 
As for your second suggestion (Note that lat,lon,time, and levsoi are automatically written to the file
as they are coordinate variables of x...), earlier when I did not use Wrap I specified them or else I would get variables named nc1, nc2 etc. I did not realize that Wrap makes the lines redundant. I will get rid of them.
 
On the same topic, I have a different question. I use linint_Wrap on a an original .nc file, interpolate values etc, and then save it as a modified .nc file. Is there someway I can retain the global attributes and history data(e.g. provided below) attached to the original .nc file in the modified .nc file while modifying it using NCL? If this question is not relevant to the NCL user group please do let me know.
 
Thanks,
Spandana.
 
// global attributes:
                :Conventions = "CF-1.0" ;
                :source = "CAM" ;
                :case = "b30.042e" ;
                :title = "b30.042e T85_gx1v3 FUTURE_A2 from b30.030e year 2000-01-01" ;
                :logname = "" ;
                :host = "" ;
                :Version = "$Name: ccsm3_0_beta19 $" ;
                :revision_Id = "$Id: history.F90,v 1.26.2.42 2004/03/05 00:34:23 mvr Exp $" ;
                :history = "Wed Jul 4 18:41:39 2007: ncks -O -F -d time,1,124 VBOT.nc VBOT-1.nc\n",
                        "Mon Sep 26 13:46:22 2005: ncrcat -O b30.042e.cam2.h3.VBOT.2020-01-01_cat_2020-12-31.nc b30.042e.cam2.h3.VBOT.2021-01-01_cat_2021-12-31.nc b30.042e.cam2.h3.VBOT.2022-01-01_cat_2022-12-31.nc b30.042e.cam2.h3.VBOT.2023-01-01_cat_2023-12-31.nc b30.042e.cam2.h3.VBOT.2024-01-01_cat_2024-12-31.nc b30.042e.cam2.h3.VBOT.2025-01-01_cat_2025-12-31.nc b30.042e.cam2.h3.VBOT.2026-01-01_cat_2026-12-31.nc b30.042e.cam2.h3.VBOT.2027-01-01_cat_2027-12-31.nc b30.042e.cam2.h3.VBOT.2028-01-01_cat_2028-12-31.nc b30.042e.cam2.h3.VBOT.2029-01-01_cat_2029-12-31.nc b30.042e.cam2.h3.VBOT.2020-01-01_deccat_2029-12-31.nc\n",

________________________________

From: Adam Phillips [mailto:asphilli_at_cgd.ucar.edu]
Sent: Thu 11/15/2007 11:33 AM
To: Tummuri, Spandana
Cc: ncl-talk_at_ucar.edu
Subject: Re: linint1_Wrap

Hi Spandana,

It looks to me like linint1_Wrap is saving your metadata, as
printVarSummary(x) from your script returned this:

Type: float
Total Size: 38016 bytes
             9504 values
Number of Dimensions: 4
Dimensions and sizes: [time | 12] x [lat | 22] x [lon | 9] x [levsoi | 4]
Coordinates:
             time: [54781..55115]
             lat: [20.31112..49.72712]
             lon: [90..101.25]
             levsoi: [10..200]
Number Of Attributes: 5
   missing_value : 1e+36
   _FillValue : 1e+36
   cell_method : time: mean
   units : K
   long_name : soil temperature

By the way, as your are using the Wrap version of linint1, you do not
have to do the following:
x!0 = "time"
x!1 = "lat"
x!2 = "lon"
x!3 = "levsoi"
fo->lat = lat
fo->lon = lon
fo->time = time
fo->levsoi = (/ lNew /)

Note that lat,lon,time, and levsoi are automatically written to the file
as they are coordinate variables of x...
Good luck,
Adam

Tummuri, Spandana wrote:
> Hello Adam,
>
> Please find the entire program and printVarSummary output attached.
>
> Thanks.
> Spandana.
>
> ________________________________
>
> From: Adam Phillips [mailto:asphilli_at_cgd.ucar.edu]
> Sent: Wed 11/14/2007 11:46 AM
> To: Tummuri, Spandana
> Cc: ncl-talk_at_ucar.edu
> Subject: Re: linint1_Wrap
>
>
>
> Hi Spandana,
>
> Can you add the following for us to your script and send us the output:
> printVarSummary(levsoi)
> printVarSummary(TSOI)
> printVarSummary(lNew)
> x=linint1_Wrap (levsoi,TSOI(time|:,lat|:,lon|:,levsoi|:),False,lNew, 0)
> printVarSummary(x)
>
> Thanks,
> Adam
>
> Tummuri, Spandana wrote:
>> Hello,
>>
>> I wrote the following program to interpolate levels. I used linint1_Wrap but it still does not retain Metadata. Is there any error in my program?
>>
>> Thanks in advance.
>> Spandana Tummuri
>>
>> lat = in1->lat
>> lon = in1->lon
>> time = in1->time
>> levsoi = in1->levsoi
>> TSOI = in1->TSOI
>> nlat = dimsizes(lat)
>> mlon = dimsizes(lon)
>> ntime = dimsizes(time)
>> nlevsoi = dimsizes(levsoi)
>>
>> lNew = (/ 10, 40, 100, 200 /)
>> lNew_at_units = "centimeters"
>> lNew!0 = "levsoi"
>> x = linint1_Wrap (levsoi, TSOI(time|:,lat|:,lon|:,levsoi|:), False, lNew, 0)
>> x!0 = "time"
>> x!1 = "lat"
>> x!2 = "lon"
>> x!3 = "levsoi"
>> x_at_units = "K"
>>
>> filo="/home/stummuri/CCSM-INPUTS/s01-int.nc"
>> fo=addfile(filo,"c")
>> fo->TSOI = x
>> fo->lat = lat
>> fo->lon = lon
>> fo->time = time
>> fo->levsoi = (/ lNew /)
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> --------------------------------------------------------------
> Adam Phillips asphilli_at_ucar.edu
> National Center for Atmospheric Research tel: (303) 497-1726
> ESSL/CGD/CAS fax: (303) 497-1333
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>

--
--------------------------------------------------------------
Adam Phillips                                asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000                          
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 15 2007 - 11:52:39 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 25 2007 - 07:21:25 MST