csdms-contrib / slepian_alpha

Scalar spherical-harmonic analysis and Slepian functions
GNU General Public License v2.0
26 stars 31 forks source link

Changed glmalpha to avoid rotation for general named regions #9

Closed AlainPlattner closed 8 years ago

AlainPlattner commented 8 years ago

In octave, when you run for example rotb=namerica('rotate') you get the XY coordinates as output. This led to glmalpha attempting to rotate for all named regions. I changed it such that it only rotates when rotb is true and has length 1. Is that ok with everyone?

harig00 commented 8 years ago

This looks fine. But it was my expectation that if you called xy=namerica('rotated') you would either get nothing or it would break. Hence the try statement. Why is it giving you actual coordinates? It should be treated just like say 'demo6' which does not exist.

AlainPlattner commented 8 years ago

Octave seems to be very generous when it comes to type casting. in line fnpl=fullfile(whereitsat,sprintf('%s-%i.mat',Regn,res)); in regselect.m (where res='rotate'), Octave creates a weird file name and in line tb=linspace(0,1,n*N); in bezier.m (where N='rotate'), octave is typecasting 'rotate' as an array of integer and linspace just takes the first element of N.

Bottom line: we have to be careful with tricks like these when Matlab/Octave are trying to be smart and just type-cast.

harig00 commented 8 years ago

Weird. I wonder if this changed recently. I was pretty sure I checked the default behaviour just erred. Anyway, I have another 6 or so region files I'll upload this semester which cover the pole, so they get solved on equator, and rotated their after the fact.

AlainPlattner commented 8 years ago

Matlab does not do the type casting as generously as Octave. There may be a way to change this in Octave but I haven't looked into this. Thanks for the heads-up about the region files. At the moment the Octave mapping toolbox does not have some of the functions needed to generate the regions from scratch. My work-around at the moment is to generate the COAST files, make them available on my website, and then automatically download them when people install the https://github.com/Slepian/Slepian package.

harig00 commented 8 years ago

These coast files are generated from satellite altimetry data, however I needed to make heavy use of the mapping tool box to get them to the state I use them. I don't see equivalents in Octave. These are a bit specific to what I do so you probably won't miss them.

AlainPlattner commented 8 years ago

Ok. The reason why I am pushing Octave so much is because it is free. This together with how easy it is to turn for example Chromebooks into linux machines just makes all of our work immediately available to anyone who has $200 to afford a Chromebook. For Matlab, that's what you pay for a single toolbox.