GMT.jl icon indicating copy to clipboard operation
GMT.jl copied to clipboard

grdinterpolate in test_cube.jl

Open einzigsue opened this issue 2 years ago • 3 comments

Hi @joa-quim,

May I ask what this line https://github.com/GenericMappingTools/GMT.jl/blob/168234db04d49f551f6b29899a90dd8f4da91159/test/test_cube.jl#L19 is expected to do?

Does it need more arguments? When running in the test, it throws error message

grdinterpolate [ERROR]: Data cube read but none of -E, -S -T were given

Here is my versioinfo

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.2.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)

BTW, when I look into the file U.nc, it says "GMT_version=6.4.0", I thought the latest one is 6.3.0.

$ ncdump -h [U.nc](http://u.nc/)

netcdf U {

dimensions:

x = 41 ;

y = 35 ;

z = 15 ;

variables:

double x(x) ;

x:long_name = "x" ;

x:actual_range = 69.38649, 135.10129 ;

x:axis = "X" ;

double y(y) ;

y:long_name = "y" ;

y:actual_range = 16.874901, 60.624901 ;

y:axis = "Y" ;

double z(z) ;

z:actual_range = -0.002, 16. ;

float cube(z, y, x) ;

cube:long_name = "z" ;

cube:_FillValue = NaNf ;

cube:actual_range = -13.7181234359741, 78.2132797241211 ;



// global attributes:

:Conventions = "CF-1.7" ;

:title = "" ;

:history = "gmt grdinterpolate --IO_NC4_CHUNK_SIZE=35,41 -n+a -[GUU.nc](http://guu.nc/) @GMTAPI@-S-I-U-U-U-N-000072" ;

:description = "" ;

:GMT_version = "6.4.0_b890342-dirty_2022.04.26 [64-bit] [MP]" ;

:node_offset = 1 ;

Cheers, Yue

einzigsue avatar May 23 '22 06:05 einzigsue

Hmm, it looks I forgot to wrap those tests under a if GMTver >= v"6.4.0". The line U = grdinterpolate("U.nc"); now (in GMT 6.4dev) reads the entire cube in memory. And you see the

:GMT_version = "6.4.0_b890342-dirty_2022.04.26 [64-bit] [MP]"

because that file was created with GMT's development version.

Note, you can read the cube with U = grdalread("U.nc"); but the layers are transposed in x,y (scanline instead of column-major). But the streamline functions should be able to recognize that and deal with it.

joa-quim avatar May 23 '22 13:05 joa-quim

Hi @joa-quim,

Thank you for the prompt reply. I will then skip the tests in test_cube.jl or revert back to v0.41.2 for now as I am using GMTver == v"6.3.0".

BTW, I didn't find grdalread in GMT v0.42.0. """ julia> using GMT julia> :grdalread in names(GMT) false julia> :grdinterpolate in names(GMT) true """

Cheers, Yue

einzigsue avatar May 24 '22 04:05 einzigsue

Sorry, it was a typo and a mistake. A typo because the correct name is gdalread. A mistake because that function still has troubles to tell apart raster and vector data. What works is gdaltranslate("U.nc")

joa-quim avatar May 24 '22 09:05 joa-quim