[ncl-talk] Fwd: Query
Mary Haley
haley at ucar.edu
Thu Aug 28 08:59:03 MDT 2014
Kunal,
You need to look at your code more carefully before you send it to ncl talk.
You are reading the same variable twice:
ncl 7> ts = in->TotCH4_A(:,:)
ncl 8> oro = in->TotCH4_A(:,:)
You need to look at your file and determine what the correct name of the
"oro" variable is, and use this and not "TotCH4".
You can see a list of all variable names on the file by typing:
print(getfilevarnames(in))
If it's still not clear which variable to use, then typing:
print(in)
will give you more idea about the contents of the file.
You can also use "ncl_filedump", but you need to run this from the UNIX
command line, and not from the "ncl" interactive prompt:
ncl_filedump /home/kunal/14-01.nc
--Mary
On Thu, Aug 28, 2014 at 6:38 AM, Kunal Bali <kunal.bali9 at gmail.com> wrote:
> How to add the valid values in scalar field. I have attached screen-shot
> of running ncl. please look at that.
>
> ncl 3> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ncl 4> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ncl 5> begin
> ncl 6> in = addfile("/home/kunal/14-01.nc","r")
> ncl 7> ts = in->TotCH4_A(:,:)
> ncl 8> oro = in->TotCH4_A(:,:)
> ncl 9> land_only = ts
> ncl 10> land_only = mask(ts,oro,1)
> ncl 11> wks = gsn_open_wks("x11","mask")
> ncl 12> gsn_define_colormap(wks,"BlAqGrYeOrRe")
> ncl 13> res = True
> ncl 14> res at cnFillOn = True
> ncl 15> res at cnLinesOn = False
> ncl 16> res at tiMainString = "Land Only"
> ncl 17> plot = gsn_csm_contour_map_ce(wks,land_only,res)
> ncl 18> end
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
>
>
> Kunal Bali
> Research Scholar
> Radio & Atmospheric Science Division
> CSIR - National Physical Laboratory
> New Delhi - 110012
>
>
>
>
>
>
>
> On Thu, Aug 28, 2014 at 5:27 PM, Alan Brammer <abrammer at albany.edu> wrote:
>
>> Dear Kunali,
>> The error tells you exactly what is wrong.
>>
>> ncl 5> oro = in->ORO(:,:)
>> fatal:["Execute.c":6321]:variable (ORO) is not in file (in)
>> fatal:["Execute.c":8565]:Execute: Error occurred at or near line 5
>>
>> You're trying to load a variable ORO from the file, but a variable by
>> that name does not exist in the file. I'd recommend running ncl_filedump
>> /home/kunal/14-01.nc and check the variables in the file.
>> Or add print(getfilevarnames(in)) to the script after you load the file.
>>
>>
>> Once past that error, as long as oro is equal to 1 over the ocean then
>> you're good. Otherwise you may want an adjustment on this example from the
>> ncl webpage for (oro.le.0)
>> ; More advanced case mask a at locations where ma0 is not-equal-to 2
>>
>>
>> ;
>> out1 = *mask*( a, (ma0.ne.2), True)
>>
>> ncl 6> land_only = ts
>> ncl 7> land_only = mask(ts,oro,1)
>>
>>
>>
>> Good Luck,
>>
>> Alan Brammer
>>
>>
>> On Thu, Aug 28, 2014 at 7:41 AM, Kunal Bali <kunal.bali9 at gmail.com>
>> wrote:
>>
>>> Hello
>>> I am trying to use the masking scripts for generating data only on land.
>>> but i am getting error. My scripts is given below.
>>>
>>> In this i am not getting the means of oro (line -5).
>>> Could any one suggest me to how to correct this scripts or how to
>>> visualize the data on land only.
>>>
>>> ncl 0> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> ncl 1> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> ncl 2> begin
>>> ncl 3> in = addfile("/home/kunal/14-01.nc","r")
>>> ncl 4> ts = in->TotCH4_A(:,:)
>>> ncl 5> oro = in->ORO(:,:)
>>> ncl 6> land_only = ts
>>> ncl 7> land_only = mask(ts,oro,1)
>>> ncl 8> wks = gsn_open_wks("x11","mask")
>>> ncl 9> gsn_define_colormap(wks,"BlAqGrYeOrRe")
>>> ncl 10> res = True
>>> ncl 11> res at cnFillOn = True
>>> ncl 12> res at cnLinesOn = False
>>> ncl 13> res at gsnSpreadColors = True
>>> ncl 14> res at gsnSpreadColorStart = 10
>>> ncl 15> res at gsnSpreadColorEnd = 96
>>> ncl 16> res at cnLevelSpacingF = 3
>>> ncl 17> res at lbLabelString = 4
>>> ncl 18> res at tiMainString = "Land Only"
>>> ncl 19> plot = gsn_csm_contour_map_ce(wks,land_onl,res)
>>> ncl 20> end
>>> fatal:["Execute.c":6321]:variable (ORO) is not in file (in)
>>> fatal:["Execute.c":8565]:Execute: Error occurred at or near line 5
>>>
>>>
>>> Thank You
>>> Kunal Bali
>>> Research Scholar
>>> Radio & Atmospheric Science Division
>>> CSIR - National Physical Laboratory
>>> New Delhi - 110012
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> 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/20140828/98f122ed/attachment.html
More information about the ncl-talk
mailing list