patchGNU Octave - Patches: patch #8377, [octave forge] (mapping) 3D...

 
 

patch #8377: [octave forge] (mapping) 3D Coordinate system conversion functions for Geodesy

Submitted by:  None
Submitted on:  Wed 05 Mar 2014 01:51:47 PM UTC  
 
Category:  None Priority:  5 - Normal
Status:  Need Info Privacy:  Public
Assigned to:  Philip Nienhuis <philipnienhuis> Originator Email:  -email is unavailable-
Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Wed 11 Sep 2019 09:28:34 AM UTC, comment #27: 

Hello,

Thank you for your patience
I have tracked down where these issues were coming from.
I also added some tests for enu2uvw

Attached is the diff -u against your files

I also came across a very strange thing with assert

>> test aer2geodetic
***** test
[lat2, lon2, alt2] = aer2geodetic (33, 70, 1e3, 42, -82, 200);
assert ([lat2, lon2, alt2], [42.002582, -81.997752, 1.1397e3], 10e-6)
[lat2, lon2, alt2] = aer2geodetic ( 0.575958653158129, 1.22173047639603, 1e3, 0.733038285837618, -1.43116998663535, 200, "", "rad");
assert ([lat2, lon2, alt2], [42.002582, -81.997752, 1.1397e3], 10e-6)
!!!!! test failed
ASSERT errors for:  assert ([lat2, lon2, alt2],[42.002582, -81.997752, 1.1397e3],10e-6)

  Location  |  Observed  |  Expected  |  Reason
    (3)       1139.7018      1139.7      Abs err 0.0017996 exceeds tol 1e-05
>> test aer2geodetic
***** test
[lat2, lon2, alt2] = aer2geodetic (33, 70, 1e3, 42, -82, 200);
assert ([lat2, lon2, alt2], [42.002582, -81.997752, 1.1397018e3], 10e-6)
[lat2, lon2, alt2] = aer2geodetic ( 0.575958653158129, 1.22173047639603, 1e3, 0.733038285837618, -1.43116998663535, 200, "", "rad");
assert ([lat2, lon2, alt2], [42.002582, -81.997752, 1.1397018e3], 10e-6)
!!!!! test failed
ASSERT errors for:  assert ([lat2, lon2, alt2],[42.002582, -81.997752, 1.1397018e3],10e-6)

  Location  |  Observed  |  Expected  |  Reason
    (1)        0.73308      42.0026      Abs err 41.269 exceeds tol 1e-05
    (2)        -1.4311      -81.9978     Abs err 80.567 exceeds tol 1e-05

So the only difference was improving the decimal for the assert expected value from 1.1397e3 to 1.1397018e3 and then my observed changed drastically.

Anonymous
Sun 09 Jun 2019 02:47:12 PM UTC, comment #26: 

I've uploaded the aer2* files amended by me below, en2uvw.m is attached later.

