patchGNU Octave - Patches: patch #9566, mapping package: ecc2n, n2ecc,...

 
 

patch #9566: mapping package: ecc2n, n2ecc, majaxis, minaxis

Submitter:  None
Submitted:  Sat 17 Feb 2018 08:19:41 PM UTC
   
 
Category:  Forge : new function Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  philipnienhuis Originator Email:  -email is unavailable-
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 26 Apr 2018 07:55:23 PM UTC, comment #12: 

I think current matlab's mapping toolbox uses classdef. Octave's mapping package still won't for quite some time from now as I think Octave's classdef is too incomplete yet (for one, can't save/read classdef objects to/from file.)

Please open a new patch report for new functions, don't reuse this one as it is closed.

Philip Nienhuis <philipnienhuis>
Group Member
Thu 26 Apr 2018 10:15:09 AM UTC, comment #11: 

Yes the terminology can be difficult. I will add more references to be clear where the data comes from. 

Perfect,

Now I can work towards a referenceEllipsoid function. (It uses these functions). Is there a possibility of a new version?

I have a referenceEllipsoid  which works and produces the correct data. However, it does not have all the functionality.
Also there are things matlab does I do not know how to do with a structure.

E.g.
+++
referenceEllipsoid with defining properties:
---

Instead of octave's
+++
scalar structure containing the fields:
---

And how it shows certain fields but does not display their values.



Anonymous
Sun 15 Apr 2018 05:26:31 PM UTC, comment #10: 

Thanks for the explanation. Indeed my gephysics textbook (not geology) is a bit sloppy w.r.t. exact terminology.

I've pushed the new functions here
http://hg.code.sf.net/p/octave/mapping/rev/50dfc86b9691
with very minor edits.

Again thanks for the contribution!

Philip Nienhuis <philipnienhuis>
Group Member
Sun 15 Apr 2018 01:19:29 PM UTC, comment #9: 

Thank you for looking at this.

The first flattening != first eccentricity

The value you stated is the flattening.
If you scroll down from the wiki on flattening to Identities involving flattening (note flat2ecc.m)

note the following:
e^2=2*f-f^2
so the first eccentricity is
e=sqrt(2*f-f^2)

use the WGS84 value for flattening and you should arrive at the same eccentricity.

Hope this helps

Thanks again.

Anonymous
Sat 14 Apr 2018 09:26:48 AM UTC, comment #8: 

@Anonymous:
sorry for delay, busy times.

Code looks very good! thanks.
Only minor detail left is a period after the first help sentence (under the function declarations in the header). FYI, when the documentation is extracted from a function's texinfo header, there's a function "get-first_help_sentence.m" (that does what its name suggests) that detects where the first help sentence ends by looking for a.o., the period at the end.
I'll take care of this and I'll push later after copyright updates, but first:

...Another question about actual numbers:
What eccentricities are mentioned in the function headers for Earth?

In case of Earth radius:
Wikipedia (https://en.wikipedia.org/wiki/Earth_radius and https://en.wikipedia.org/wiki/Flattening) and my own geology text books indicate that Earth's major and minor semiaxes are ~6378 and 6356 km, resp.  From there I reckon that Earth's eccentricity (= first flattening) should be 0.0034494 (~1./289.91) rather than the value 0.081819221456 mentioned in the ecc2n and n2ecc headers. The WGS84 geoid has an eccentricity of 1./298.257223563 = ~0.0033528.
In the function headers you mention Earth' eccentricity to be 0.081819221456, i.e., around 24 times larger.

In case of Earth orbit:
The eccentricity of Earth' orbit currently is around 0.0167, or 10 times larger than what's mentioned in the function headers (0.0016792).

==> So where did you get the values in the function headers from?

Philip Nienhuis <philipnienhuis>
Group Member
Fri 30 Mar 2018 11:05:50 AM UTC, comment #7: 

Thx I'll take a look, hopefully this week.

Philip Nienhuis <philipnienhuis>
Group Member
Mon 26 Mar 2018 11:46:25 AM UTC, comment #6: 
Anonymous
Thu 22 Mar 2018 02:29:08 PM UTC, comment #5: 

I did not know about test function.I was doing everything on the command prompt and then copying it into the function.

As you stated there are obvious things, which could have been caught prior to submission. I can learn from this.

Yes, even the easy functions have many things to validate.
Most of which I would never think about; I thought I was improving.

I will have some time this weekend to review and submit new versions.

The numbers should be real.

Anonymous
Thu 15 Mar 2018 09:06:34 PM UTC, comment #4: 

Anonymous, I'm not angry at you, not at all. Apologies if my tone was felt too sharp :-)

But I really wonder if you did run the functions in Octave? and did you test them (e.g., "test majaxis")? that would have shown a few obvious things to you.

  • ischar assumes the only wrong input could be char. But unwary users, or unwary scripts, might inadvertently also input cell arrays, structs, objects or in far-fetched cases maybe even graphics handles. I also tried with complex, which doesn't make much sense in the output.

So the best is to not check for a specific wrong type of input, but do the other way round: reject all types that don't make sense and accept just the one type that does.
I didn't (yet) exclude complex; should we simply discard the imaginary part?
Orientation (row or column vector): proper orientation should be checked for.

  • All if conditions should be between ()


  • I like to check the math a last time before proceeding.


  • I have little time the next weeks so expect slow progress.


You'll probably see by now, contributing a simple function looks easy, but to make it good quality it needs much more attention and code for dull stuff like input validation and error checking.

As to how further:
No idea yet. With my adaptations it isn't that much work anymore to make them publishable. I might do it, you might do it, see my comments above.

Philip Nienhuis <philipnienhuis>
Group Member
Thu 15 Mar 2018 10:38:19 AM UTC, comment #3: 

Hello,

I am sorry there was a lot of work on your end.


It is not clear to me if you would like
ischar (  ) as added in the previous additions

or if you would like
(! isnumeric) as in the current diff.

similarly for () around
nargin

I see where I went wrong on the files.
When doing an assert how much accuracy would you typically like?

Since this was a lot of work on your end. What is the path forward? I can learn from my mistakes, and I would still like to contribute. I do recognize my credibility has been diminished and you may be reluctant to accept any new patches from me.

Please let me know what you would like to do.

Again I am sorry about the extra work load.





Anonymous
Tue 13 Mar 2018 01:23:54 PM UTC, comment #2: 

Hi there,

I had quite a bit of work on:

  • adapting the files to Octave coding standards
  • debugging


Diffs ("diff -u") between your files and what I made of it are attached, please read them well.

Then:
I'm pretty sure you haven't tested or even run the files yourself. If you would you'd have hit various bugs immediately:
- failing test due to a syntax error in majaxis.m
- error tests that don't run because there should be no space between "%1" and "error<"
- minaxis.m: taking the square of e rather than ecc
- failing tests due to feeding them with constants with too little decimals/accuracy
etc.



(file #43535, file #43536, file #43537, file #43538)

Philip Nienhuis <philipnienhuis>
Group Member
Sat 17 Feb 2018 08:53:33 PM UTC, comment #1: 

Thank you agai

Busy times here, expect follow-up in early March, apologies for that.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 17 Feb 2018 08:19:41 PM UTC, original submission:  

Same person from https://savannah.gnu.org/patch/?func=detailitem&item_id=9492#options

Note: the vector ability will be removed in a future release of matlab.

I think you can close:
https://savannah.gnu.org/patch/?func=detailitem&item_id=9053

And if this gets approved close:
https://savannah.gnu.org/patch/?func=detailitem&item_id=9057#options

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #43681:  ecc2n.m added by None (2KiB - text/x-objcsrc - version 2)
file #43682:  minaxis.m added by None (3KiB - text/x-objcsrc - version 2)
file #43683:  majaxis.m added by None (3KiB - text/x-objcsrc - version 2)
file #43684:  n2ecc.m added by None (2KiB - text/x-objcsrc - version 2)
file #43535:  ecc2n.m.diff added by philipnienhuis (2KiB - text/x-patch)
file #43536:  n2ecc.m.diff added by philipnienhuis (2KiB - text/x-patch)
file #43537:  majaxis.m.diff added by philipnienhuis (3KiB - text/x-patch)
file #43538:  minaxis.m.diff added by philipnienhuis (3KiB - text/x-patch)
file #43343:  ecc2n.m added by None (2KiB - text/x-objcsrc)
file #43344:  minaxis.m added by None (2KiB - text/x-objcsrc)
file #43345:  n2ecc.m added by None (2KiB - text/x-objcsrc)
file #43346:  majaxis.m added by None (2KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 16 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2018-04-15 philipnienhuis StatusIn Progress Done
    Open/ClosedOpen Closed
2018-03-26 None Attached File- Added ecc2n.m, #43681
    Attached File- Added minaxis.m, #43682
    Attached File- Added majaxis.m, #43683
    Attached File- Added n2ecc.m, #43684
2018-03-13 philipnienhuis Attached File- Added ecc2n.m.diff, #43535
    Attached File- Added n2ecc.m.diff, #43536
    Attached File- Added majaxis.m.diff, #43537
    Attached File- Added minaxis.m.diff, #43538
    StatusNone In Progress
2018-02-17 philipnienhuis Assigned toNone philipnienhuis
2018-02-17 None Attached File- Added ecc2n.m, #43343
    Attached File- Added minaxis.m, #43344
    Attached File- Added n2ecc.m, #43345
    Attached File- Added majaxis.m, #43346

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code