[ncl-talk] problem with adding file

Mary Haley haley at ucar.edu
Wed Aug 30 09:23:32 MDT 2017


When you say you are able to read the file with Matlab, are you running
Matlab from the same system that you are running NCL from, and are you
pointing at the *exact same file in the same directory* as Matlab?

The reason I ask is because it looks like there's an issue with the file,
and not with NCL. Maybe something happened to the file if you transferred
it to another system.

I just downloaded the precip.mon.total.v
​6​
​.nc file using the URL that Dennis provided, and modified your "spi.ncl"
script to use this instead of the v6 file.  I then loaded NCL 6.3.0 on my
system and ran your script. Please see the resultant spi.ps file, which
looks good to me.

Also, when you ran the "ncdump" command that Krishnamoorthy
​ ​
recommended
​, was this also on the exact same file in the same directory?  It's highly
unlikely that NCL would have trouble with a standard NetCDF file, so that's
we are trying to determine why these other tools seem to work on it, but
not NCL.

As a final test, please type all of the following commands and email them
back to ncl-talk at ucar.edu:

ls -l precip.mon.total.v6.nc
file ls -l precip.mon.total.v6.nc
ncdump -k precip.mon.total.v6.nc

Here's what my system reports when I type these commands.

% ls -l precip.mon.total.v6.nc
-rw-r--r--@ 1 haley  CIT\Domain Users  1368593392 Aug 30 09:15
precip.mon.total.v6.nc
% file precip.mon.total.v6.nc
precip.mon.total.v6.nc: NetCDF Data Format data

% ncdump -k precip.mon.total.v6.nc
classic

I need to see what your system reports on these same commands.

I guess one possibility is that you have an NCL that is just not working on
your system for some reason. This could happen if there's incompatibility
between the binary you downloaded, and the system you are running on.

To make sure that your version of NCL works with NetCDF files on your
system, please type the following from the UNIX command line:

ng4ex cn05n -W x11 -clean

This should run an NCL script called "cn05n.ncl", which reads a NetCDF file
that's included with the NCL distribution.  It will pop up an X11 window
with a filled contour plot.  Click on this window with your left mouse
button three times, and you will see two other similar plots, and then NCL
will exit.

--Mary
​

On Wed, Aug 30, 2017 at 8:45 AM, Setareh Rahimi <setareh.rahimi at gmail.com>
wrote:

