GenericMappingTools / gmtserver-admin

Cache data and script for managing the GMT data server
GNU Lesser General Public License v3.0
7 stars 3 forks source link

Update makefile due to new celestial bodies? #178

Closed Esteban82 closed 1 year ago

Esteban82 commented 1 year ago

Now, thanks to @willschlitzer we also have the moon data (moonrelief). But in makefile (line 25 copied below) cat only reads the `earth*_server.txtfiles. Therefore, the information frommoon_relief_server.txtis not included ingmt_data_server.txt`. I suspect that Will had done it manually (in #167). Is this correct @willschlitzer?

Lines 23-27 of makefile

server-info:
        date "+%Y-%m-%d" | awk '{printf "s/THEDATE/%s/g\n", $$1}' > /tmp/sed.txt
        cat information/earth_*_server.txt | grep -v '^#' | wc -l | awk '{printf "%d\n", $$1}' > information/gmt_data_server.txt
        sed -f /tmp/sed.txt < information/gmt_data_server_header.txt >> information/gmt_data_server.txt
        cat information/earth_*_server.txt >> information/gmt_data_server.txt

So, I think that makefile should be updated. How it is the proper way to do it? We can't use *_server.txt because it will try to read gmt_data_server.txt. Also the line 27 should be modified (or append a new line for the moon).

How I found the issue

I was testing the moon relief (#167 ) with the following code and I got the strange warning that I haven't see before.

federico@loki:~/Github/gmt$ gmt grdimage @moon_relief_05m -Baf -png moon -JW15c
gmt [WARNING]: File /home/federico/.gmt/server/gmt_data_server.txt said it has 297 records but only found 324 - download error???
Esteban82 commented 1 year ago

BTW, I just enter the test server and replace 297 by 324 in the gmt_data_server.txt and the warning message disappeared.

And I got this map with
gmt grdimage @moon_relief -JW15 -Rg -png moon

moon

PaulWessel commented 1 year ago

Thanks, yes it was all Earth centric and now we need to make some changes here and there to expand the makefiles to deal with stuff - should like you are all figuring it out without me looking! I think there was a discussion about @moon_relief.cpt in the cache but this looks like an Earth CPT?

Esteban82 commented 1 year ago

this looks like an Earth CPT?

Yes, I suspect that the moon cpt hasn't been merge yet.

willschlitzer commented 1 year ago

Apologies, late to get to this. I manually added the information from moon_relief_server.txt to gmt_data_server.txt. I don't have any experience with Makefile, so my apologies that I won't be too helpful.

For the fix in #179, is there any way to put an or statement when it cat is looking for files? I wasn't able to find a solution doing a quick Google search, but something like (I don't know the proper syntax): (earth|moon)_*_server.txt

Esteban82 commented 1 year ago

I don't have any experience with Makefile, so my apologies that I won't be too helpful.

My neither.

Esteban82 commented 1 year ago

For the fix in #179, is there any way to put an or statement when it cat is looking for files? I wasn't able to find a solution doing a quick Google search, but something like (I don't know the proper syntax): (earth|moon)_*_server.txt

As far as I know, It is only possible to do with character, not strings.

Other solution could be ????*_*_server.txt. This way cat will only read strings with at least 4 character (so excluding gmt). But it is not very elegant.

Or maybe we could change the extension of the earth|moon_*_server.txt files to ".dat" (for example) so, we could do cat *.dat instead. But I don't know is this would affect other scripts.

So, I think that it is better to remove the gmt_data_server.txt (as a proposed in #179).

Esteban82 commented 1 year ago

Other solution could be ????*_*_server.txt. This way cat will only read strings with at least 4 character (so excluding gmt). But it is not very elegant.

With this code, we will have issues with Io.

willschlitzer commented 1 year ago

Sounds good; I think your solution is a good one!

Esteban82 commented 1 year ago

In #179 seisman propossed to change the suffix of the files (from _server.txt to _info.txt).

I think that it is be a better solution because we can replace the name of only the files that we want to concatenate.

joa-quim commented 1 year ago

I’ve not been following this closely but isn’t it what Paul said that would breake backward compatibility?

PaulWessel commented 1 year ago

I was also not paying full attention but I think the questions related to temporary files that are then used to assemble the server.txt file (which needs to be just one, plus the cache file as @seisman said). So whatever makes the assembly of that final file easier is fine with me,

Esteban82 commented 1 year ago

So whatever makes the assembly of that final file easier is fine with me,

Then I think that the easier way is to approved the PR #179 (if it is correct) because it is already done.