Skip to content

Improve detection of cubes - #6620

Merged
PaulWessel merged 1 commit into
masterfrom
cube-detect
Apr 24, 2022
Merged

PaulWessel merged 1 commit into
masterfrom
cube-detect

Conversation

@PaulWessel

Copy link
Copy Markdown
Contributor

Add two macros working on virtual names that can detect cubes vs grids. Also, use n_bands to help detect cubes vs grids.
Now works in Julia again. Closes #6617.

Add two macros working on virtual names that can detect cubes vs grids.  Also, use n_bands to help detect cubes vs grids.
Now works in Julia again.  Closes #6617.
@PaulWessel PaulWessel added the bug Something isn't working label Apr 24, 2022
@PaulWessel PaulWessel added this to the 6.4.0 milestone Apr 24, 2022
@PaulWessel
PaulWessel requested a review from joa-quim April 24, 2022 09:18
@PaulWessel PaulWessel self-assigned this Apr 24, 2022
@PaulWessel
PaulWessel merged commit d2c830c into master Apr 24, 2022
@PaulWessel
PaulWessel deleted the cube-detect branch April 24, 2022 11:39
@PaulWessel

Copy link
Copy Markdown
Contributor Author

Before I submitted this PR, I ran all the CLI tests to make sure it worked. However, I typically do not build and test if pyGMT (@seisman) and GMT.jl (@joa-quim. or GMT/MEX for that matter) is affected - such as this one. How difficult would it be for me to run all the tests in pyGMT and GMT.jl. I have both repos installed? Is there something equally simple to what we have for the CLI to run your tests?

@seisman

seisman commented Apr 24, 2022

Copy link
Copy Markdown
Member

How difficult would it be for me to run all the tests in pyGMT and GMT.jl.

If you have the conda environment setup, then you should be able to run the full tests by typing make test. However, you would see ~50 failing tests due to some tiny changes between GMT 6.3.0 and dev.

@PaulWessel

Copy link
Copy Markdown
Contributor Author

Thanks, I will give it a try. This also reminds me of this potential solution to the changing grids:

We do have test.generic-mapping-tools.org and we could simply keep the current set of files needed there with a limited gmt_data_server.txt and let gmtest.in select the test server. As the regular data server gets updated the test server directory stays the same. Apart from fixing any remaining old-data failures, going forward we should not have to worry. If we need additional tiles or data for testing then we just place a copy in the test directory as well and it will be "frozen".

@seisman

seisman commented Apr 24, 2022

Copy link
Copy Markdown
Member

We do have test.generic-mapping-tools.org and we could simply keep the current set of files needed there with a limited gmt_data_server.txt and let gmtest.in select the test server. As the regular data server gets updated the test server directory stays the same. Apart from fixing any remaining old-data failures, going forward we should not have to worry. If we need additional tiles or data for testing then we just place a copy in the test directory as well and it will be "frozen".

It sounds a good idea, but we already have test.generic-mapping-tools.org used for testing new versions of earth grid data, so perhaps we need a separate domain (and a separate folder on the server) instead.

@joa-quim

Copy link
Copy Markdown
Member

The tests in Julia are run by

] test GMT

But mind you that sometimes they crash due to an unknown heisenbug. When it happens it does so around the MAKECPT tests. There is also a new failure even more mysterious that sends GMTcpt objects to the function that reads datasets. In either cases, I just rerun the tests.

@PaulWessel

Copy link
Copy Markdown
Contributor Author

I added GMT#master and using GMT and then tried the test. I will add the output below but one thing I noticed that is odd is this:

You don't seem to have GMT installed and the automatic installation also failed.
You will have to do it yourself.
Install GMT with Homebrew: brew install gmt ghostscript ffmpeg

I am able to run debugs etc via GMT_LIBRARY so what does this mean? Anyway, it looks like it tried to run the tests since I got various GMT messages. Let me know if there are things here that puzzles you or we should have a look at since this is the first time the tests have been run on macOS possibly:

