Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let 6.1 have more flexibility to discover new remote data sets #3370

Merged
merged 122 commits into from
Jun 5, 2020

Conversation

PaulWessel
Copy link
Member

For some background, see GenericMappingTools/gmtserver-admin#37.

This branch will implement the changes needed for 6.1. First change is to replace the hardwired "gmt_hash_server.txt" name with a constant:

#define GMT_HASH_SERVER_FILE "gmt_hash_server.txt"

Using a arameter for data hash filename makes it easier to test features by temporarily changing the hash name.

I expect the hash name to remain the same upon release though. We want GMT <= 6.0.0 to function exactly as before, except get the updated grids for the data types known to <= 6.0.0. However, 6.1 will have access to more files.

Having this as a variable makes it easier to test features by changing the hash name.
@seisman seisman added this to the 6.1.0 milestone May 22, 2020
@seisman
Copy link
Member

seisman commented May 23, 2020

This branch fails on Windows:

..\src\gmt_io.c(8604): error C2065: 'ext': undeclared identifier

@PaulWessel
Copy link
Member Author

Perhaps @seisman can think of ways to update gmt_getremote.sh once we are not just serving earth_relief files? How do we find out that an entry in gmt_hash_server.txt is a cache file vs data file when we cannot use earth_relief?

@PaulWessel
Copy link
Member Author

I added this too
if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) continue;

Per the web that should work for Windows to identify directories.

@seisman
Copy link
Member

seisman commented May 23, 2020

Perhaps @seisman can think of ways to update gmt_getremote.sh once we are not just serving earth_relief files? How do we find out that an entry in gmt_hash_server.txt is a cache file vs data file when we cannot use earth_relief?

OK. I'll try and open a PR for it.

@seisman
Copy link
Member

seisman commented May 23, 2020

gmt which -Gu @earth_relief_01d_g downloads the data to .gmt/server/earth_relief_01d_g.grd. Below are the debug messages:

gmt [DEBUG]: Revised options: -Gu @earth_relief_01d_g -Vd
gmtwhich [DEBUG]: gmtapi_init_export: Passed family = Data Table and geometry = Text
gmtwhich [DEBUG]: Object ID 0 : Registered Data Table Stream 7fff996d1e68 as an Output resource with geometry Text [n_objects = 1]
gmtwhich [DEBUG]: gmtapi_init_export: Added stdout to registered destinations
gmtwhich [DEBUG]: GMT_Init_IO: Returned first Output object ID = 0
gmtwhich [DEBUG]: GMT_Begin_IO: Initialize record-by-record access for Output
gmtwhich [DEBUG]: gmtapi_next_io_source: Selected object 0
gmtwhich [INFORMATION]: Writing Data Table to Standard Output stream
gmtwhich [DEBUG]: GMT_Begin_IO: Output resource access is now enabled [record-by-record]
gmtwhich [DEBUG]: File @earth_relief_01d_g.grd: Type is Data File
gmtwhich [DEBUG]: Look for file earth_relief_01d_g.grd in /Users/seisman/.gmt
gmtwhich [DEBUG]: Look for file earth_relief_01d_g.grd in /Users/seisman/.gmt/cache
gmtwhich [DEBUG]: Look for file earth_relief_01d_g.grd in /Users/seisman/.gmt/server
gmtwhich [NOTICE]: earth_relief_01d.grd: Download file from the GMT data server [data set size is 128K].
gmtwhich [NOTICE]: Earth Relief at 1x1 arc degrees from Gaussian Cartesian filtering (111 km fullwidth) of SRTM15+V2.1 [Tozer et al., 2019].

gmtwhich [INFORMATION]: Downloading file https://oceania.generic-mapping-tools.org/earth_relief_01d.grd ...
gmtwhich [INFORMATION]: Download complete [Got 127.373 kb].
gmtwhich [DEBUG]: Look for file earth_relief_01d_g.grd in /Users/seisman/.gmt
gmtwhich [DEBUG]: Look for file earth_relief_01d_g.grd in /Users/seisman/.gmt/cache
gmtwhich [DEBUG]: Look for file earth_relief_01d_g.grd in /Users/seisman/.gmt/server
gmtwhich [DEBUG]: Found file /Users/seisman/.gmt/server/earth_relief_01d_g.grd
/Users/seisman/.gmt/server/earth_relief_01d_g.grd
gmtwhich [DEBUG]: GMT_End_IO: Output resource access is now disabled
gmtwhich [DEBUG]: gmtlib_unregister_io: Unregistering object no 0 [n_objects = 0]
==> 0 API Objects at end of GMTAPI_Garbage_Collection
gmt [DEBUG]: Entering GMT_Destroy_Session

