patchGNU Octave - Patches: patch #9051, Octave Mapping package: Antipode

 
 

patch #9051: Octave Mapping package: Antipode

Submitted by:  None
Submitted on:  Thu 14 Jul 2016 05:23:27 AM UTC  
 
Category:  Forge : new function Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Philip Nienhuis <philipnienhuis> Originator Email:  -email is unavailable-
Open/Closed:  Closed

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)

Sun 05 Mar 2017 08:23:40 PM UTC, comment #6: 

I pushed my version of antipode.m, including several tests, here:
http://hg.code.sf.net/p/octave/mapping/rev/2877cf62e020

Closing report

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Thu 02 Mar 2017 04:28:01 PM UTC, comment #5: 

In some 15 minutes I've created the attached antipode.m that conforms to Octave coding standards en does have the features I want to see.
I'm still unsure about Lat > 90 & Lat < -90. What does Matlab return for e.g., Lat = 135 or Lat = -135?

I'll add a few more BIST tests and upload it soon.

(file #39881)

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Wed 01 Mar 2017 09:39:26 PM UTC, comment #4: 

Thanks for the new version.

I am sorry to say that the texinfo still isn't that great. Please have a look at other functions in the mapping pkg.

Longitude had better be clipped using the mapping package function wrapTo180.m
Why can latitude be > 90 and < -90?  It should be in the closed interval [-90 .. 90]. Try wrapTo180 / 2 for that.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Mon 18 Jul 2016 11:54:20 AM UTC, comment #3: 

Thanks for a quick response!

I hope you want to improve it a bit more; I am hopeful because you were so quick, and that is why I add so much comments below, to show you what kind of quality we expect.

Trying "help antipode":

>> help antipode
'antipode' is a function from the file D:\Octave\Octave-4.0.3_w64\share\octave\pac
kages\mapping-1.2.1\antipode.m

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.  This program is distributed in the hope that
it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.  You should have received a
copy of the GNU General Public License along with this program; see the
file COPYING. If not, see <http://www.gnu.org/licenses/>.  -*- texinfo
-*-

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.

while a sibling antipode2.m, made by me by simply typing
edit antipode2.m
in the Octave terminal + copying over code + slight style editing, looks as follows:

>> help antipode2
'antipode2' is a function from the file D:\Projecten\antipode2.m

-- Function File: RETVAL = antipode2 (INPUT1, INPUT2)

     See also{????}

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.
>>

==> the texinfo layout isn't OK.
Just do as I showed: in he Octave terminal type "edit antipode.m", please fill in the copyright line + author line and if there are functions doing similar transformations, add their names (w/o trailing .m) between the seealso brackets, separated by commas, or if not: omit the seealso line.
Also take care of the syntax of the @deftypefn line, do mention all arguments.

Input checking is required. Make sure input args are numeric and are within accepted ranges. What about:

>> [la, lo] = antipode2 (-987.3, 400083)
la =  987.30
lo = -399903

That doesn't make sense, does it?

In addition (but I tend to be overasking) add a few tests. You can use e.g., the following example:

>> [la, lo] = antipode2 ([-34, 190], [187, -15])
la =
    34  -190
lo =
    -7   195
>> [la, lo] = antipode2 ([-34; 190], [187; -15])
la =
    34
  -190
lo =
    -7
   195

and error tests are needed.
See e.g., strread.m for how tests look like. Error tests make sure erroneous input is catched.

To be able to credit you, please supply your name and email address. If you don't want to it'll be credited to "anonymous" I suppose :-)

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Fri 15 Jul 2016 05:42:27 PM UTC, comment #2: 

Thanks.

Even while it such a simple function it'll need a bit of polishing to comply to Octave coding standards:
- spaces between LHS, "+" and RHS
- spaces after a commma separating args
- spaces around operators
- endfunction statement
- decent texinfo header and copyright message.

Will you be able to get that together, please?
Examples are ubiquitous in the mapping package.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Thu 14 Jul 2016 06:12:42 AM UTC, comment #1: 

Where is the attachment ?

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Thu 14 Jul 2016 05:23:27 AM UTC, original submission:  
 

## Returns the antipode of the given latitude and longitude function [alat,along]=antipode(lat,long)
alat=-lat;
along=180-long;

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #39881:  antipode.m added by philipnienhuis (2KiB - text/plain)
file #39764:  antipode.m added by None (2KiB - application/vnd.wolfram.mathematica.package - Added test cases and cleaned up syntax)
file #37985:  antipode.m added by None (2KiB - application/vnd.wolfram.mathematica.package - Version 3)
file #37905:  antipode.m added by None (952B - application/vnd.wolfram.mathematica.package - Version 2)
file #37878:  antipode.m added by None (133B - application/vnd.wolfram.mathematica.package)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by philipnienhuis
  •  

    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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-05 philipnienhuis StatusIn Progress => Done
        Open/ClosedOpen => Closed
    2017-03-02 philipnienhuis Attached File- => Added antipode.m, #39881
        StatusNone => In Progress
        Assigned toNone => philipnienhuis
    2017-02-16 None Attached File- => Added antipode.m, #39764
    2016-09-03 philipnienhuis Carbon-Copy- => Added philipnienhuis
    2016-07-22 None Attached File- => Added antipode.m, #37985
    2016-07-15 None Attached File- => Added antipode.m, #37905
    2016-07-14 None Attached File- => Added antipode.m, #37878

    Back to the top


    Powered by Savane 3.5