[ncl-talk] Can anyone help me on how to read multiple files from OPeNDAP server

Rick Brownrigg brownrig at ucar.edu
Fri Oct 16 07:15:53 MDT 2020


I'm assuming you mean this conditional?

exists = isfilepresent(files)
if(.not.exists) then
...

That's because "files" is an array, so isfilepresent() returns an array of
results. As stated in the error message, NCL requires the conditional
expression to evaluate to a scalar.

In this case, you could do something like:

if (.not.all(exists)) then

However, the original script you sent was a bit muddled as you were trying
to first use addfiles, and then trying to add files individually if
addfiles failed. I don't know what your script looks like now. You probably
want to revisit that logic.

Rick

On Fri, Oct 16, 2020 at 3:21 AM Najib Yusuf <najibgal at yahoo.com> wrote:

>
> Hello Rick,
> Oh yes..Thank you again. After effecting the corrections, the errors
> narrowed down to this:
>
> fatal:Conditional statements (if and do while) require SCALAR logical
> values, see all and any functions.
>
> With this I try changing " If " statement with " where" function but i am
> missing something and still not executing properly.
>
> fatal:syntax error: where is a function not a procedure; return value must
> be referenced.
>
> Kindly help.
>
> Thank you
>
> Najib
>
>
> On Thursday, October 15, 2020, 06:30:54 PM GMT+1, Rick Brownrigg <
> brownrig at ucar.edu> wrote:
>
>
> Hi Najib,
>
> You can explore the opendap site with a browser:
>
> https://opendap.larc.nasa.gov/opendap/MOPITT/MOP03JM.008/contents.html
>
> You'll see that for 2013-04, the day is (oddly) 07 instead of 01. Indeed
> the pattern seems to be day 01, but there are occasionally other days in
> the mix.
>
> Rick
>
>
>
> On Thu, Oct 15, 2020 at 11:05 AM Najib Yusuf <najibgal at yahoo.com> wrote:
>
> Hello Rick,
>
> Thank you Rick. I did print the variables and they return as you pointed
> out, so i corrected the urls to NASA_URL1 = "
> https://opendap.larc.nasa.gov/opendap/MOPITT/MOP03JM.008/2013.01.01/".
> But still i got this error:
>
> syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or
> SCAN_ERROR.
> The specific error message associated with your request was:</p>
> <blockquote> <p><strong>Failed to locate resource:
> /MOPITT/MOP03JM.008/2013.04.01/MOP03JM-201304-L3V95.6.3.he5.dds
> </strong></p> </blockquote>   <p align="left"> If you think that the server
> is broken (that the URL you submitted should have worked), then please
> contact the OPeNDAP user support coordinator at: <a href="mailto:support@
> ......
>
> Could it be permission issue?
>
> Thank you
>
> Najib
>
>
> On Thursday, October 15, 2020, 05:15:57 PM GMT+1, Rick Brownrigg <
> brownrig at ucar.edu> wrote:
>
>
> Hi,
>
> I don't know for certain the issue, but in building up your list of files
> to be read, you use variables constructed like this:
>
> f_1 = NASA_URL1 + NASA_FILP1
>
> both the URL part and the FILP part contain the filename, so that F_1
> would appear to be incorrectly constructed.  Try printing these variables
> to see what's happening.
>
> Hope that helps...
> Rick
>
>
> On Thu, Oct 15, 2020 at 7:40 AM Najib Yusuf via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> Dear NCL experts,
>
> Using an example in ncl web page (see below) I was able to read a file
> from the OPeNDAP server, i tried to read multiple files (12) using similar
> approach by separating the files with comma like (/"
> https://opendap.larc.nasa.gov/opendap/MOPITT/MOP03JM.008/2013.01.01/MOP03JM-201301-L3V95.6.3.he5
> ","
> https://opendap.larc.nasa.gov/opendap/MOPITT/MOP03JM.008/2013.01.02/MOP03JM-201302-L3V95.6.3.he5
> ","
> https://opendap.larc.nasa.gov/opendap/MOPITT/MOP03JM.008/2013.01.03/MOP03JM-201303-L3V95.6.3.he5"/)
> but it didnt work for me though when i test run the files one after the
> other it reads well. Also, I tried "systemfunc" and "wildcards * but is
> like both doesn't work for OPeNDAP. Kindly guide me how to read multiple
> files from OPeNDAP server. I also tried another approach (see attach file)
> but still didnt work. Thank you
>
>
>  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" ; BRH
>
>  begin
>
> ;--- Using the data files from url
>  NASA_URL  = "
> https://opendap.larc.nasa.gov/opendap/MOPITT/MOP03JM.008/2013.12.01/MOP03JM-201312-L3V95.6.3.he5
> "
>
> ;    f = addfile(NASA_URL,"r")
>   exists = isfilepresent(NASA_URL)
>   if(.not.exists) then
>     print("OPeNDAP test unsuccessful.")
>     print("Either the file doesn't exist, or NCL does")
>     print("not have OPeNDAP cabilities on this system.")
>   else
>     f = addfile(NASA_URL,"r")
>     vnames = getfilevarnames(f)
>     print(vnames)
>   end if
> end
>
> Thank you for you help.
>
> Najib Yusuf Galadanci
> CAR-NASRDA. Nigeria
> 234 80 3871 4158
> ________________________
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201016/542cb982/attachment.html>


More information about the ncl-talk mailing list