<div dir="ltr">Hi Kunal,<div><br></div><div>I think what you want is the land-sea mask that is distributed with NCL. Look at example 5 on the page <a href="http://ncl.ucar.edu/Applications/mask.shtml">http://ncl.ucar.edu/Applications/mask.shtml</a> . The first example, which you were trying to use it seems, expects the file you load to have a variable orography associated with it. This is not the default behavior for netcdf files! Example 5 on the other hand uses the land-sea mask that comes with NCL and you can use that to mask values over the ocean or over land without having to specify your own orography data.</div>
<div><br></div><div><br></div><div>Maria</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 28, 2014 at 8:59 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Kunal,</div><div class="gmail_default" style="font-size:small">
<br></div><div class="gmail_default" style="font-size:small">You need to look at your code more carefully before you send it to ncl talk.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You are reading the same variable twice:</div><div class=""><div class="gmail_default" style="font-size:small">
<br></div><div class="gmail_default" style="font-size:small">
<div style="font-family:arial,sans-serif;font-size:12.8000001907349px"><div>ncl 7> ts = in->TotCH4_A(:,:)<br></div></div><div style="font-family:arial,sans-serif;font-size:12.8000001907349px">ncl 8> oro = in->TotCH4_A(:,:)</div>
</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_default" style="font-size:small">You need to look at your file and determine what the correct name of the "oro" variable is, and use this and not "TotCH4".</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can see a list of all variable names on the file by typing:</div><div class="gmail_default" style="font-size:small">
<br></div><div class="gmail_default" style="font-size:small">print(getfilevarnames(in))</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If it's still not clear which variable to use, then typing:</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">print(in)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">
will give you more idea about the contents of the file.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can also use "ncl_filedump", but you need to run this from the UNIX command line, and not from the "ncl" interactive prompt:</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">ncl_filedump <span style="font-size:12.8000001907349px;color:rgb(80,0,80);font-family:arial,sans-serif">/home/kunal/</span><a href="http://14-01.nc/" style="font-size:12.8000001907349px;font-family:arial,sans-serif" target="_blank">14-01.nc</a></div>
<span class="HOEnZb"><font color="#888888">
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></font></span></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Thu, Aug 28, 2014 at 6:38 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>How to add the valid values in scalar field. I have attached screen-shot of running ncl. please look at that. <br></div><div><div><div><div><br>
ncl 3> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
ncl 4> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl" <br>ncl 5> begin<br></div><div>ncl 6> in = addfile("/home/kunal/<a href="http://14-01.nc" target="_blank">14-01.nc</a>","r")<br>
ncl 7> ts = in->TotCH4_A(:,:)<br></div></div><div>
ncl 8> oro = in->TotCH4_A(:,:)<br>ncl 9> land_only = ts<br>ncl 10> land_only = mask(ts,oro,1)<br>ncl 11> wks = gsn_open_wks("x11","mask")<br>ncl 12> gsn_define_colormap(wks,"BlAqGrYeOrRe")<br>
ncl 13> res = True<br>ncl 14> res@cnFillOn = True<br>ncl 15> res@cnLinesOn = False<br>ncl 16> res@tiMainString = "Land Only"<br>ncl 17> plot = gsn_csm_contour_map_ce(wks,land_only,res)<br>ncl 18> end<br>
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]<br><br></div></div></div></div><div class="gmail_extra"><div><div><br clear="all"><div><div dir="ltr"><div>Kunal Bali<br>
</div><div>Research Scholar <br>
</div><div>Radio & Atmospheric Science Division <br></div><div>CSIR - National Physical Laboratory<br></div><div>New Delhi - 110012<br><br></div><div><br></div><div><br></div><div><br></div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px">
<font color="#1F497D"><br></font></p></div></div></div>
<br><br></div></div><div><div><div class="gmail_quote"><div>On Thu, Aug 28, 2014 at 5:27 PM, Alan Brammer <span dir="ltr"><<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>></span> wrote:<br>
</div><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Dear Kunali, <div> The error tells you exactly what is wrong. </div><div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">ncl 5> oro = in->ORO(:,:)</span><br>
</div></div><div><div><span style="font-family:arial,sans-serif;font-size:13px">fatal:["Execute.c":6321]:</span><span style="font-family:arial,sans-serif;font-size:13px">variable (ORO) is not in file (in)</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">fatal:["Execute.c":8565]:</span><span style="font-family:arial,sans-serif;font-size:13px">Execute: Error occurred at or near line 5</span><br></div><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div><span style="font-family:arial,sans-serif;font-size:13px">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 </span><span style="font-size:13px;font-family:arial,sans-serif">/home/kunal/</span><a href="http://14-01.nc/" style="font-size:13px;font-family:arial,sans-serif" target="_blank">14-01.nc</a> and check the variables in the file. </div>
<div>Or add print(getfilevarnames(in)) to the script after you load the file. </div><div><br></div><div><br></div><div>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)</div>
<div> <span style="color:rgb(0,0,0);font-family:courier;font-size:13.333333969116211px;line-height:16px">; More advanced case mask a at locations where ma0 is not-equal-to 2</span></div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.333333969116211px;line-height:16px;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">
;
out1 = <b style="margin:0px;padding:0px">mask</b>( a, (ma0.ne.2), True)</pre><div><div><span style="font-family:arial,sans-serif;font-size:13px">ncl 6> land_only = ts</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">ncl 7> land_only = mask(ts,oro,1)</span><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div><span style="font-family:arial,sans-serif;font-size:13px">Good Luck, </span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div>Alan Brammer</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Thu, Aug 28, 2014 at 7:41 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div>Hello<br></div>I am trying to use the masking scripts for generating data only on land. but i am getting error. My scripts is given below. <br>
<br>In this i am not getting the means of oro (line -5). <br>
Could any one suggest me to how to correct this scripts or how to visualize the data on land only. <br><br>ncl 0> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>ncl 1> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl" <br>
ncl 2> begin<br>ncl 3> in = addfile("/home/kunal/<a href="http://14-01.nc" target="_blank">14-01.nc</a>","r")<br>ncl 4> ts = in->TotCH4_A(:,:) <br>ncl 5> oro = in->ORO(:,:)<br>ncl 6> land_only = ts<br>
ncl 7> land_only = mask(ts,oro,1)<br>ncl 8> wks = gsn_open_wks("x11","mask")<br>ncl 9> gsn_define_colormap(wks,"BlAqGrYeOrRe")<br>ncl 10> res = True<br>ncl 11> res@cnFillOn = True<br>
ncl 12> res@cnLinesOn = False<br>ncl 13> res@gsnSpreadColors = True<br>ncl 14> res@gsnSpreadColorStart = 10<br>ncl 15> res@gsnSpreadColorEnd = 96 <br>ncl 16> res@cnLevelSpacingF = 3<br>ncl 17> res@lbLabelString = 4<br>
ncl 18> res@tiMainString = "Land Only"<br>ncl 19> plot = gsn_csm_contour_map_ce(wks,land_onl,res)<br>ncl 20> end<br>fatal:["Execute.c":6321]:variable (ORO) is not in file (in)<br>fatal:["Execute.c":8565]:Execute: Error occurred at or near line 5<br>
<br><br></div>Thank You<span><font color="#888888"><br clear="all"><div><div><div><div><div dir="ltr"><div>Kunal Bali<br></div><div>Research Scholar <br></div><div>Radio & Atmospheric Science Division <br>
</div><div>CSIR - National Physical Laboratory<br>
</div><div>New Delhi - 110012<br><br></div><div><br></div><div><br></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div>
</div></div>
</div></div></div></font></span></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div><br></div></div></div>
</div><br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>