<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Soma,<br>
    <br>
    please, reply always to ncl-talk that everybody is able to follow. <br>
    <br>
    The problem is, that you changed the name of the level dimension to
    lev. ZMT has the dimension name level. Change lev to level and it
    should work or<br>
    <br>
    ZMT!1    = "lev"<br>
    ZMT&lev = lev<br>
    <br>
    -Karin<br>
    <br>
    <div class="moz-cite-prefix">Am 17.07.18 um 14:06 schrieb Soma Roy:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAJRSQew5NAxXzHj_vmog8UYu_Z1KviB3mOET-EfEUfgimYh3Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="auto">In the directory there is no file named as <a
          href="http://example.nc" target="_blank" rel="noreferrer"
          moz-do-not-send="true">example.nc</a>.
        <div dir="auto">It is created at the run time.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Now I am getting the following error massage;</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">
          <div style="font-family:sans-serif;font-size:12.8px"
            dir="auto">FileAddVar, in file: NclFile.c, line: 412</div>
          <div style="font-family:sans-serif;font-size:12.8px"
            dir="auto">fatal:FileAddVar: Dimension (level) is not
            currently defined, can't add variable</div>
          <div style="font-family:sans-serif;font-size:12.8px"
            dir="auto">fatal:["Execute.c":8640]:Execute: Error occurred
            at or near line 77 in file TEST1.ncl</div>
          <br>
        </div>
        <div dir="auto">Kindly inform me what I am doing wrong in this. </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Thanking you,</div>
        <div dir="auto">Soma</div>
        <div dir="auto"><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Tue, Jul 17, 2018, 16:31 Karin Meier-Fleischer
          <<a href="mailto:meier-fleischer@dkrz.de" target="_blank"
            rel="noreferrer" moz-do-not-send="true">meier-fleischer@dkrz.de</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div text="#000000" bgcolor="#FFFFFF"> Hi Soma,<br>
            <br>
            if the file <a href="http://example.nc" rel="noreferrer
              noreferrer" target="_blank" moz-do-not-send="true">example.nc</a>
            already exists NCL can't create a new one with the same
            name. You have to remove the file, first.<br>
            <br>
            <font color="#3333ff"><tt>    filo = "<a
                  href="http://example.nc" rel="noreferrer noreferrer"
                  target="_blank" moz-do-not-send="true">example.nc</a>"                   
                ; Output file</tt><tt><br>
              </tt><b><tt>    system("rm -rf "+filo)</tt></b><tt><br>
              </tt><tt>    fout  = addfile (filo, "c")            ; open
                output file</tt><tt><br>
              </tt></font><br>
            -Karin<br>
            <br>
            <div
              class="m_8295191540575769387m_-7654072512693969903moz-cite-prefix">Am
              17.07.18 um 12:22 schrieb Soma Roy:<br>
            </div>
            <blockquote type="cite">
              <div dir="auto">
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">I am trying to save the variable ZMT in
                  NetCDF file following the instructions at the
                  below-mentioned link;</div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><a
                    href="http://www.ncl.ucar.edu/Applications/method_2.shtml"