(file #47059, file #47060, file #47061, file #47062)

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Sun 09 Jun 2019 02:16:41 PM UTC, comment #25: 

Hi Anonymous,

While working on your aer* contributions I hit the following issues:

aer2ecef, aer2geodetic:
You forgot to add "!" after the "%" in the first tests, so they didn't work at all.
After adding the exclamation marks the tests FAIL with large tolerances:

>> test aer2ecef
***** test
[x2, y2, z2] = aer2ecef (33, 70, 1e3, 42, -82, 200);
assert ([x2, y2, z2], [660.930e3, -4701.424e3, 4246.579e3], 10e-6)
[x3, y3, z3] = aer2ecef ( 0.575958653158129, 1.22173047639603, 1e3, ...
                0.733038285837618, -1.43116998663535, 200, "", "rad");
assert ([x3, y3, z3], [660.93019e3, -4701.42422e3, 4246.5796e3],10e-3)
!!!!! test failed
ASSERT errors for:  assert ([x2, y2, z2],[660.930e3, -4701.424e3, 4246.579e3],10e-6)

  Location  |  Observed  |  Expected  |  Reason
    (1)      660572.32156    660930      Abs err 357.68 exceeds tol 1e-05 by 4e+02
    (2)      -4700247.9148   -4701424     Abs err 1176.1 exceeds tol 1e-05 by 1e+03
    (3)      4245031.738    4246579      Abs err 1547.3 exceeds tol 1e-05 by 2e+03

>> test aer2geodetic
***** test
[lat2, lon2, alt2] = aer2geodetic (33, 70, 1e3, 42, -82, 200);
assert ([lat2, lon2, alt2], [42.0026; -81.9978; 1.1397e3], 10e-6)
[lat2, lon2, alt2] = aer2geodetic ( 0.575958653158129, 1.22173047639603, 1e3, 0.733038285837618,
-1.43116998663535, 200, "", "rad");
assert ([lat2, lon2, alt2], [42.0026; -81.9978; 1.1397e3], 10e-6)
!!!!! test failed
ASSERT errors for:  assert ([lat2, lon2, alt2],[42.0026; -81.9978; 1.1397e3],10e-6)

  Location  |  Observed  |  Expected  |  Reason
     .          O(1x3)       E(3x1)      Dimensions don't match

... and enu2uvw.m has no tests checking the calculation itself, just tests for error checking.

All files:
Various of style issues:

  • No parentheses around if clauses
  • texinfo incomplete or too terse (but texinfo is somewhat hard so 'll grant you those)
  • incomplete input validation
Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Tue 26 Mar 2019 08:35:04 AM UTC, comment #24: 

Attached are the files for aer2*.
I hope there will be less style issues.

>> test aer2geodetic
PASSES 13 out of 13 tests
>> test aer2ecef
PASSES 13 out of 13 tests
>> test enu2uvw
PASSES 11 out of 11 tests
>> test aer2ned.m
PASSES 7 out of 7 tests

(file #46640, file #46641, file #46642, file #46643)

Anonymous
Fri 22 Mar 2019 08:22:20 PM UTC, comment #23: 

Looks very good!

As I'm a nitpicker, apologies for that :-) , I couldn't help finding a few cosmetic style things (a.o., please always use double ## before comment lines; lines please max. 80 chars except @deftypefn lines); I'll handle those for aer2enu.m.

Same guy as patch 9709, 9720, 9736 and 9756?

Check what's in the mapping repo to avoid implementing already existing functions:
http://hg.code.sf.net/p/octave/mapping/file/71b3081e51d1/inst

BTW it looks like a new mapping release may be coming soon now; mapping works fine with new geometry and matgeom (I have test versions of those running), their maintainer is always very busy however. Once they are on the package release tracker I'll make a new mapping release.
So there's still time for new functions.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Fri 22 Mar 2019 12:00:26 PM UTC, comment #22: 

I have attached the first version.
If it is acceptable, I will continue with aer2* and the *2aer.

Then I will check against the wiki page.

(file #46616)

Anonymous
Wed 20 Mar 2019 08:20:52 PM UTC, comment #21: 

BSD (esp. 2-clause BSD) seems to be compatible with gPL (see here:
https://www.gnu.org/licenses/license-list.en.html ).

Are you going to "Octave-ify" all functions? beware then as the soon-to-be-released current mapping-1.4.0 package contains a few functions that IMO are much better than what's in Hirsch' repo (e.g., referenceEllipsoid.m).

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Wed 20 Mar 2019 10:31:23 AM UTC, comment #20: 

Michael Hirsch continued from Felipe's code
https://github.com/scivision/matmap3d

There are test cases and additional information, which could be converted to Octave style:

I did this for aer2enu

help aer2enu
-- Function File: E, N, U = aer2enu (AZ, EL, SLANTRANGE, ANGLEUNIT)
     converts azimuth, elevation, range to ENU coordinates
Inputs
----
az, el, slantrange: look angles and distance to point under test(degrees, degrees, meters)
az: azimuth clockwise from local north
el: elevation angle above local horizon
angleUnit: string for angular units.  Default 'd': degrees
Outputs
-----
e,n,u: East, North, Up coordinates of test points (meters)
Example:
          [e, n, u] = aer2enu (33, 70, 1e3)
          e =  186.28
          n =  286.84
          u =  939.69
With radians
          [e, n, u] = aer2enu (pi/4, pi/3,1e3, "radians")
          e =  353.55
          n =  353.55
          u =  866.03

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help@octave.org
mailing list.

I also added more checks

>> test aer2enu
PASSES 7 out of 7 tests

The license is BSD 2-Clause License. I am unclear with the licensing, so I have not attached the file. If I am not violating anything I will attach it.

Anonymous
Wed 28 Jun 2017 07:59:04 AM UTC, comment #19: 

IMHO, the best way is to make geod a octave package, then mapping can import it.

This requieres only a script to be added to the geod package to organize it as a OF package. Now, to be in OF (external package), we need to upload the code from Felipe to a CVS. Ideally Felipe would do this and continue dthe development there, otherwise we can fork his project. I can use my gitlab account, but I guess it is better that one of the devs of mapping does it.

I can help with this, done it several times already.

Juan Pablo Carbajal <juanpi>
Project Member
Wed 28 Jun 2017 06:25:57 AM UTC, comment #18: 

That still leaves the documentation, right?

Felipe I'm still willing to include your functions, but I'm unsure how to do this so that the OF mapping package is one comprehensive piece.
And, until at least later July I have no time/priority for this.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Wed 28 Jun 2017 04:18:26 AM UTC, comment #17: 

I've updated the zip file to include the LICENSE file.

Felipe G. Nievinski <fgnievinski>
Tue 27 Jun 2017 10:35:13 PM UTC, comment #16: 

btw, do you mena this link?
https://drive.google.com/file/d/0B-I95wETyqQidnZWbm5TbzZRcHc/edit

That zip file doesn't seem to have any license into it. Also the files do not conitan header with copyright and license ... that makes it proprietary (I mean for anyone who doesn't know you want to share it under gplv3 or any other libre license)

Juan Pablo Carbajal <juanpi>
Project Member
Tue 27 Jun 2017 10:32:13 PM UTC, comment #15: 

Great, I was just mentioning it.

Also, why not use gitlab or any other FOSS CVS server?

Juan Pablo Carbajal <juanpi>
Project Member
Tue 27 Jun 2017 10:21:27 PM UTC, comment #14: 

I'm the original author and I've already made the files available outside of File Exchange, see Google Drive link.

Felipe G. Nievinski <fgnievinski>
Tue 27 Jun 2017 09:23:15 PM UTC, comment #13: 

I guess you already know this, but just in case. The issue with File exchange is not the license but the term of use. You are not allowed to use code downloaded from there in products that are not from the mathworks.

Juan Pablo Carbajal <juanpi>
Project Member
Mon 06 Apr 2015 04:25:51 PM UTC, comment #12: 

The license is here:
<http://www.mathworks.com/matlabcentral/fileexchange/view_license?file_info_id=44848>
it's the BSD 2-Clause License:
<http://opensource.org/licenses/bsd-license.php>
therefore GPL-compatible --
in fact, it's very permissive.
I've checked that before choosing it.

Ideally the Octave-specific implementation would be just wrappers for the cross-compatible implementation.  That way when I update my library, the Octave package wouldn't have to be changed.

Sandeep was doing some preliminary work on their SoC proposal, which didn't end up being picked up, reason why the work is a bit scattered.

And you're absolutely right about the need for improving geod's documentation.  I'll try to set some time aside to do that.  Unfortunately I can't commit to a due date on the documentation, though.

So you might wish to set these geodetic functions aside and go ahead with the planned release of the Mapping Package in the near future.

Felipe G. Nievinski <fgnievinski>
Mon 06 Apr 2015 03:51:13 PM UTC, comment #11: 

@Felipe:
Core Octave is GPL, Octave-Forge requires "compatible" licenses.
Reading up here: https://www.gnu.org/philosophy/license-list.html
I conclude that the "original BSD license" (which is what Matlab Central requires I think) is incompatible with GPL.
The "3-way" aka "modified" BSD license seems to be compatible, but AFAIK that is not the license accepted on Matlab Central.
Please read up yourself.

> But I have to ask: is it necessary to fork the code and make it
> Matlab-incompatible?  The version that I maintain is cross-compatible, rather
> than compatible with Octave only.
>
> For example, myassert exists because each of Matlab's and Octave's assert.m
> are incompatible.


You mean, you want to keep the toolbox on Matlab Central and the functions in the mapping package in sync?
That would be one good reason not to fork them, as long as you want to maintain the geodesy functions.
The OF tsa toolbox has a similar setup. So if you want to follow that line I'm fine with it.

But then I do not follow what work was done by Sandeep etc. to port the functions to Octave.

BTW please note that I'm not mapping package maintainer, I know too little about projections, geodesy, etc. I just have an interest to make a release because there has been a lot of progress in this package that currently is only in the repo.
Maybe later I might pick up pkg maintenance but not soon.

A point to consider is that none of the geodesy function seem to have any usable user documentation; i.e., if I type...
"help aer2ecef"
...I only get "Origin of the system in geocentric coordinates", but no info on the input and output parameters and the values they accept and return.
So some action is required to document all functions.

AFAIK Octave accepts Matlab's help syntax (function call at top line, followed by the actual help text). Looking at the tsa package that help stuff also makes it to the on-line documentation on the Octave-Forge web site for each package.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Mon 06 Apr 2015 02:40:16 PM UTC, comment #10: 

Philip, the geod lib is BSD licensed, so you can take it and make it GPL3 if you want.

But I have to ask: is it necessary to fork the code and make it Matlab-incompatible?  The version that I maintain is cross-compatible, rather than compatible with Octave only.

For example, myassert exists because each of Matlab's and Octave's assert.m are incompatible.

Thanks for your interest.

Felipe G. Nievinski <fgnievinski>
Mon 06 Apr 2015 02:36:17 PM UTC, comment #9: 

Comment sent by Philip:

---------- Forwarded message ----------

Thanks Felipe.

I didn't know about your geodesy toolbox and the work done to transplant it to the Octave-Forge mapping package in the past.
I just happened to stumble on the patches by accident. While I was busy with that package anyway for GIS shape file functions I figured the geodesy functions are very useful.

IMO the tests had better be changed to invoke Octave assert() calls. I'm prepared to do that work; I've already converted Sandeep's contributions to Octave coding style, converting the tests doesn't constitute much additional work.

==> How about licenses? Do you guys agree with GPL3, as usual in many Octave-Forge packages?

Philip

Felipe G. Nievinski <fgnievinski>
Sun 05 Apr 2015 02:08:29 PM UTC, comment #8: 

The missing myassert.m is part of the geod toolbox, available at:
https://drive.google.com/file/d/0B-I95wETyqQidnZWbm5TbzZRcHc/edit

discussed in the mailing list:
<http://octave.1599824.n4.nabble.com/How-do-I-submit-new-functions-tp4662579p4662735.html>

and now also mentioned in the wiki:
<http://wiki.octave.org/Mapping_package#Contributing>

Felipe G. Nievinski <fgnievinski>
Sat 04 Apr 2015 08:24:08 AM UTC, comment #7: 

Got a answer from Sandeep (Sunny):
"Yes. convert_to_cartesian() is geodetic2ecef"

(BTW Please follow up in the patch tracker, not through (private) email.)

I found out that convert_to_cartesian.m might be a wrapper around geodetic2ecef.m as in the tests the input & output of convert_to_cartesian.m more or less wrap up several input/output arguments of geodetic2ecef.m.
In addition, myassert() is missing.

In short, the code seems too incomplete to incorporate in the next mapping package release :-(
For me it is simply undoable to fix all such changes in the test suite; I lack time for that.

I also found a bug in geodetic2ecef.m (that could be due to my changes):
there needs to be another "else" clause in the code testing for the "ell" variable:

  if ((nargin < 4) || isempty (ellipsoid))
    ell = get_ellipsoid();
  elseif (! isstruct (ellipsoid))
    ell = get_ellipsoid (ellipsoid);
  else                    ## Missing else clause
    ell = ellipsoid;      ## New stanza
  endif

..without that change the first test breaks.

I haven't had time to check the rest of the functions. I hope you can do that yourself.

Could you please start from my patch on top of your two patches? I've already checked in the contributions of Pooja (see patch #8372) yesterday; AFAICS your patches and mine still apply cleanly upon the new repo state as of yesterday April 3.
It would be very nice if your contributions could make it for the next mapping package release.

Do not worry about style, I can fix that; my concern is that the code and all tests works in Octave-4.0.0-rc2.

Thanks

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Fri 03 Apr 2015 09:18:27 PM UTC, comment #6: 

Am I right to surmise that function convert_to_cartesian() (referenced in tests in geodetic2ecef.m) really is geodetic2ecef ?

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Fri 27 Mar 2015 08:43:39 PM UTC, comment #5: 

Hi Felipe and Sandeep:

I've further converted your functions to Octave coding style, see attached patch.

Some remarks:

    Where are the functions myassert.m and onvert_to_cartesian.m ?

    Please review licenses for get_J2.m (lacking altogether), get_ellipsoid.m, get_sinefun.m and geodetic2ned.m

Would you agree with GPL-3?

    Furthermore there's one (the last) test in get_ellipsoid.m  that seems to run only in Matlab?

I hope to be able to include these functions in the next mapping package release (within -say- 3 weeks or so).
Could you please review my attach patch fix the above issues and supply a new patch on top of mine before mid-April, please?

Thanks

(file #33471)

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Sat 14 Mar 2015 09:22:10 PM UTC, comment #4: 

Hi Sunny,

Just stumbled onto your patches.

I've also contributed some stuff to the mapping package (GIS shapefile etc,) lately. I plan to make a release soon (but OK that has been postponed a few times due to other occupations).

In the next days/weeks I'll review your patches and push them to the mapping pkg repo if they're OK.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Thu 13 Mar 2014 08:15:25 PM UTC, comment #3: 

@Felipe

yes. If you compare the submission to the code that can be found in Octave you will see the differences. There is no need for me to point them out.

Carnë Draug <carandraug>
Project Member
Mon 10 Mar 2014 12:38:12 AM UTC, comment #2: 

@Carne: anything non-standard other than "specific end-of-block statement (like endif, endswitch) rather than generic end"?

@Sunny: thanks for your submission; please see <https://www.gnu.org/software/octave/doc/interpreter/Octave-Sources-_0028m_002dfiles_0029.html#Octave-Sources-_0028m_002dfiles_0029>

Felipe G. Nievinski <fgnievinski>
Wed 05 Mar 2014 05:52:27 PM UTC, comment #1: 

None of those files follow Octave coding guidelines. Please take a look at some code in Octave for examples

http://hg.savannah.gnu.org/hgweb/octave/file/9472e3c8f43e/scripts

Carnë Draug <carandraug>
Project Member
Wed 05 Mar 2014 01:51:47 PM UTC, original submission:  

Added the following new functions to mapping toolbox. They are related to Geodesy calculations.
 aer2ecef
 aer2enu
 aer2geodetic
 aer2ned
 ecef2aer
 ecef2enu
 ecef2enuv
 ecef2geodetic
 ecef2ned
 ecef2nedv
 enu2aer
 enu2ecef
 enu2ecefv
 enu2geodetic
 geodetic2aer
 geodetic2ecef
 geodetic2enu
 geodetic2ned
 ned2aer
 ned2ecef
 ned2ecefv
 ned2geodetic

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #47484:  diff_aer2enu.txt added by None (669B - text/plain - Diff files)
file #47485:  diff_aer2ned.txt added by None (354B - text/plain - Diff files)
file #47486:  diff_aer2geodetic.txt added by None (771B - text/plain - Diff files)
file #47487:  diff_enu2uvw.txt added by None (567B - text/plain - Diff files)
file #47063:  enu2uvw.m added by philipnienhuis (3KiB - d2l/unknowntype)
file #47059:  aer2ecef.m added by philipnienhuis (5KiB - d2l/unknowntype)
file #47060:  aer2enu.m added by philipnienhuis (4KiB - d2l/unknowntype)
file #47061:  aer2geodetic.m added by philipnienhuis (5KiB - d2l/unknowntype)
file #47062:  aer2ned.m added by philipnienhuis (4KiB - d2l/unknowntype)
file #47057:  enu2aer.m added by None (3KiB - text/x-objcsrc - A new file)
file #46640:  aer2ecef.m added by None (4KiB - text/x-objcsrc)
file #46641:  enu2uvw.m added by None (3KiB - text/x-objcsrc)
file #46642:  aer2geodetic.m added by None (4KiB - text/x-objcsrc)
file #46643:  aer2ned.m added by None (3KiB - text/x-objcsrc)
file #46616:  aer2enu.m added by None (3KiB - application/octet-stream - First version)
file #33471:  mapping_pkg_PRN.patch added by philipnienhuis (79KiB - application/x-download)
file #31007:  Patchfiles.zip added by None (15KiB - application/x-zip-compressed - I have updated my patch to follow the coding guidelines of octave community. If I miss anything, please inform. Also, I had two commits in my local repository which is why I had to generate two patch files. )
file #30845:  file-2.patch added by None (88KiB - application/octet-stream - This is an update to my previous file. Modified ECEF2GEODETIC to work with an array of inputs. )
file #30834:  file.patch added by None (89KiB - application/octet-stream - This is an update to my previous file. All the functions are working properly and giving the same values as Matlab. I have also implemented some of the suggestions of Felipe and I ll include the tests soon.)
file #30780:  file.diff added by None (71KiB - application/octet-stream - This is my first time contributing to Octave.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by fgnievinski (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 24 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-11 None Attached File- => Added diff_aer2enu.txt, #47484
        Attached File- => Added diff_aer2ned.txt, #47485
        Attached File- => Added diff_aer2geodetic.txt, #47486
        Attached File- => Added diff_enu2uvw.txt, #47487
    2019-06-09 philipnienhuis Attached File- => Added enu2uvw.m, #47063
    2019-06-09 philipnienhuis Attached File- => Added aer2ecef.m, #47059
        Attached File- => Added aer2enu.m, #47060
        Attached File- => Added aer2geodetic.m, #47061
        Attached File- => Added aer2ned.m, #47062
    2019-06-09 None Attached File- => Added enu2aer.m, #47057
    2019-03-26 None Attached File- => Added aer2ecef.m, #46640
        Attached File- => Added enu2uvw.m, #46641
        Attached File- => Added aer2geodetic.m, #46642
        Attached File- => Added aer2ned.m, #46643
    2019-03-22 None Attached File- => Added aer2enu.m, #46616
    2019-03-20 juanpi SummaryAdded new 3D Coordinate system conversion functions for Geodesy in Mapping toolbox => [octave forge] (mapping) 3D Coordinate system conversion functions for Geodesy
    2015-03-27 philipnienhuis Attached File- => Added mapping_pkg_PRN.patch, #33471
        StatusIn Progress => Need Info
        Assigned toNone => philipnienhuis
    2015-03-24 philipnienhuis StatusNone => In Progress
    2014-03-23 None Attached File- => Added Patchfiles.zip, #31007
    2014-03-10 None Attached File- => Added file-2.patch, #30845
    2014-03-09 None Attached File- => Added file.patch, #30834
    2014-03-05 None Attached File- => Added file.diff, #30780

    Back to the top


    Powered by Savane 3.5