<div dir="ltr"><div>Hi, <br></div><div><br></div><div>I was able to open a NetCDF4 file, modify the values of a variable, and write it back out. I'm using NCL 6.5.0.  Are you using an older version of NCL?</div><div><br></div><div>Rick<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 18, 2018 at 12:17 PM Yoo, Jinwoong (GSFC-6170)[UNIVERSITY OF MARYLAND] <<a href="mailto:jinwoong.yoo@nasa.gov">jinwoong.yoo@nasa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_-8875902466024239111WordSection1">
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222;background:white">Hi,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">I am trying to replace every missing value in a netcdf4 file to 1 using NCL.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">Unlike netCDF files,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">the method available at<span class="m_-8875902466024239111apple-converted-space"> </span><a href="https://www.ncl.ucar.edu/Applications/change_netCDF.shtml" target="_blank"><span style="color:#1155cc">https://www.ncl.ucar.edu/Applications/change_netCDF.shtml</span></a> does
 not work.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">I also tried the Dave's solution to "Editing a netcdf4 file" from the nil-talk in 2015 (<a href="http://mailman.ucar.edu/pipermail/ncl-talk/2015-June/003046.html" target="_blank"><span style="color:#1155cc">http://mailman.ucar.edu/pipermail/ncl-talk/2015-June/003046.html</span></a>)
 but it did not work either.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">I still get the same error message as they had:<u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:13.0pt;font-family:Menlo;color:black">fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in nc_def_var_chunking in file (<a href="http://Nomissing_LIS_HIST_201702081800.d01.nc" target="_blank"><span style="color:#1155cc">Nomissing_LIS_HIST_201702081800.d01.nc</span></a>)
 for writing, at line: 3073<u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal;min-height:20px">
<span style="font-size:13.0pt;font-family:Menlo;color:black"><u></u> <u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:13.0pt;font-family:Menlo;color:black">line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties, like deflate, after enddef.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">My code looks like this:<u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:13.0pt;font-family:Menlo;color:black">  </span><span style="font-size:7.5pt;font-family:Menlo;color:black">a     = addfile("<a href="http://Nomissing_LIS_HIST_201702081800.d01.nc" target="_blank"><span style="color:#1155cc">Nomissing_LIS_HIST_201702081800.d01.nc</span></a>","w")</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black">; Read in soil moisture</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black">  x  = a->SoilMoist_inst;</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black">  x_mod = new((/1,4,1200,1200/),"float","No_FillValue")</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal;min-height:20px">
<span style="font-family:Menlo;color:black"><u></u> <u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black">  x = where(ismissing(x), 1, x)</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black">  x_mod = x</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black">  a->SoilMoist_inst=(/x_mod/)</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-stretch:normal"><span style="font-size:7.5pt;font-family:Menlo;color:black"><br>
<br>
</span><span style="font-family:Menlo;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">I wonder if this error has been fixed yet?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">Thank you very much.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="font-stretch:normal"><span style="font-family:"Arial",sans-serif;color:#222222">Jinwoong Yoo<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
</div>
</div>

_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>