[Re-opened] Interpolation scheme to be used in WAFS SIGWX Forecast #263
Replies: 5 comments 25 replies
-
I have read the response from Graeme and I completely agree with the view that forecasters do not ever think about the particular interpolation technique used by the underlying software tool. However an advantage of using Bezier cubic splines is that the software will directly encode what user had on screen without any room for interpretation - so the recipients of the data will draw the same shape the forecaster saw on screen. This is because all major drawing APIs on Linux & Windows like Microsoft GDI, GDI+, Direct 2D/Direct Draw, Cairo, Skia, OpenGL etc. support cubic Bezier splines out of the box. Vendors then have a very easy job of plotting the curve with a single API call. My main concern with the proposed gml:CubicSpline is not the difficulty in implementation - this kind of cubic spline is uncommon, but not overly difficult to implement. Why do I say that it is uncommon? The real issue is with the underlying GM_CubicSpline in ISO 19107 Geographic Information - Spatial Schema where a very unfortunate name/terminology was chosen - using the general term "cubic spline" to actually denote a so called "C2 continuous natural cubic spline" (a standard textbook name). Quoting from ISO 19107 Geographic Information - Spatial Schema, section 7.13.6 Interface CubicSpline:
The above is a very particular and unique type of C2 continuous cubic splines (C2 = continuous 1st and 2nd derivatives). The general term "cubic spline" would normally denote a whole class of cardinal, Catmull-Rom, Kochanek-Bartels, Hermitean and other types of polynomial cubic splines. What is denoted by gml:CubicSpline is very confusingly not this whole class, but a very specific C2 continuous type. Please note in the quote from ISO 19107 that even with gml:CubicSpline you still need to specify derivatives at the curve endpoints! (but it is true you do not need to specify the derivatives at the inner control points where the segments join, because these can be fully determined from the C2 continuity requirement - but for the outer endpoints it is still necessary). A good overview article is https://en.wikipedia.org/wiki/Spline_(mathematics) which mentions many cubic spline types and also explains the specific natural C2 cubic splines as used in GML. Also https://en.wikipedia.org/wiki/Cubic_Hermite_spline The issue I see with this is that not everyone studied computational geometry or computer graphics. I am afraid some vendors due to the misleading (overly broad) term gml:CubicSpline will not realise, that in GML (based on ISO 19107 GM_CubicSpline) this is a very special type of "C2 continuous natural cubic splines" and instead they will just use the same spline algorithm they have been using for the past 20 years - not displaying what was originally intended. A brief summary about gml:CubicSpline (GM_CubicSpline):
I am not fully opposed to using gml:CubicSpline. It is an intriguing concept and in GML besides gml:Bezier and gml:LinearRing there is no other reasonable choice. I fully recognize the advantage of not having to specify the additional control points like in Bezier to determine derivatives (however at outer endpoints they still need to be provided!). And the compact representation offered by gml:CubicSpline where the spline passes through all the specified control points is also a useful property. I am just saying that the choice of gml:CubicSpline has a potential downside, that implementors will get confused by the overly generic "cubic spline" term and fall back on their existing algorithms, instead of going the more difficult route of solving the 3-diagonal system of equations for each curve. For those that will take the extra step this will make the software less efficient because of the additional computational complexity as opposed to Bezier or LinearRing. But I guess the overall impact of the extra math will not be so large considering all the other computations that need to be performed to plot the data on screen. Until now I was trying to represent the broader community of software vendors, but I would appreciate if members of other companies wrote their point of view. Specifically for IBL, for manual drawing of SIGWX-like charts by the forecaster (in our drawing tools at least) we will still have to fall back on just C1 continuous cubic splines. Our company is currently using Cardinal cubic splines for SIGWX charts (https://en.wikipedia.org/wiki/Cubic_Hermite_spline) with c=0 tension parameter and a specific knot sequence. It is a simpler type of a cubic spline which makes approximation easier (approximation of jets or clouds drawn freehand on a tablet, or approximation of isocontours based on e.g. NWP MSLP pressure or geopotential). For the C2 natural cubics we do not know how to implement such numerical approximation algorithms that fit a 2D freehand curve. So if SIGWX switches over to C2 splines we will likely need to support also C2 continuous gml:CubicSpline and then approximate it with the Cardinal C1 cubic spline if users will want to continue tweaking the SIGWX charts for their area of interest (we have many users who base their mid-level SIGWX charts on the WAFC SIGWX data by importing the jets/clouds/CATs into graphical editor and moving control points around). Kind regards, |
Beta Was this translation helpful? Give feedback.
-
I see. That means we need to skip using gml:CubicSpline and define our own representation of a curve with points along it and interpolation scheme like C1 cubic spline? |
Beta Was this translation helpful? Give feedback.
-
I've had a read through all of the info and attachments in the discussion so far, and I think I have a broad understanding of the issues. I never studied geometry in depth, however, so I'm only gradually wrapping my head around Bezier curves and all the different types of splines. I can see the advantages of curves defined as Bezier curves being totally unambiguous, whereas points described simply as defining a "spline" could mean a variety of curves. The only reason I have used cubic splines in the way I have so far is that this is what I inherited when I took on the SigWx code, and I didn't have much of an understanding of the complexities of curves at the time (and still don't fully, to be honest!). I don't object to trying to implement using Bezier curves. I googled how to convert splines to Bezier curves earlier, and funnily enough came across the same link in Jan's email which I didn't look at until later. I can have a go and seeing what effect implementing this has, although it may take me a little while because, as I say, my knowledge of curve geometry is currently relatively limited. One of my concerns would be making sure that all of the eventual users of the data are absolutely clear that going from manually-drawn objects in BUFR data to algorithmically-drawn objects in IWXXM that they can't just use their old spline functions, as the Bezier control points will presumably be outside of the hazard area perimeter, rather than on the perimeter itself. I'll discuss this with my colleagues who deal with the users of this sort of data. |
Beta Was this translation helpful? Give feedback.
-
Thank you for Graeme and Boris joining the discussion yesterday. I would like to highlight the outcomes and follow up actions below. Feel free to comment or modify.
Finally there is hope for us to safely close this topic. :) I would also like to forward Boris' comment that what Graeme has been doing with regard to the generation of weather objects is very impressive. I can't agree more with him. |
Beta Was this translation helpful? Give feedback.
-
Thank you to Choy for re-opening this discussion, so Boris can potentially contribute as well. I emailed Choy with the following question, which I hope one of you can answer:
|
Beta Was this translation helpful? Give feedback.
-
The document Representing WAFS SIGWX Data in BUFR mentioned that "An appropriate smoothing technique such as a cubic spline should be used to smooth the jet-stream curve plotted between the core points." This also applies to the horizontal boundary of the CAT and cloud areas.
In the IWXXM implementation of the WAFS SIGWX Forecast, it is anticipated to carry forward this idea in the encoding:
@borisburger in his e-mail indicated difficulties in proper implementation of cubic splines and propose the use of Bezier. @GAndrsn after studying Boris' suggestion had identify some other issues with Bezier.
Summarizing the discussion so far, I think the key issues on this topic is as follow:
I hope I have given a correct account to the issue. Graeme and Boris feel free to express your views. Others are most welcome to join the discussion.
Beta Was this translation helpful? Give feedback.
All reactions