Creating a surface using weighted points

I primarily use GMT4 on my system. I need to create a surface but use weighted points. It seems GMT4 doesn’t have the ability but GMT6 surface can if i’m not mistaken. Correct? I have been trying to set it up so I can keep GMT4 as my main program but set up GMT6 to also run with a certain prefix before commands. I have spent over 4 hours and still cannot get it to work. So before I continue I just wanted to confirm GMT6 even has this ability. :wink:

I believe you can easily jump from one to another with gmtswitch.
Though, all gurus here will tell you to simply update to GMT6

Since we claim GMT6 is backwards compatible with GMT4, perhaps you have other reasons why you hold on to software that is 5+ years old?

So many of the options for commands have changed from GMT4 to GMT5 unsure about the GMT5 to GMT6. For some commands I have even noticed that -“some letter” was used by both gmt4 and gmt5 but very different meaning and then still have the variable from gmt4 but rename it. I forsure would not agree with backwards compatible claims. We have hundreds of complicated scripts (some near 1000 lines long) that would need to get sifted through for all these changes. Weeks of work.

Need to be able to use both gmt4 and gmt6.

Questions remains. For GMT6 can weighted values be used directly by surface?

Interesting. Never knew about gmtswitch. It seems if you have gmt and use gmtswitch you can switch between gmt4 and gmt5. Then once have gmt6 can switch between gmt6, gmt5 & gmt4. But if you start with gmt4 I cannot use gmt6 so I’m still stuck.

Edit: I guess if I simply remove gmt4 and install gmt6 then use gmtswitch that could work. However, installing software on the machine I work off of is very difficult (have no admin permission, shared cluster, etc), but possible, so I just want to confirm GMT6 surface capabilities before I spend more hours on this.

@pwessel would have more insight on this, but have you looked at greenspline module ?

Depends a lot on what you are gridding and how many points. surface can grid as much as your memory allows, but the weighting there is done by using weights in blockn modules. Surface only accepts one point per bin (or none if empty) and if the bin originally had many points with different weights then you can get teh weighted average value and location via blockn.

greens-line takes weights directly but if you have N points then it does involve inverting a N*N matrix. So usable up to a few 10k points depending.

Finally, nearneighbor takes optional weights as well. Summary:

Dense data where you have data: nearneighbor w/weights
Huge data set: surface
Smaller dataset: greens-line with weights.

I think you are not fully understanding what we claim. We claim that those scripts will still work on GMT6 without any modification. But ofc practice may show some corner case where backward compat was if fact broken. Only experimenting will tell.
What you cannot do is to mix GMT4 & GMT5 synatx for the options that changed syntax. And cannot expect also to find old documentation for the options that were dropped meanwhile.

Also, if GMT 4 users do not report things that dont work for them in 6 then we are in the dark and cannot do anything. E.g., GMTSAR csh scripts were developed in GMT4 days and run find with GMT6, also many thousands of lines, I believe.

Is this true for all gmt versions, or just gmt6?
Because in gmt 4 weights dont seem to work.

It was about 4 years ago when I tried to convert to GMT5 from GMT4 and found various issues. Maybe they have been corrected since. I’ll do some more testing as I do agree I should be using the latest gmt version since it is more versatile. Any findings of incompatibility I’ll report on the forum.

block*, nearneighbor and surface are largely unchanged in functionality and there are -W option (not surface). greens-line came in v4 but the weight stuff were completely redone in 6 so that it actually works

I have both GMT4 and GMT6 installed on my Mac with MacPorts. I then set my path to have both installations:
set path = (/opt/local/lib/gmt6/bin /opt/local/lib/gmt4/bin $path ) (for csh).
This allows me to run very old scripts that have GMT4 syntax and slowly convert them to GMT6 syntax by adding the gmt before the commands. There are some commands that have different syntax for some options (psbasemap -B is one that I remember).

Yes, I remember -B for a couple commands changed. I think grdcontour syntax options changed slightly too. And one other commonly used command. It’s been years and no way to test until able to install GMT6. Working with system admin to get that done. :slight_smile:

I feel your pain. If my IT people put such limits on what I can do with software I would slap their faces with a smelly fish - this approach is known to work.
But nobody is stopping you from installing 6 in your own directory. It does not have to be in a scary system directory, no? Just set your PATH.

When converting it’s normal to find issues because naturally there will be syntax mixes that sneak in. The trick is to not convert at all. But for that you need to use one of the scripts we provide to create symbolic links to the module names, otherwise it now needs to preface every GMT module name with gmt.