[ncl-talk] Serious bug in the taper (and taper_n) function with option 1

Sakaguchi, Koichi Koichi.Sakaguchi at pnnl.gov
Mon Aug 23 13:03:06 MDT 2021


Hi Dennis,

Thank you for the background information. That’s a long history behind this function.

The attached is a simple ncl script to reproduce my error. The same script is copied within the Github Issue ticket I posted.

I think the option is passed to the fortran code taper.f (in ncl_ncarg-6.5.0/ni/src/lib/nfpfort) as an argument “IOPT”. This is copied to a local variable kopt, and used for if-conditioning block that initializes the output array XT using the input array X if kopt is not 1. Please take a look.

Best,

Koichi


From: Dennis Shea <shea at ucar.edu>
Date: Monday, August 23, 2021 at 11:48 AM
To: Orhan Eroglu <oero at ucar.edu>
Cc: Koichi Sakaguchi <Koichi.Sakaguchi at pnnl.gov>, "ncl-talk at mailman.ucar.edu" <ncl-talk at mailman.ucar.edu>
Subject: Re: [ncl-talk] Serious bug in the taper (and taper_n) function with option 1

Check twice before you click! This email originated from outside PNNL.

NCL's 'taper' function is almost directly from

Peter Bloomfield
Fourier Analysis of Time Series: An Introduction
Wiley-Interscience, 1976

There is a 2nd edition (2000) that contains S-PLUS (Think 'R') functions
The 1976 has fortran subroutines.

I am sure this functionality has been replicated in other languages: C, R, Python.
It is necessary to perform tapering on non-cyclic data prior to invocation of the FFT.
-----
I've attached a simple f77 version of the code used by NCL.
Note that NCL uses a C-language interface to the fortran subroutine.
It is the C code that creates the returned ("output") array to the NCL environment.
----

The 'taper' function was in the 4.2.0 version (2001).... many years ago.
Some options were introduced in the 6.2.1 versions (Sept 2014):   taper<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ncl.ucar.edu%2FDocument%2FFunctions%2FBuilt-in%2Ftaper.shtml&data=04%7C01%7CKoichi.Sakaguchi%40pnnl.gov%7Ca574a69769584e7c721508d96666a299%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637653413287899561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=e5mLDpHXQg1YbVrLggluMucezdSn9jPGGuC%2BQQyAwOM%3D&reserved=0>

The options were implemented in the C-interface. The C-code is too complicated to attach.   :-)

If you can create a simple debug script that replicates your issue, I will take a look.


On Mon, Aug 23, 2021 at 11:58 AM Orhan Eroglu via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Hello Koichi,

Thanks for your email and detailed explanation, as well as I am sorry to hear the inconveniences you have been having!

As you already mentioned, NCL is in maintenance mode, and we are doing our best to provide support for it (prioritizing Conda installation related issues). However, even those types of issues are leading us to spend days most of the time, sometimes without finding a solution. Since we have several other toolkits in our GeoCAT stack that need to be planned, developed, deployed, and maintained in our daily workflow, sometimes, we can't even check and respond to NCL issues even though we wouldn't like to oversee any support ticket such a vibrant community has.

With all that being said, we are noting down such issues for being addressed in a future bug fix release (the date of which is not current as of today), if the community itself does not resolve the issue with the help of other users/developers.

The community developers are more than welcome to offer any solutions/bug-fixes to such NCL issues.

I hope this helps understand our situation and the tool's maintenance plan.

Regards,

On Sun, Aug 22, 2021 at 11:06 AM Sakaguchi, Koichi via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Dear NCL support staff and users,

I found a bug in the ncl function taper (and taper_n) such that when the option 1 is chosen the function does not copy all the values of the input array to the output array, except for the portions that are tapered. In my environment (NERSC and PNNL computing facilities), the uncopied values in the output array are all zero. This bug had a serious impact on my work.

The function works correctly when option 0 is chosen. This difference arises because the output array is not initialized properly in the underlying fortran code (taper.f) when option 1 is selected.
I provided more details in the NCL github issues
https://github.com/NCAR/ncl/issues/171<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNCAR%2Fncl%2Fissues%2F171&data=04%7C01%7CKoichi.Sakaguchi%40pnnl.gov%7Ca574a69769584e7c721508d96666a299%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637653413287899561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vXH6ylV4qR8wnq5GkxCW5XKNo5y3D%2FS1m3OpmfeIf84%3D&reserved=0>


I posted a bug report about a month ago following https://www.ncl.ucar.edu/Support/posting_guidelines.shtml<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ncl.ucar.edu%2FSupport%2Fposting_guidelines.shtml&data=04%7C01%7CKoichi.Sakaguchi%40pnnl.gov%7Ca574a69769584e7c721508d96666a299%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637653413287909527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=heJSK2nhiMktoh%2B7wnhzXhttAo9tkPRDmMxBy20%2Fk54%3D&reserved=0>, but no responses have been provided, so I am reporting here in the ncl-talk. I see a few even older postings without responses from the developers there... I am aware that NCL is in the maintenance mode without further development, but I think more close and regular attention should be paid to the issues posted on NCL github because NCL is still very widely used.

Best regards,

Koichi

--------------------------------
Koichi Sakaguchi, Ph.D.
Earth Scientist
ATMOSPHERIC SCIENCES & GLOBAL CHANGE

Pacific Northwest National Laboratory
3200 Innovation Blvd
PO Box 999, MSIN: K9-24
Richland, WA 99352 USA
Phone: 509-375-7385
Fax: 509-375-6448
Email:koichi.sakaguchi at pnnl.gov<mailto:Email%3Akoichi.sakaguchi at pnnl.gov>
_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.ucar.edu%2Fmailman%2Flistinfo%2Fncl-talk&data=04%7C01%7CKoichi.Sakaguchi%40pnnl.gov%7Ca574a69769584e7c721508d96666a299%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637653413287909527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AuYWYym1smwfIf5Rlf5%2F7Gf2UnJxV1IpJ98w7RoZtis%3D&reserved=0>
_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.ucar.edu%2Fmailman%2Flistinfo%2Fncl-talk&data=04%7C01%7CKoichi.Sakaguchi%40pnnl.gov%7Ca574a69769584e7c721508d96666a299%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637653413287909527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AuYWYym1smwfIf5Rlf5%2F7Gf2UnJxV1IpJ98w7RoZtis%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210823/0c00895f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_taper_v3.ncl
Type: application/octet-stream
Size: 1556 bytes
Desc: tst_taper_v3.ncl
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210823/0c00895f/attachment.obj>


More information about the ncl-talk mailing list