style="text-decoration-line:none;color:rgb(66,133,244)" rel="noreferrer
                    noreferrer" target="_blank" moz-do-not-send="true">http://www.ncl.ucar.edu/Applications/method_2.shtml</a><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">Summary of the dataset is as follows;</div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">
                  <div>Variable: <span
                      style="background-color:rgb(243,243,243)"><font
                        color="#ff0000">lat</font></span></div>
                  <div>Type: float</div>
                  <div>Total Size: 244 bytes</div>
                  <div>            61 values</div>
                  <div>Number of Dimensions: 1</div>
                  <div>Dimensions and sizes:   [latitude | 61]</div>
                  <div>Coordinates:</div>
                  <div>            latitude: [ 5..20]</div>
                  <div>Number Of Attributes: 2</div>
                  <div>  units :       degrees_north</div>
                  <div>  long_name :   latitude</div>
                  <div><br>
                  </div>
                  <div>Variable: <font color="#ff0000">lon</font></div>
                  <div>Type: float</div>
                  <div>Total Size: 324 bytes</div>
                  <div>            81 values</div>
                  <div>Number of Dimensions: 1</div>
                  <div>Dimensions and sizes:   [longitude | 81]</div>
                  <div>Coordinates:</div>
                  <div>            longitude: [70..90]</div>
                  <div>Number Of Attributes: 2</div>
                  <div>  units :       degrees_east</div>
                  <div>  long_name :   longitude</div>
                  <div><br>
                  </div>
                  <div>Variable: <font color="#ff0000">time</font></div>
                  <div>Type: integer</div>
                  <div>Total Size: 16 bytes</div>
                  <div>            4 values</div>
                  <div>Number of Dimensions: 1</div>
                  <div>Dimensions and sizes:   [time | 4]</div>
                  <div>Coordinates:</div>
                  <div>            time: [1025088..1025160]</div>
                  <div>Number Of Attributes: 3</div>
                  <div>  units :       hours since 1900-01-01 00:00:0.0</div>
                  <div>  long_name :   time</div>
                  <div>  calendar :    gregorian</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  <div>Variable: <font color="#ff0000">pnew</font></div>
                  <div>Type: integer</div>
                  <div>Total Size: 112 bytes</div>
                  <div>            28 values</div>
                  <div>Number of Dimensions: 1</div>
                  <div>Dimensions and sizes:   [level | 28]</div>
                  <div>Coordinates:</div>
                  <div>            level: [70..1000]</div>
                  <div>Number Of Attributes: 2</div>
                  <div>  units :       Pa</div>
                  <div>  long_name :   pressure_level</div>
                  <div>(0)     7000</div>
                  <div>(1)     10000</div>
                  <div>(2)     12500</div>
                  <div>(3)     15000</div>
                  <div>..........</div>
                  <div>(26)    97500</div>
                  <div>(27)    100000</div>
                  <div><br>
                  </div>
                  <div>Variable: <font color="#ff0000">ZMT</font></div>
                  <div>Type: float</div>
                  <div>Total Size: 2213568 bytes</div>
                  <div>            553392 values</div>
                  <div>Number of Dimensions: 4</div>
                  <div>Dimensions and sizes:   [time | 4] x [level | 28]
                    x [latitude | 61] x [longitude | 81]</div>
                  <div>Coordinates:</div>
                  <div>            time: [1025088..1025160]</div>
                  <div>            level: [70..1000]</div>
                  <div>            latitude: [ 5..20]</div>
                  <div>            longitude: [70..90]</div>
                  <div>Number Of Attributes: 3</div>
                  <div>  units :       (m/s)(kg/kg)</div>
                  <div>  long_name :   zonal moisture transport</div>
                  <div>  _FillValue :  -32767</div>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">At run-time, I am getting the following
                  error message;</div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">
                  <div>fatal:Could not create (<a
                      href="http://example.nc/"
                      style="text-decoration-line:none;color:rgb(66,133,244)"
                      rel="noreferrer noreferrer" target="_blank"
                      moz-do-not-send="true">example.nc</a>)</div>
                  <div>warning:FileSetFileOption: invalid file or format</div>
                  <div>fatal:["Execute.c":8640]:Execute: Error occurred
                    at or near line 65 in file TEST1.ncl</div>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">My script is attached below. </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">Please kindly inform me what is wrong with
                  this code and how to fix it.</div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto"><br>
                </div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">Thanking you,</div>
                <div style="font-family:sans-serif;font-size:12.8px"
                  dir="auto">Soma</div>
              </div>
              <br>
              <fieldset
                class="m_8295191540575769387m_-7654072512693969903mimeAttachmentHeader"></fieldset>
              <br>
              <pre>_______________________________________________
ncl-talk mailing list
<a class="m_8295191540575769387m_-7654072512693969903moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu" rel="noreferrer noreferrer" target="_blank" moz-do-not-send="true">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a class="m_8295191540575769387m_-7654072512693969903moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer noreferrer" target="_blank" moz-do-not-send="true">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
            </blockquote>
            <br>
          </div>
          _______________________________________________<br>
          ncl-talk mailing list<br>
          <a href="mailto:ncl-talk@ucar.edu" rel="noreferrer noreferrer"
            target="_blank" moz-do-not-send="true">ncl-talk@ucar.edu</a><br>
          List instructions, subscriber options, unsubscribe:<br>
          <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk"
            rel="noreferrer noreferrer noreferrer" target="_blank"
            moz-do-not-send="true">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>