(@v1.7) pkg> add GMT#master
    Updating git-repo `https://github.com/GenericMappingTools/GMT.jl.git`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/.julia/environments/v1.7/Project.toml`
  [5752ebe1] ~ GMT v0.41.2 `https://github.com/GenericMappingTools/GMT.jl.git#master` ⇒ v0.41.2 `https://github.com/GenericMappingTools/GMT.jl.git#master`
    Updating `~/.julia/environments/v1.7/Manifest.toml`
  [5752ebe1] ~ GMT v0.41.2 `https://github.com/GenericMappingTools/GMT.jl.git#master` ⇒ v0.41.2 `https://github.com/GenericMappingTools/GMT.jl.git#master`
    Building GMT → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/96bd3bcb604f55bdf061ea4dc9d86a2dfadf76dd/build.log`
Precompiling project...
  1 dependency successfully precompiled in 12 seconds (10 already precompiled)

julia> using GMT

(@v1.7) pkg> test GMT
     Testing GMT
      Status `/private/tmp/jl_1rVGVy/Project.toml`
  [8f4d0f93] Conda v1.6.0
  [5752ebe1] GMT v0.41.2 `https://github.com/GenericMappingTools/GMT.jl.git#master`
  [ade2ca70] Dates `@stdlib/Dates`
  [44cfe95a] Pkg `@stdlib/Pkg`
  [de0858da] Printf `@stdlib/Printf`
  [10745b16] Statistics `@stdlib/Statistics`
  [8dfed614] Test `@stdlib/Test`
      Status `/private/tmp/jl_1rVGVy/Manifest.toml`
  [8f4d0f93] Conda v1.6.0
  [5752ebe1] GMT v0.41.2 `https://github.com/GenericMappingTools/GMT.jl.git#master`
  [682c06a0] JSON v0.21.2
  [69de0a69] Parsers v2.1.3
  [81def892] VersionParsing v1.2.1
  [0dad84c5] ArgTools `@stdlib/ArgTools`
  [56f22d72] Artifacts `@stdlib/Artifacts`
  [2a0f44e3] Base64 `@stdlib/Base64`
  [ade2ca70] Dates `@stdlib/Dates`
  [f43a241f] Downloads `@stdlib/Downloads`
  [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
  [b27032c2] LibCURL `@stdlib/LibCURL`
  [76f85450] LibGit2 `@stdlib/LibGit2`
  [8f399da3] Libdl `@stdlib/Libdl`
  [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
  [56ddb016] Logging `@stdlib/Logging`
  [d6f4376e] Markdown `@stdlib/Markdown`
  [a63ad114] Mmap `@stdlib/Mmap`
  [ca575930] NetworkOptions `@stdlib/NetworkOptions`
  [44cfe95a] Pkg `@stdlib/Pkg`
  [de0858da] Printf `@stdlib/Printf`
  [3fa0cd96] REPL `@stdlib/REPL`
  [9a3f8284] Random `@stdlib/Random`
  [ea8e919c] SHA `@stdlib/SHA`
  [9e88b42a] Serialization `@stdlib/Serialization`
  [6462fe0b] Sockets `@stdlib/Sockets`
  [2f01184e] SparseArrays `@stdlib/SparseArrays`
  [10745b16] Statistics `@stdlib/Statistics`
  [fa267f1f] TOML `@stdlib/TOML`
  [a4e569a6] Tar `@stdlib/Tar`
  [8dfed614] Test `@stdlib/Test`
  [cf7118a7] UUIDs `@stdlib/UUIDs`
  [4ec0a83e] Unicode `@stdlib/Unicode`
  [e66e0078] CompilerSupportLibraries_jll `@stdlib/CompilerSupportLibraries_jll`
  [deac9b47] LibCURL_jll `@stdlib/LibCURL_jll`
  [29816b5a] LibSSH2_jll `@stdlib/LibSSH2_jll`
  [c8ffd9c3] MbedTLS_jll `@stdlib/MbedTLS_jll`
  [14a3606d] MozillaCACerts_jll `@stdlib/MozillaCACerts_jll`
  [4536629a] OpenBLAS_jll `@stdlib/OpenBLAS_jll`
  [83775a58] Zlib_jll `@stdlib/Zlib_jll`
  [8e850b90] libblastrampoline_jll `@stdlib/libblastrampoline_jll`
  [8e850ede] nghttp2_jll `@stdlib/nghttp2_jll`
  [3f19e933] p7zip_jll `@stdlib/p7zip_jll`
     Testing Running tests...
6.4.0_710eb88_2022.04.24
WARNING: Wrapping `Vararg` directly in UnionAll is deprecated (wrap the tuple instead).
WARNING: Wrapping `Vararg` directly in UnionAll is deprecated (wrap the tuple instead).
		Entering: test_proj4.jl
Rel. 8.2.1, January 1st, 2022
Located at: /Users/pwessel/Library/Application Support/proj:/opt/local/lib/proj8/share/proj:/opt/local/lib/proj8/share/proj
		Entering: test_gd_ext.jl
		Entering: test_gdal.jl
┌ Info: GDAL 3.4.2, released 2022/03/08
│ 196 GDAL drivers found
└ 68 OGR drivers found
┌ Warning: Format not supported. Only TIF, PNG or netCDF are allowed. Resorting to TIF
└ @ GMT.Gdal ~/.julia/packages/GMT/kXs1H/src/gdal_tools.jl:304
ERROR 10: Pointer 'hBand' is NULL in 'GDALGetRasterDataType'.

ERROR 10: Pointer 'hBand' is NULL in 'GDALGetRasterDataType'.

ERROR 10: Pointer 'hBand' is NULL in 'GDALGetRasterDataType'.

Warning: the following options were not consumed in gdalvectortranslate => [:gdataset]
ERROR 6: Incompatible geometry for operation
ERROR 6: Incompatible geometry for operation
Geometry: POLYGON ((1198554.34 648493.09,1198553.65476738 64 ... .09))Layer: SELECT (100)
     Field 0 (HEX(GeomFromText('POINT(10 20)'))): [String], ...
	CUBES
Warning 1: dimension #2 (x) is not a Longitude/X dimension.
Warning 1: dimension #1 (y) is not a Latitude/Y dimension.
Warning 1: dimension #0 (z) is not a Time or Vertical dimension.
	WMS
serverURL:	http://tiles.maps.eox.at/wms?
OnlineResource:	http://tiles.maps.eox.at/?
version:	1.1.1
request:	GetMap
layernames:	["s2cloudless-2018_3857", "coastline", "s2cloudless-2020", "osm_3857", "s2cloudless_3857", "terrain_3857", "overlay_base_bright_3857", "hydrography", "graticules", "overlay_3857", "bluemarble", "coastline_black", "s2cloudless-2017_3857", "streets_3857", "overlay_bright", "s2cloudless-2019_3857", "overlay", "blackmarble_3857", "hydrography_3857", "streets", "s2cloudless-2017", "s2cloudless-2018", "s2cloudless-2019", "osm", "blackmarble", "terrain-light_3857", "bluemarble_3857", "overlay_base_3857", "s2cloudless", "terrain", "overlay_bright_3857", "coastline_3857", "s2cloudless-2020_3857", "magnetic_graticules", "terrain-light", "overlay_base_bright", "overlay_base"]

layer:	37 Layers. Use layer[k] to see the contents of layer k
name:	s2cloudless-2018_3857
title:	Sentinel-2 cloudless layer for 2018 by EOX - 3857
srs:	EPSG:900913
crs:	
bbox:	(-2.0037508342789e7, 2.0037508342789e7, -2.0037508342789e7, 2.0037508342789e7)
imgformat:	image/jpeg
tilesize:	256
overviewcount:	18
resolution:	0.5971642834779395
tiled:	true
transparent:	false
WMS:http://tiles.maps.eox.at/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=coastline&SRS=EPSG:4326&BBOX=-180,-90,180,90&FORMAT=image/png&TILESIZE=256&OVERVIEWCOUNT=17&MINRESOLUTION=0.00000536441803&TILED=true
		Entering: test_common_opts.jl


You don't seem to have GMT installed and the automatic installation also failed.
You will have to do it yourself.
Install GMT with Homebrew: brew install gmt ghostscript ffmpeg
COMMON OPTS: Test Failed at /Users/pwessel/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:7
  Expression: (GMT.parse_R(Dict(:region_llur => (1, 2, 3, 4)), ""))[1] == " -R1/3/2/4+r"
   Evaluated: " -R4/3.01554413563416e-314/5.21501763667823e-310/5.21501984560147e-310+r" == " -R1/3/2/4+r"
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined]
 [2] macro expansion
   @ ~/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:7 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:1282 [inlined]
 [4] top-level scope
   @ ~/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:3
COMMON OPTS: Test Failed at /Users/pwessel/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:13
  Expression: GMT.build_opt_R((limits = (1, 2, 3, 4), diag = 1)) == " -R1/3/2/4+r"
   Evaluated: " -R4/3.01554529767656e-314/3.01554342417963e-314/2.15998031077359e-314+r" == " -R1/3/2/4+r"
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined]
 [2] macro expansion
   @ ~/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:13 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:1282 [inlined]
 [4] top-level scope
   @ ~/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:3
