Bug #576

grdtrack hangs; might be Nan in grid or can't have stacking tracks > 2384 km

Added by Joseph almost 3 years ago. Updated over 2 years ago.

Status:ClosedStart date:2014-06-09
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.1.1 Platform:

Description

Basically I hacked example 33 (which is a perfect template for some Machine Learning i'm doing on seafloor age; thanks very much .

The upshot is that for for a transect along the MAR (-28 45.375, -29 43.36) i want to stack the values grdtrack pulls out of a good sized area.

gmt grdtrack ridge.txt -Gspac.nc -C2300k/4k/10k -Sm+sstack.txt -V > table.txt

grdtrack: Processing input grid(s)
grdtrack: Sampled 14425 points from grid spac.nc (321 x 151)

if I increase the stack "width" width from 2380 km to 2400 km , it hangs. At first I thought it was some sort of 32k roll over as the number of points was getting close to 32k, but I reduced the number of samples along the stack from every 2k to every 4k, and it still hangs.

Seems unlikely that there is a limit to 2400km, but I notice the seafloor age grid I downloaded from U Sydney, happens to have a NaN, at the western edge of stack. See attachment.

So I think grdtrack hangs if using a "stack" and the grid has a NaN in the stack area. Or something. Coplete code below, but basically example 33

-jj

p.s. I left the the CLUT "wrong", i.e. b&w to make it easier to see the "stack", as I am color blind...

sherwood:Age jbecker$ bash -x gmtExample33.sh
+ ps=example_33.ps
+ rm -f example_33.ps gmt.conf z.cpt spac_int.nc ridge.txt table.txt env.txt stack.txt
+ gmt grdcut age.3.6.nc -R45W/13W/35N/50N -fg -Gspac.nc
+ gmt makecpt -Crainbow -T-5000/-2000/500 -Z
+ gmt grdgradient spac.nc -A15 -Ne0.75 -Gspac_int.nc
+ gmt grdimage spac.nc -Ispac_int.nc -Cz.cpt -JM6i -P -Baf -K -Xc --FORMAT_GEO_MAP=dddF
+ cat
+ gmt psxy -Rspac.nc -J -O -K -W2p,red ridge.txt
+ gmt psxy -R -J -O -K -Sc.11i -Gred ridge.txt
+ gmt grdtrack ridge.txt -Gspac.nc -C2300k/4k/10k -Sm+sstack.txt -V

—> Hangs here if if use -C2400k/4k/10k

grdtrack: Processing input grid(s)
grdtrack: Sampled 14425 points from grid spac.nc (321 x 151)
+ gmt psxy -R -J -O -K -W0.5p table.txt
+ gmt gmtconvert stack.txt -o0,5
+ gmt gmtconvert stack.txt -o0,6 -I -T
+ gmt psxy -R-1400/1400/0/20000 '-Bxafg1000+lDistance from ridge (km)' '-Byaf+lAge (ky)' -BWSne -JX6i/3i -O -K -Glightgray env.txt -Y6.5i
+ gmt psxy -R -J -O -K -W3p stack.txt
+ echo '0 -2000 MEDIAN STACKED PROFILE'
+ gmt pstext -R -J -O -K -Gwhite -F+jTC+f14p -Dj0.1i
+ gmt psxy -R -J -O -T
sherwood:Age jbecker$

example_33.ps (77.2 KB) Joseph, 2014-06-09 10:00

example_33.ps (77.2 KB) Joseph, 2014-06-09 10:07

Associated revisions

Revision 13280
Added by Paul almost 3 years ago

Handle presence of NaNs, see issue #576

History

#1 Updated by Joseph almost 3 years ago

hmmm, the plot did not upload, at least as far I can tell, but I did select it for attachment. Let me try again. Web page say says example_33.ps is attached above button (and there is paper clip icon left of that), but right of attachment button is says no files attached...

If the file doesn't get attached the is tim, and you need it, let me know where to mail it... (33kB)

#2 Updated by Joseph almost 3 years ago

now i see the link to the file, was electing it to open. Sorry to waste your time on that

#3 Updated by Paul almost 3 years ago

  • Status changed from New to In Progress

Yes, some points in the stack are NaN, which happens to hang up the median calculation as it did not expect NaNs. I guess the only solution that makes sense is to simply skip profiles with NaNs at that distance and only use the no-NaN values in the calculation. If there are no profiles without NaNs then a NaN should be returned.

#4 Updated by Paul almost 3 years ago

  • Status changed from In Progress to Resolved

See if r13280 fixes the problem for you.

#5 Updated by Joseph almost 3 years ago

That fix would agree with my intuition. Thanks!

BTW this is not my biggest problem, what I need immediately is grid vales at the locations in stack, that appears to work fine, even if there are NaN. (IOW if I don't use -S I get the samples I need).

But I'll need the "-S" file eventually.

#6 Updated by Joseph almost 3 years ago

Paul wrote:

See if r13280 fixes the problem for you.

I'm lazy and use macports and didn't read all the docs. Is there a way for me to hack a test or do I need to rebuild using your scripts?

#7 Updated by Paul almost 3 years ago

Kinda have to do the install via subversion to get updates. Once you do that it is simply
svn up; make -j24 install
whenever a new thing appears. The Wiki has instructions.

#8 Updated by Paul almost 3 years ago

Anyway, tested things a bit more and r13282 has the latest. Made sure all functions returning expected value return NaN if no data are passed.

#9 Updated by Paul over 2 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

Closing this as completed.

Also available in: Atom PDF