<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Hi Adam,</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I followed your advice and used the ncatted operator separately on the terminal - and it worked, The model runs fine now. Thanks a lot for your help.</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">As a record, for others, I used the following command:</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">ncatted -O -h -a MMINLU,global,o,c,"MODIFIED_IGBP_MODIS_NOAH" wrfrst_d03_2020-03-13_00:00:00 newwrfrst_d03_2020-03-13_00:00:00</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Cheers,</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Tabish</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">Tabish U Ansari<br></font></span></i></span></div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">Postdoctoral Researcher <br></font></span></i></span></div><div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">Centre for Climate and Air Pollution Studies (C-CAPS)<br></font></span></i></span></div><div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">School of Physics, NUI-Galway</font></span></i><font size="1"><span style="font-family:tahoma,sans-serif"><i><span style="font-family:verdana,sans-serif">, Ireland</span></i><br></span></font></span></div><div><span style="color:rgb(11,83,148)"><font size="1"><span style="font-family:tahoma,sans-serif"><i><span style="font-family:verdana,sans-serif"><a href="https://www.researchgate.net/profile/Tabish_Ansari" target="_blank">ResearchGate</a> | <a href="https://scholar.google.com/citations?user=E94r-mwAAAAJ&hl=en&oi=ao" target="_blank">Google Scholar</a> | <a href="https://twitter.com/tabishbiet" target="_blank">Twitter</a> | <a href="https://github.com/tabishumaransari/NCL-scripts" target="_blank">Github</a></span></i><br></span></font></span></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 26 Aug 2020 at 17:41, Adam Phillips <<a href="mailto:asphilli@ucar.edu">asphilli@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Tabish,<div>I would use the NetCDF operator ncatted to edit the file. Here's a NCL code snippet where I used ncatted to edit all files in a specified directory, but you can use whatever language you want to call ncatted:</div><div>; I modified the following to alter your MMINLU global history attribute</div><div><br></div><div>  dir = "/project/data/sim1/sic/"   ; directory holding files needing modification</div><div>  fils = systemfunc("ls "+dir)<br>  do gg = 0,dimsizes(fils)-1<br>     system("ncatted  -O -a MMINLU,global,o,c,'attribute text goes here'  "+dir+fils(gg))<br>  end do<br></div><div><br></div><div><a href="http://nco.sourceforge.net/nco.html#ncatted-netCDF-Attribute-Editor" target="_blank">http://nco.sourceforge.net/nco.html#ncatted-netCDF-Attribute-Editor</a><br></div><div><br></div><div>As I used the above coding for my own files, I strongly suggest you test altering a duplicate file before altering the real files. </div><div>Hope that helps!</div><div>Adam</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 26, 2020 at 10:19 AM Tabish Ansari via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Hi</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">I need to make a small amendment in a global attribute of a WRF-related netCDF file. This is a model "restart" file which stores crucial information about the model setup and tells the model what datasets to pick-up. For some reason, the latest WRF version has made a minor mistake in writing the global attributes and this is causing errors, which I think could be solved simply by editing one of the global attributes. I know of NCL functions which copy entire metadata from one nc file to another but Is there a way in NCL to edit these particular fields?</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Here's what it looks like and I need to edit the line shown in red towards the end:</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">// global attributes:<br>              :TITLE = " OUTPUT FROM *             PROGRAM:WRF-Chem V4.1.3 MODEL" ;<br>         :START_DATE = "2020-02-29_00:00:00" ;<br>               :SIMULATION_START_DATE = "2020-02-29_00:00:00" ;<br>            :FLAG_RESTART = 1 ;<br>           :MAX_WRF_ALARMS = 55 ;<br>                :WRF_ALARM_ISRINGING_01 = 1 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_01 = 3600 ;<br>             :WRF_ALARM_ISRINGING_02 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_02 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_03 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_03 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_04 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_04 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_05 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_05 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_06 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_06 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_07 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_07 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_08 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_08 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_09 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_09 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_10 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_10 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_11 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_11 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_12 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_12 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_13 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_13 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_14 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_14 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_15 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_15 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_16 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_16 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_17 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_17 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_18 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_18 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_19 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_19 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_20 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_20 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_21 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_21 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_22 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_22 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_23 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_23 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_24 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_24 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_25 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_25 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_27 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_27 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_28 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_28 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_29 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_29 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_30 = 1 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_30 = 21600 ;<br>            :WRF_ALARM_ISRINGING_31 = 1 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_31 = 3600 ;<br>             :WRF_ALARM_ISRINGING_32 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_32 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_33 = 1 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_33 = 3600 ;<br>             :WRF_ALARM_ISRINGING_34 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_34 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_35 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_35 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_36 = 1 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_36 = 21600 ;<br>            :WRF_ALARM_ISRINGING_37 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_37 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_38 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_38 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_39 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_39 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_40 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_40 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_41 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_41 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_42 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_42 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_43 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_43 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_44 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_44 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_45 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_45 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_46 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_46 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_47 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_47 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_48 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_48 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_49 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_49 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_50 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_50 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_51 = 1 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_51 = 86400 ;<br>            :WRF_ALARM_ISRINGING_53 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_53 = 1700000000 ;<br>               :WRF_ALARM_ISRINGING_55 = 0 ;<br>         :WRF_ALARM_SECS_TIL_NEXT_RING_55 = -1123200 ;<br>         :WEST-EAST_GRID_DIMENSION = 100 ;<br>             :SOUTH-NORTH_GRID_DIMENSION = 100 ;<br>           :BOTTOM-TOP_GRID_DIMENSION = 41 ;<br>             :DX = 1000.f ;<br>                :DY = 1000.f ;<br>                :AERCU_OPT = 0 ;<br>              :AERCU_FCT = 1.f ;<br>            :IDEAL_CASE = 0 ;<br>             :DIFF_6TH_SLOPEOPT = 0 ;<br>              :AUTO_LEVELS_OPT = 2 ;<br>                :DIFF_6TH_THRESH = 0.1f ;<br>             :DZBOT = 50.f ;<br>               :DZSTRETCH_S = 1.3f ;<br>         :DZSTRETCH_U = 1.1f ;<br>         :GRIDTYPE = "C" ;<br>           :DIFF_OPT = 1 ;<br>               :KM_OPT = 4 ;<br>         :DAMP_OPT = 3 ;<br>               :DAMPCOEF = 0.2f ;<br>            :KHDIF = 0.f ;<br>                :KVDIF = 0.f ;<br>                :MP_PHYSICS = 10 ;<br>            :RA_LW_PHYSICS = 4 ;<br>          :RA_SW_PHYSICS = 4 ;<br>          :SF_SFCLAY_PHYSICS = 2 ;<br>              :SF_SURFACE_PHYSICS = 2 ;<br>             :BL_PBL_PHYSICS = 2 ;<br>         :CU_PHYSICS = 0 ;<br>             :SF_LAKE_PHYSICS = 0 ;<br>                :SURFACE_INPUT_SOURCE = 1 ;<br>           :SST_UPDATE = 1 ;<br>             :GRID_FDDA = 1 ;<br>              :GFDDA_INTERVAL_M = 360 ;<br>             :GFDDA_END_H = 2400 ;<br>         :GRID_SFDDA = 0 ;<br>             :SGFDDA_INTERVAL_M = 0 ;<br>              :SGFDDA_END_H = 0 ;<br>           :HYPSOMETRIC_OPT = 2 ;<br>                :USE_THETA_M = 1 ;<br>            :GWD_OPT = 0 ;<br>                :SF_URBAN_PHYSICS = 2 ;<br>               :SF_SURFACE_MOSAIC = 0 ;<br>              :SF_OCEAN_PHYSICS = 0 ;<br>               :SIMULATION_INITIALIZATION_TYPE = "REAL-DATA CASE" ;<br>                :WEST-EAST_PATCH_START_UNSTAG = 1 ;<br>           :WEST-EAST_PATCH_END_UNSTAG = 99 ;<br>            :WEST-EAST_PATCH_START_STAG = 1 ;<br>             :WEST-EAST_PATCH_END_STAG = 100 ;<br>             :SOUTH-NORTH_PATCH_START_UNSTAG = 1 ;<br>         :SOUTH-NORTH_PATCH_END_UNSTAG = 99 ;<br>          :SOUTH-NORTH_PATCH_START_STAG = 1 ;<br>           :SOUTH-NORTH_PATCH_END_STAG = 100 ;<br>           :BOTTOM-TOP_PATCH_START_UNSTAG = 1 ;<br>          :BOTTOM-TOP_PATCH_END_UNSTAG = 40 ;<br>           :BOTTOM-TOP_PATCH_START_STAG = 1 ;<br>            :BOTTOM-TOP_PATCH_END_STAG = 41 ;<br>             :GRID_ID = 3 ;<br>                :PARENT_ID = 2 ;<br>              :I_PARENT_START = 85 ;<br>                :J_PARENT_START = 58 ;<br>                :PARENT_GRID_RATIO = 3 ;<br>              :DT = 5.f ;<br>           :CEN_LAT = 53.37321f ;<br>                :CEN_LON = -6.254578f ;<br>               :TRUELAT1 = 53.3498f ;<br>                :TRUELAT2 = 53.3498f ;<br>                :MOAD_CEN_LAT = 54.5f ;<br>               :STAND_LON = -6.2603f ;<br>               :POLE_LAT = 90.f ;<br>            :POLE_LON = 0.f ;<br>             :GMT = 0.f ;<br>          :JULYR = 2016 ;<br>               :JULDAY = 320 ;<br>               :MAP_PROJ = 1 ;<br>               :MAP_PROJ_CHAR = "Lambert Conformal" ;<br>              <span style="color:rgb(255,0,0)">:MMINLU = "" ;</span><br>                :NUM_LAND_CAT = 21 ;<br>          :ISWATER = 16 ;<br>               :ISLAKE = -1 ;<br>                :ISICE = 24 ;<br>         :ISURBAN = 1 ;<br>                :ISOILWATER = 14 ;<br>            :HYBRID_OPT = 2 ;<br>             :ETAC = 0.2f ;<br>  <br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Any help would be much appreciated.</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">best regards,</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Tabish<br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">Tabish U Ansari<br></font></span></i></span></div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">Postdoctoral Researcher <br></font></span></i></span></div><div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">Centre for Climate and Air Pollution Studies (C-CAPS)<br></font></span></i></span></div><div><span style="color:rgb(11,83,148)"><i><span style="font-family:verdana,sans-serif"><font size="1">School of Physics, NUI-Galway</font></span></i><font size="1"><span style="font-family:tahoma,sans-serif"><i><span style="font-family:verdana,sans-serif">, Ireland</span></i><br></span></font></span></div><div><span style="color:rgb(11,83,148)"><font size="1"><span style="font-family:tahoma,sans-serif"><i><span style="font-family:verdana,sans-serif"><a href="https://www.researchgate.net/profile/Tabish_Ansari" target="_blank">ResearchGate</a> | <a href="https://scholar.google.com/citations?user=E94r-mwAAAAJ&hl=en&oi=ao" target="_blank">Google Scholar</a> | <a href="https://twitter.com/tabishbiet" target="_blank">Twitter</a> | <a href="https://github.com/tabishumaransari/NCL-scripts" target="_blank">Github</a></span></i><br></span></font></span></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>