@PaulWessel
Copy link
Member Author

Working on this as part of the update. Is this what you expect from gmtwhich -G:

  1. -Gl: Place the file right in the current directory and nowhere else.
  2. -Gc: Place the file in the cache dir and nowhere else.
  3. -Gu: Place the file in the user dir (typically ~/.gmt) and nowhere else.

Of course, if the file already exists in cache or server/* we just copy to the requested place, but if the files do not exist locally, we do not place them in their natural directories as we do in all other situations. gmt which is special and only allows specific placements.

Is this how you interpret gmtwhich?

@PaulWessel
Copy link
Member Author

Is the testing stuck?

@seisman seisman closed this Jun 5, 2020
@seisman seisman reopened this Jun 5, 2020
@seisman
Copy link
Member

seisman commented Jun 5, 2020

The CI is OK, but github didn't get the reports.

@PaulWessel
Copy link
Member Author

Do we wait?

@seisman
Copy link
Member

seisman commented Jun 5, 2020

Do we wait?

The CI reports are here https://dev.azure.com/GenericMappingTools/GMT/_build/results?buildId=8258&view=results. No need to wait.

@PaulWessel
Copy link
Member Author

I dont understand. I says several of the test failed?

@seisman
Copy link
Member

seisman commented Jun 5, 2020

There is a segment fault for command

gmt pscoast -R0/10/0/10 -JM6i -Ba -Ggray -ENG+p1p,blue -P -Vd > map.ps

after commit 4e7c9b1. I think it's because GMT is using the old gmt_data_server.txt file.

The error message is:

gmt [DEBUG]: Local file /home/vsts/.gmt/server/gmt_data_server.txt found
gmt [DEBUG]: File /home/vsts/.gmt/server/gmt_data_server.txt less than 24 hours old, refresh is premature.
gmt [DEBUG]: Load contents from /home/vsts/.gmt/server/gmt_data_server.txt
gmt [WARNING]: File /home/vsts/.gmt/server/gmt_data_server.txt should have 12 fields but only 5 read for record 0 - download error???
gmt [INFORMATION]: Unable to read server information file
gmt [DEBUG]: Local file /home/vsts/.gmt/server/gmt_hash_server.txt found
gmt [DEBUG]: File /home/vsts/.gmt/server/gmt_hash_server.txt less than 24 hours old, refresh is premature.
gmt [DEBUG]: GMT_Create_Session initialized GMT structure
gmt [DEBUG]: Loading core GMT shared library: libgmt.so
gmt [DEBUG]: Shared Library # 0 (core). Path = libgmt.so
gmt [DEBUG]: Loading GMT plugins from: /home/vsts/work/1/s/gmt-install-dir/lib/gmt/plugins
gmt [DEBUG]: Shared Library # 1 (supplements). Path = /home/vsts/work/1/s/gmt-install-dir/lib/gmt/plugins/supplements.so
gmt [DEBUG]: Revised options: -R0/10/0/10 -JM6i -Ba -Ggray -ENG+p1p,blue -P -Vd
pscoast [DEBUG]: History: Process -R0/10/0/10
pscoast [DEBUG]: History: Process -JM6i
pscoast [DEBUG]: History: Process -Ba
pscoast [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
pscoast [DEBUG]: gmt_get_filename: In: 0/10/0/10 Out: 0/10/0/10
ERROR: Caught signal number 11 (Segmentation fault) at
/lib/x86_64-linux-gnu/libc.so.6(+0x185540)[0x7f7b8649b540]
[0x2da5]
Stack backtrace:
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(sig_handler+0x2b1)[0x7f7b869605d1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f7b86719890]
/lib/x86_64-linux-gnu/libc.so.6(+0x185540)[0x7f7b8649b540]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(gmt_file_is_remotedata+0x89)[0x7f7b86964579]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(gmt_remote_no_extension+0xf)[0x7f7b8696474f]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(gmt_access+0x123)[0x7f7b869dde93]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(gmt_parse_R_option+0x288)[0x7f7b86a8d5f8]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(gmt_parse_common_options+0x182b)[0x7f7b86a9b2db]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(GMT_Parse_Common+0x522)[0x7f7b86a61182]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(GMT_pscoast+0x1ec)[0x7f7b86c50cbc]
/home/vsts/work/1/s/gmt-install-dir/lib/libgmt.so.6(GMT_Call_Module+0x206)[0x7f7b8697d486]
gmt(main+0x6b0)[0x55bf51d9d6b0]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f7b86337b97]
gmt(_start+0x2a)[0x55bf51d9e15a]

@PaulWessel
Copy link
Member Author

Yes, since I removed the special case that let us read the old format gmt_data_server.c. Perhaps we should move on a merge, then check again for issues

@seisman
Copy link
Member

seisman commented Jun 5, 2020

Agreed.

@PaulWessel PaulWessel merged commit 4bffd86 into master Jun 5, 2020
@PaulWessel PaulWessel deleted the new-remote-files branch June 5, 2020 03:49
@PaulWessel
Copy link
Member Author

I will now change the data pointer on the server.

@PaulWessel
Copy link
Member Author

gmtserver data now pointing to the new data_6.1 directory. Will build master and see if OK, then run 6.0.

@PaulWessel
Copy link
Member Author

OK, local test with master still work as before (minus ex52.sh and gdal_nn.sh which crashes when run in ctest).

@PaulWessel
Copy link
Member Author

How might I switch to 6.0.0 and run all tests locally? THere is no 6.0.0 branch (I think) and the tarball does not have the tests. There is probably a 6.0.0 tag but my GUI Git Desktop does not seem to know about tags?

@seisman
Copy link
Member

seisman commented Jun 5, 2020

For command line, run git checkout 6.0.0 will checkout the 6.0.0 release.

@PaulWessel
Copy link
Member Author

That gave me an empty test dir so no tests could be run...

@PaulWessel
Copy link
Member Author

Fails. This fails too:
curl -k -O -L https://oceania.generic-mapping-tools.org/earth_relief_05.grd
But

-bash-4.2$ cd data
-bash-4.2$ ll earth_relief_05m.grd
lrwxrwxrwx 1 pwessel gmt 22 Jun  1 19:19 earth_relief_05m.grd -> earth_relief_05m_p.grd
-bash-4.2$ ll earth_relief_05m_p.grd
-rw-r--r-- 1 pwessel gmt 13022374 Jun  1 19:03 earth_relief_05m_p.grd
-bash-4.2$ pwd
/export/gmtserver/gmt/data

@seisman
Copy link
Member

seisman commented Jun 5, 2020

curl -k -O -L https://oceania.generic-mapping-tools.org/earth_relief_05.grd this works for me.

@PaulWessel
Copy link
Member Author

That is pretty interesting. That is not even a GMT command so not affected by versions. I get a tiny file that contains

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.3</center>
</body>
</html>

@seisman
Copy link
Member

seisman commented Jun 5, 2020

curl -k -O -L https://oceania.generic-mapping-tools.org/earth_relief_05.grd this works for me.

Sorry, I also got the "404 not found" HTML page, not the grid.

@seisman
Copy link
Member

seisman commented Jun 5, 2020

curl -k -O -L https://oceania.generic-mapping-tools.org/earth_relief_05m.grd

Did you use earth_relief_05.grd or earth_relief_05m.grd?

@PaulWessel
Copy link
Member Author

He-he-he.....
THanks.

@PaulWessel
Copy link
Member Author

With GMT 6.0.0 and blank .gmt

time gmt grdimage @earth_relief_03s  -R-156/-155/18/20 -JM4i  -B -pdf ma2 -V
real	4m38.105s

due to downloading the 15s 2.6 Gb grid. With 6.1,

time gmt grdimage @earth_relief_03s  -R-156/-155/18/20 -JM4i  -B -pdf map -V
real	0m6.537s

That is why are doing the tiling.

@seisman
Copy link
Member

seisman commented Jun 5, 2020

gmt grdimage @earth_relief_60m -JH10c -Baf -pdf map -Vd doesn't work because earth_relief_60m is not listed in gmt_data_server.txt

@PaulWessel
Copy link
Member Author

I guess the only way it could work for 6.1 is to add another entry for 60m. I link won't do since it gives up by not finding it in the table. But it is not even listed on our dataset page - do we really need to go there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants