[ncl-talk] subtracting values of two different files

David Brown dbrown at ucar.edu
Tue May 19 23:03:40 MDT 2015


Uncomment the line (remove the semi-colon at the beginning):
;printVarSummary(tasmin_diff)
and you will see that lat/lon and time coordinates are attached to the
variable tasmin_diff.
Try this:
lat = tasmin_diff&lat
print(lat)

 -dave


On Tue, May 19, 2015 at 10:36 PM, amit timilsina
<timilsinaamit87 at huskers.unl.edu> wrote:
> This works perfectly but I could not retrieve the lat, lon and month
> information. What changes do I need to make? Any link which can help me?
> Thank yo very much for your support.
> Regards,
> Amit
>
>
> On Tue, May 19, 2015 at 6:48 PM, David Brown <dbrown at ucar.edu> wrote:
>
> Well as a matter of fact you can just subtract the two arrays. Note
> the way I do it means the time coordinate of the result has the values
> of the first array, but that is arbitrary:
>
> f1 =
> addfile("tasmin_Amon_MPI-ESM-LR_decadal1980_r1i1p1_198101-201012_USA.nc","r")
> f2 = addfile("tasmin_Amon_MPI-ESM-LR_rcp26_r1i1p1_201101-204012_USA.nc","r")
> tasmin1 = f1->tasmin
> tasmin2 = f2->tasmin
> ;printVarSummary(tasmin1)
> ;printVarSummary(tasmin2)
> printMinMax(tasmin1,0)
> printMinMax(tasmin2,0)
> tasmin_diff = tasmin1 ; propagate the attributes to the result --
> note some attributes may need editing after this.
> tasmin_diff = tasmin1 - tasmin2
> ;printVarSummary(tasmin_diff)
> printMinMax(tasmin_diff,0)
>
> On Tue, May 19, 2015 at 3:00 PM, amit timilsina
> <timilsinaamit87 at huskers.unl.edu> wrote:
>> Hello all,
>> I have two files which contains three dimensions; time, latitude and
>> longitude. Latitude and longitude of both files are similar but time scale
>> is different which are 1980 to 2010 in case of first file and 2011 to 2040
>> for second file. The variable here is minimum temperature (tasmin). I want
>> to subtract tasmin value of one file with another. Is there easy way to use
>> both the files at a time and get difference for tasmin value??
>>
>> I have attached two files as well.
>>
>>
>> Regards,
>> Amit
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>


More information about the ncl-talk mailing list