COMMON OPTS: Test Failed at /Users/pwessel/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:68
  Expression: (GMT.parse_J(Dict(:J => (name = :albers, center = [10 20], parallels = [45 65])), "", "", false))[1] == " -JB10/20/45/65"
   Evaluated: " -JB20/3.39519326554e-313/45/65" == " -JB10/20/45/65"
Stacktrace:
 [1] macro expansion
   @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined]
 [2] macro expansion
   @ ~/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:68 [inlined]
 [3] macro expansion
   @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:1282 [inlined]
 [4] top-level scope
   @ ~/.julia/packages/GMT/kXs1H/test/test_common_opts.jl:3
┌ Warning: got this bad data type: Vector{Int64}
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:2299
┌ Warning: 'label' option must be a string or a NamedTuple. Since it wasn't I'm ignoring it.
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:2922
GMT [WARNING]: Max total memory allocated was 192.234 Mb [201572092 bytes]
GMT [WARNING]: Single largest allocation was 16.000 Mb [16777216 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 901 reallocated: 101 freed: 899
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
┌ Warning: Unknown units request (lolo) Ignoring it
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:2550
┌ Warning: Ignoring the 'aspect' request because fig's Width and Height already provided.
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:371
┌ Warning: Argument of the custom annotations must be an N-array or a NamedTuple
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:2603
┌ Warning: Very likely the projection name (blabla) is unknown to me. Expect troubles
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:532
┌ Warning: Empty units. Ignoring this units request.
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:2529
┌ Warning: Creating KML requires the use of a cartesian projection of geographical coordinates. Not your case
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:1773
┌ Warning: Unkown option "mum" in range option
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/makecpt.jl:132
┌ Warning: Numeric values of 'CTRL.limits' not available. Cannot use the 'guess' option (Must specify a projection)
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:578
Warning: the following options were not consumed in prog => [:lala]
Warning: the following options were not consumed in prog => [:lala]
┌ Warning: Justification code provided (aiai) is not valid. Defaulting to TopRight
└ @ GMT ~/.julia/packages/GMT/kXs1H/src/common_options.jl:3855
Option: n, or interp, or interpolation => (B_spline=?(b), bicubic=?(c), bilinear=?(l), near_neighbor=?(n), aliasing=Any(+a), antialiasing=Any(-a), bc=?(+b), clipz=Any(+c), threshold=?(+t), )
Option: G, or RIr, or V_params, or bi, or di, or e, or h, or i, or yx => (Common options)
Option: D, or duplicates => Tuple | String | Number | Bool [Possibly not yet expanded]
Option: Q, or tension => Tuple | String | Number | Bool [Possibly not yet expanded]
Option: T, or nodetable => Tuple | String | Number | Bool [Possibly not yet expanded]
Option: Z, or scale => Tuple | String | Number | Bool [Possibly not yet expanded]
   ==>  'wW' is not a valid option/module name, or its help is not yet implemented
   LastError ==>  'UndefVarError(:parse_wW)'
GMT [WARNING]: Max total memory allocated was 64.080 Mb [67192752 bytes]
GMT [WARNING]: Single largest allocation was 16.000 Mb [16777216 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 523 reallocated: 36 freed: 521
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Max total memory allocated was 20.711 kb [21208 bytes]
GMT [WARNING]: Single largest allocation was 10.766 kb [11024 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 150 reallocated: 10 freed: 148
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Max total memory allocated was 20.711 kb [21208 bytes]
GMT [WARNING]: Single largest allocation was 10.766 kb [11024 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 43 reallocated: 4 freed: 41
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Max total memory allocated was 19.422 kb [19888 bytes]
GMT [WARNING]: Single largest allocation was 10.766 kb [11024 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 9 reallocated: 3 freed: 7
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Max total memory allocated was 19.422 kb [19888 bytes]
GMT [WARNING]: Single largest allocation was 10.766 kb [11024 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 19 reallocated: 3 freed: 17
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Max total memory allocated was 15.391 kb [15760 bytes]
GMT [WARNING]: Single largest allocation was 10.766 kb [11024 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.062 kb [64 bytes]
GMT [WARNING]: Items allocated: 8 reallocated: 2 freed: 6
GMT [WARNING]: Items NOT PROPERLY FREED: 2
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
Error returned from GMT API: GMT_NOT_A_SESSION (29)
		Entering: test_B-GMTs.jl
	GMTINFO
gmt gmtset [core] 6.4.0_710eb88_2022.04.24 - Change individual GMT default settings

usage: gmt gmtset [-C | -D[s|u] | -G<defaultsfile>] [-B|J|R|X|Y|p<arg>] [-V[q|e|w|t|i|c|d]] PARAMETER1 value1 PARAMETER2 value2 PARAMETER3 value3
  ...

  Give pairs of PARAMETER value to change these settings. For available PARAMETERS, see gmt.conf documentation.
	BLOCK*s
	CONTOURF
GMT [WARNING]: Max total memory allocated was 192.018 Mb [201345048 bytes]
GMT [WARNING]: Single largest allocation was 96.000 Mb [100663296 bytes]
GMT [WARNING]: MEMORY NOT FREED: 0.094 kb [96 bytes]
GMT [WARNING]: Items allocated: 1445 reallocated: 135 freed: 1442
GMT [WARNING]: Items NOT PROPERLY FREED: 3
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 14): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 9): 0.031 kb [32 bytes]
GMT [WARNING]: Memory not freed first allocated in gmt_parse.c:955(GMT_Make_Option) (ID = 8): 0.031 kb [32 bytes]
	EARTHTIDE
GMT: Error During Test at /Users/pwessel/.julia/packages/GMT/kXs1H/test/runtests.jl:5
  Got exception outside of a @test
  LoadError: GMT: No module by that name -- earthtide -- was found.
  Stacktrace:
    [1] error(s::String)
      @ Base ./error.jl:33
    [2] gmt(::String)
      @ GMT ~/.julia/packages/GMT/kXs1H/src/gmt_main.jl:197
    [3] earthtide(cmd0::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ GMT ~/.julia/packages/GMT/kXs1H/src/geodesy/earthtide.jl:29
    [4] earthtide (repeats 2 times)
      @ ~/.julia/packages/GMT/kXs1H/src/geodesy/earthtide.jl:15 [inlined]
    [5] top-level scope
      @ ~/.julia/packages/GMT/kXs1H/test/test_B-GMTs.jl:39
    [6] include(fname::String)
      @ Base.MainInclude ./client.jl:451
    [7] macro expansion
      @ ~/.julia/packages/GMT/kXs1H/test/runtests.jl:55 [inlined]
    [8] macro expansion
      @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Test/src/Test.jl:1282 [inlined]
    [9] top-level scope
      @ ~/.julia/packages/GMT/kXs1H/test/runtests.jl:7
   [10] include(fname::String)
      @ Base.MainInclude ./client.jl:451
   [11] top-level scope
      @ none:6
   [12] eval
      @ ./boot.jl:373 [inlined]
   [13] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:268
   [14] _start()
      @ Base ./client.jl:495
  in expression starting at /Users/pwessel/.julia/packages/GMT/kXs1H/test/test_B-GMTs.jl:39
Test Summary: | Pass  Fail  Error  Total
GMT           |  275     3      1    279
  PROJ4       |    3                   3
  GDALext     |   44                  44
  GDAL        |   23                  23
  COMMON OPTS |  205     3           208
ERROR: LoadError: Some tests did not pass: 275 passed, 3 failed, 1 errored, 0 broken.
in expression starting at /Users/pwessel/.julia/packages/GMT/kXs1H/test/runtests.jl:5
ERROR: Package GMT errored during testing

@PaulWessel

Copy link
Copy Markdown
Contributor Author

As for @seisman I will have to do this on the Intel machine:

dlopen(/Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/xbuild/src/Debug/libgmt.dylib, 0x0006): tried: '/Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/xbuild/src/Debug/libgmt.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/Users/pwessel/UH/RESEARCH/CVSPROJECTS/GMTdev/gmt-dev/xbuild/src/Debug/libgmt.6.4.0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

@PaulWessel

Copy link
Copy Markdown
Contributor Author

OK. reinstalled miniconda for arm and got further this time. Perhaps @seisman can help with this:

cd tmp-test-dir-with-unique-name; PYGMT_USE_EXTERNAL_DISPLAY="false" pytest --cov=pygmt --cov-config=../pyproject.toml --cov-report=term-missing --cov-report=xml --cov-report=html --pyargs  --doctest-plus pygmt
/bin/sh: pytest: command not found
make: *** [test] Error 127

@seisman

seisman commented Apr 25, 2022

Copy link
Copy Markdown
Member

OK. reinstalled miniconda for arm and got further this time. Perhaps @seisman can help with this:

cd tmp-test-dir-with-unique-name; PYGMT_USE_EXTERNAL_DISPLAY="false" pytest --cov=pygmt --cov-config=../pyproject.toml --cov-report=term-missing --cov-report=xml --cov-report=html --pyargs  --doctest-plus pygmt
/bin/sh: pytest: command not found
make: *** [test] Error 127

You can change into your pygmt directory, open the environment.yml file and remove gmt=6.3.0 at line 8, because you want to use your local GMT dev version.

  1. Run the following command to install required packages in an isolated environment (the environment is called pygmt):
conda env create -f environment.yml
  1. Activate the environment:
conda activate pygmt
  1. Install PyGMT in the environment:
make install
  1. Run the tests:
make test

@PaulWessel

Copy link
Copy Markdown
Contributor Author

I had already activated pygmt so got this:

conda env create -f environment.yml

CondaValueError: prefix already exists: /Users/pwessel/miniconda3/envs/pygmt

How to undo my activation and rerun taht one?

@seisman

seisman commented Apr 25, 2022

Copy link
Copy Markdown
Member

Do this first:

conda deactivate
conda remove --name pygmt --all

@PaulWessel

Copy link
Copy Markdown
Contributor Author

OK done, but

conda env create -f environment.yml
Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - dvc

@seisman

seisman commented Apr 25, 2022

Copy link
Copy Markdown
Member

It should be available in conda-forge. Can you try conda config --add channels conda-forge before run conda env create -f environment.yml?

@PaulWessel

Copy link
Copy Markdown
Contributor Author

Had already done that per debug instructions. I think I installed it via pip in the past (for use with CLI GMT testing).

@seisman

seisman commented Apr 25, 2022

Copy link
Copy Markdown
Member

Maybe you can remove dvc from environment.yml.

@PaulWessel

Copy link
Copy Markdown
Contributor Author

OK, installing now. Will test when done.

@joa-quim

joa-quim commented Apr 25, 2022 •

Copy link
Copy Markdown
Member

You don't seem to have GMT installed and the automatic installation also failed.

The Julia tests are too verbose but I can't find a way of making more silent. The above is confusing because what is tested is the code that prints that message. So the test worked well because that message was printed. Same happens with several other printed messages where I'm testing the conditions that lead to those messages printings.

But you have 3 real failures. One is because you don't seem to have earthtide and the other two are strange.

Expression: (GMT.parse_J(Dict(:J => (name = :albers, center = [10 20], parallels = [45 65])), "", "", false))[1] == " -JB10/20/45/65"
   Evaluated: " -JB20/3.39519326554e-313/45/65" == " -JB10/20/45/65"

...

Expression: (GMT.parse_R(Dict(:region_llur => (1, 2, 3, 4)), ""))[1] == " -R1/3/2/4+r"
   Evaluated: " -R4/3.01554413563416e-314/5.21501763667823e-310/5.21501984560147e-310+r" == " -R1/3/2/4+r"

Can't see why this only happens to you (The Mac CI tests parse these fine).

@PaulWessel

Copy link
Copy Markdown
Contributor Author

Thanks, test all ran; got

================== 192 failed, 363 passed, 2 skipped, 2 xfailed, 2 xpassed, 27 warnings in 66.25s (0:01:06) ===================

and one tiny pdf plot opened up - possibly a test with a show?

@PaulWessel

Copy link
Copy Markdown
Contributor Author

My xbuild directory in fact does not have a supplemental.so. But I have debugged supplements (a lot) but there are always issues: e.g., if I make changes to a supplement and run debug again it does not rebuild those modules and hence it is all bonkers in debugging. I have to rebuild the entire thing (slow) and start again. Painful - so getting motivated to switch to VSC.

@seisman

seisman commented Apr 25, 2022

Copy link
Copy Markdown
Member

Thanks, test all ran; got

================== 192 failed, 363 passed, 2 skipped, 2 xfailed, 2 xpassed, 27 warnings in 66.25s (0:01:06) ===================

and one tiny pdf plot opened up - possibly a test with a show?

You need to run dvc pull first to download the baseline images, then the failures will be reduced to ~60.

@PaulWessel

Copy link
Copy Markdown
Contributor Author

Getting there:

============================ 92 failed, 463 passed, 2 skipped, 2 xfailed, 2 xpassed, 27 warnings in 67.83s (0:01:07) =============================

@PaulWessel

Copy link
Copy Markdown
Contributor Author

Nevermind about Xcode and supplements.so - it is built. And earthtide is in it.

@joa-quim

Copy link
Copy Markdown
Member

That message is printed when

	# Make sure this is a valid module
	if ((status = GMT_Call_Module(G_API[1], g_module, GMT_MODULE_EXIST, C_NULL)) != 0)
		error("GMT: No module by that name -- " * g_module * " -- was found.")
	end

so the earthtide module was not found by GMT.

And, apparently you don't et this (that runs only Julia code, no GMT calls)?

GMT.parse_J(Dict(:J => (name = :albers, center = [10 20], parallels = [45 65])), "", "", false)[1]
" -JB10/20/45/65"

@PaulWessel

Copy link
Copy Markdown
Contributor Author

I get

" -JB20/3.39519326554e-313/45/65"

@PaulWessel

PaulWessel commented Apr 25, 2022 •

Copy link
Copy Markdown
Contributor Author

Maybe some fun M1 Apple Silicon and Julia issues?

@joa-quim

Copy link
Copy Markdown
Member

So it's shifting the lon/lat. It puts lat in place of lon and trash in place of lon.
Does it make any difference if using vectors instead of matrices? I.e

GMT.parse_J(Dict(:J => (name = :albers, center = [10, 20], parallels = [45, 65])), "", "", false)[1]

@PaulWessel

Copy link
Copy Markdown
Contributor Author

No, same.

@joa-quim

Copy link
Copy Markdown
Member

and?

val = (1,2,3,4);

GMT.sprintf("%.15g/%.15g/%.15g/%.15g+r", val[1], val[3], val[2], val[4])
"1/3/2/4+r"

@PaulWessel

Copy link
Copy Markdown
Contributor Author

"4/3.01255753647272e-314/3.01255754042525e-314/2.36141770257029e-314+r"

@joa-quim

Copy link
Copy Markdown
Member

So this is the same problem as the parse_J. For some forgotten reason I'm calling directly the C lib to do sprintf and it calls the asprintf function that is screwing in the M1.

@joa-quim

Copy link
Copy Markdown
Member

But this works?

@sprintf("%.15g/%.15g/%.15g/%.15g+r", val[1], val[3], val[2], val[4])
"1/3/2/4+r"

@PaulWessel

Copy link
Copy Markdown
Contributor Author

julia> @sprintf("%.15g/%.15g/%.15g/%.15g+r", val[1], val[3], val[2], val[4])
ERROR: LoadError: UndefVarError: @sprintf not defined
in expression starting at REPL[13]:1

@joa-quim

Copy link
Copy Markdown
Member

That's because you didn't run the command from a window where GMT has been loaded (that loads Printf)

using Printf
val = (1,2,3,4);
@sprintf("%.15g/%.15g/%.15g/%.15g+r", val[1], val[3], val[2], val[4])

@PaulWessel

Copy link
Copy Markdown
Contributor Author

OK, works
"1/3/2/4+r"

@PaulWessel

Copy link
Copy Markdown
Contributor Author

That's because you didn't run the command from a window where GMT has been loaded (that loads Printf)

It was in a window that started with "using GMT". Is that different than "loading"?

@joa-quim

Copy link
Copy Markdown
Member

The GMT.jl starts with

using Printf, Dates, Statistics, Pkg

so, after doing using GMT we have the Printf module loaded (by the using Printf) and we can do directly.

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.0 (2021-11-30)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using GMT
julia> val = (1,2,3,4);
julia> @sprintf("%.15g/%.15g/%.15g/%.15g+r", val[1], val[3], val[2], val[4])
"1/3/2/4+r"

I think Steve Jobs is picking on you.

@PaulWessel

Copy link
Copy Markdown
Contributor Author

No go here: Starting a new julia window:

julia> using GMT

julia> val = (1,2,3,4);

julia> @sprintf("%.15g/%.15g/%.15g/%.15g+r", val[1], val[3], val[2], val[4])
ERROR: LoadError: UndefVarError: @sprintf not defined
in expression starting at REPL[3]:1

@joa-quim

Copy link
Copy Markdown
Member

Ah, yes you re right. This time it was not Steve. I forgot that I have added it to my startup.jl file (in the .julia/config dir) so I always have those packages loaded by default. Revise is a very useful package to have. It will take care to update any modification one do to package files without having to restart Julia for them to take effect.

using Revise, Dates, Printf

@PaulWessel

Copy link
Copy Markdown
Contributor Author

OK, so tests fail because the Printf was not in the official setup then

@PaulWessel

Copy link
Copy Markdown
Contributor Author

Wrong thread earlier. I did the up that you said and tried teh @Sprint again without manually loading Printf and that did not work. I thought you meant you had updated GMT.jl to load Printf so taht I would not have to.

@joa-quim

Copy link
Copy Markdown
Member

No, I meant to run all test again. To run @sprintf you need indeed to do using Printf or GMT.@sprintf(...)

@joa-quim

Copy link
Copy Markdown
Member

OK, so tests fail because the Printf was not in the official setup then

No. The tests failed because M1 was not able to run correctly the sprintf function (not the Julia @sprintf macro) that I wrote and that calls the asprintf function of the C standard lib. So I now call only the @sprintf macro.

@PaulWessel

Copy link
Copy Markdown
Contributor Author

ok tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

grdinfo cube broken in Julia

3 participants