> So what is the problem? , I do know there is no problem whit the file.
>
> May I ask you please run the script and check if that works correctly?
>
> Regards,
>
> On Wed, Aug 30, 2017 at 5:59 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>> I have both v6 and v7 from:
>>   https://www.esrl.noaa.gov/psd/data/gridded/data.gpcc.html
>>
>> %> cd DATA/PRECIP/GPCC
>> %> ls -l  precip.mon.total.v[6-7].nc
>>
>> -rw-r--r-- 1 shea cgdcas 1368593336  2014 precip.mon.total.v6.nc
>> -rw-r--r-- 1 shea cgdcas  348532141   2017 precip.mon.total.v7.nc
>>
>> See the above URL for descriptions.
>> ===
>>
>> %> ncl_filedump precip.mon.total.v6.nc
>>
>> and
>>
>> %> ncl_filedump precip.mon.total.v7.nc
>>
>> both work fine.
>>
>> ====
>> I thought that you have a permissions problem.
>> However, if Matlab reads the file and NCL does not then that is not the
>> case.
>>
>>
>>
>> On Wed, Aug 30, 2017 at 3:29 AM, Setareh Rahimi <setareh.rahimi at gmail.com
>> > wrote:
>>
>>> It dose exist as precip, I also checked this in Matlab and foud out it
>>> is as precip( see attached files please), I have done with this file some
>>> plots before, it worked about a few months ago, but wonder what happened
>>> currently?!!!!
>>>
>>> Thank you
>>>
>>> On Wed, Aug 30, 2017 at 1:18 PM, Krishnamoorthy Chandramouli <
>>> chandrakrishna.90 at gmail.com> wrote:
>>>
>>>> Try checking if the variable actually exist as precip in the nc file
>>>> ncdump -v precip [your-nc-file]
>>>>
>>>> Also if possible share the file, so that someone will try and help.
>>>>
>>>>
>>>> *Regards,*
>>>> *Krishnamoorthy Chandramouli*
>>>>
>>>> On Wed, Aug 30, 2017 at 3:39 PM, Setareh Rahimi <
>>>> setareh.rahimi at gmail.com> wrote:
>>>>
>>>>> Dear all,
>>>>>
>>>>> Please have a look at the attached file, which is a screenshot of
>>>>> ncl_filedump command .
>>>>>
>>>>> what is your idea?
>>>>>
>>>>> Best wishes,
>>>>>
>>>>> On Wed, Aug 30, 2017 at 2:24 AM, Mary Haley <haley at ucar.edu> wrote:
>>>>>
>>>>>> As another test, please see if you can look at the file using
>>>>>> "ncl_filedump" from the UNIX command  line. But, first make sure you have
>>>>>> the file correctly spelled:
>>>>>>
>>>>>> ls precip.mon.total.v6.nc
>>>>>>
>>>>>> then:
>>>>>>
>>>>>> ncl_filedump precip.mon.total.v6.nc
>>>>>>
>>>>>> ​This is the same thing as the 2-line script that Dennis asked you to
>>>>>> try. If this works, then you can also verify at the same time if "precip"
>>>>>> is a variable in that file.
>>>>>>
>>>>>> If you get any errors from the ncl_filedump command, respond back to
>>>>>> ncl-talk with all of the error messages included.
>>>>>>
>>>>>> --Mary
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Aug 29, 2017 at 11:45 AM, Dennis Shea <shea at ucar.edu> wrote:
>>>>>>
>>>>>>> Hello ... Please respond to ncl-talk and not directly to me.
>>>>>>>
>>>>>>> Your script has:
>>>>>>>
>>>>>>>     *f *     = addfile("precip.mon.total.v6.nc","r")
>>>>>>>     prc    =* f*->precip({tStrt:tLast},:,:)         ; whole grid
>>>>>>>
>>>>>>> The error message is:
>>>>>>>
>>>>>>> fatal: file (*f*) isn't defined
>>>>>>>
>>>>>>> I am not sure what the problem would be. Someone else will have to
>>>>>>> respond.
>>>>>>>
>>>>>>> ---
>>>>>>> What does the following yoeld? Likely the same error.
>>>>>>>
>>>>>>>   *f *     = addfile("precip.mon.total.v6.nc","r")
>>>>>>>   print(*f*)
>>>>>>>
>>>>>>> =====================================================
>>>>>>> NOTE:
>>>>>>> You do *not* have to load the following libraries from NCL 6.2.0
>>>>>>> onward. So for 6.3.0, they are *automatically loaded.*
>>>>>>>
>>>>>>> load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>>>> load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>>>> load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>>>>
>>>>>>> From 6.4.0, the following are automatically loaded:
>>>>>>>
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/csm/bootstrap.ncl"
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/csm/extval.ncl"
>>>>>>>     "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Aug 29, 2017 at 9:27 AM, Setareh Rahimi <
>>>>>>> setareh.rahimi at gmail.com> wrote:
>>>>>>>
>>>>>>>> dear Dennis,
>>>>>>>>
>>>>>>>> Thank you for your advice, but  both data file and script are in
>>>>>>>> the same directory.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> On Tue 29 Aug 2017 at 19:12, Dennis Shea <shea at ucar.edu> wrote:
>>>>>>>>
>>>>>>>>> By default, NCL always looks in the 'current directory'.
>>>>>>>>> My guess is that the data file is not in the same directory as the
>>>>>>>>> NCL script.
>>>>>>>>>
>>>>>>>>> dirp = "/some/path/to/file/"
>>>>>>>>> filp   = "precip.mon.total.v6.nc"
>>>>>>>>>
>>>>>>>>> pthp = dirp + filp
>>>>>>>>> f       = addfile(pthp, "r")
>>>>>>>>>
>>>>>>>>> or
>>>>>>>>>
>>>>>>>>> f = addfile(dirp + filp, "r")
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Aug 29, 2017 at 8:26 AM, Setareh Rahimi <
>>>>>>>>> setareh.rahimi at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Dear all,
>>>>>>>>>>
>>>>>>>>>> Once I put my NCL command line in NCL environment, it returns me
>>>>>>>>>> an error.
>>>>>>>>>>
>>>>>>>>>>  Please have a look at the attached files, which contain a
>>>>>>>>>> screenshot of the error and my script.
>>>>>>>>>>
>>>>>>>>>> Please help me as soon as possible.
>>>>>>>>>>
>>>>>>>>>> Best wishes,
>>>>>>>>>> --
>>>>>>>>>> S.Rahimi
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>> S.Rahimi
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> ncl-talk mailing list
>>>>>>> ncl-talk at ucar.edu
>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> S.Rahimi
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> S.Rahimi
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> S.Rahimi
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20170830/f36031c0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spi.ps
Type: application/postscript
Size: 502011 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170830/f36031c0/attachment-0001.ps>


More information about the ncl-talk mailing list