[ncl-talk] overlap

Mary Haley haley at ucar.edu
Tue Apr 21 08:42:19 MDT 2015


Nitin,

There's a typo in the "try.ncl" script.  You have:

f1   = addfile(fil1,"r")
f2   = addfile(fil1,"w")


Note that this is causing the "fil1" file to be opened twice.  You want the
second "fil1" to be "fil2":

f1   = addfile(fil1,"r")
f2   = addfile(fil2,"w")

The reason for "x" being used twice is that it is possible to use x in a
calculation and then replace x with that new calculation.  For example,
this is perfectly valid:

x = 1
x = x+1   ; x is now 2

In the "where" statement in the "try.ncl" script, it is checking where MASK
is NOT equal to missing, and in these locations, it is setting x=MASK.  At
locations where MASK is missing, then x remains unchanged.

--Mary


On Tue, Apr 21, 2015 at 4:22 AM, Nitin Patil <nitinpatil85 at gmail.com> wrote:

> Dear Dennis,
>
> Thanks for your script. I tried that and I am quite new to ncl. It shows
> variable missing in file but I checked and it is there with same name
> mentioned in script. Find attached ncl script.
> Also can you tell me how to save the newly created file in netcdf.
>
> one query in code: why x is used twice x=?? in line 14 and 15
>
> My input files in earlier emails is attached.
>
> Thanks
>
> --
> Regards,
> Nitin Patil
>
>
> On Mon, Apr 20, 2015 at 7:31 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>> make a copy of the global file for 'safety'
>>
>> untested
>>
>>   fil1 = "agri_india_T63.nc"
>>   fil2 = "global_T63.nc"
>>   f1   = addfile(fil1,"r")
>>   f2   = addfile(fil1,"w")
>>
>>   MASK = f1->MASK                   ; (lat,lon)
>>   x    = f2->emiss_awb_bc(0,:,:)   ; (lat,lon)   ... 1st time step
>>
>>   x    = (/ where(.not.ismissing(MASK), MASK, x) /)
>>   f2->emiss_awb_bc(0,:,:) = (/ x /)
>>
>>
>> On Mon, Apr 20, 2015 at 4:11 AM, Nitin Patil <nitinpatil85 at gmail.com>
>> wrote:
>>
>>> Dear NCL users,
>>>
>>> I have to netcdf file both are on T63 grid resolution.
>>> file1: agri_india_T63.nc
>>> file2: global_T63.nc
>>>
>>> I have to overlay file1 which is over India only  on file2. This means
>>> the India region from file2 will be replaced by file1 on first time step.
>>>
>>> Anyone has idea ow to do using NCL?
>>>
>>> --
>>> Regards,
>>> Nitin Patil
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150421/5d104287/attachment.html 


More information about the ncl-talk mailing list