diff --git a/src/gmtreadwrite.jl b/src/gmtreadwrite.jl index a1eeb2809d..9df81a9b44 100644 --- a/src/gmtreadwrite.jl +++ b/src/gmtreadwrite.jl @@ -49,7 +49,7 @@ When files are multiband or nc files with 3D or 4D arrays, we access them via th grid, layer can be a scalar (to read 3D arrays) or an array of two elements (to read a 4D array). If file is an image `layer` can be a 1 or a 1x3 array (to read a RGB image). Not that in this later case -bands do not need to be contiguous. A `band=[1,5,2]`` composes an RGB out of those bands. See more at +bands do not need to be contiguous. A `band=[1,5,2]` composes an RGB out of those bands. See more at $(GMTdoc)/GMT_Docs.html#modifiers-for-coards-compliant-netcdf-files) but note that we use **1 based** indexing here. - $(GMT._opt_R) diff --git a/src/makecpt.jl b/src/makecpt.jl index 2240c9537a..77532501d6 100644 --- a/src/makecpt.jl +++ b/src/makecpt.jl @@ -85,9 +85,17 @@ end function makecpt(G::GMTgrid; equalize=false, kw...) # A version that works on grids. # equalize = true uses default grd2cpt. equalize=n uses grd2cpt -Tn # The kw... are those of makecpt or grd2cpt depending on 'equalize'. - cpt = ((val = find_in_kwargs(kw, CPTaliases)[1]) === nothing) ? (G.cpt != "") ? G.cpt : :turbo : nothing + + val, symb = find_in_kwargs(kw, CPTaliases) + cpt = (val === nothing) ? (G.cpt != "") ? G.cpt : :turbo : nothing + d = Dict{Symbol, Any}() + if (equalize == 0 && symb != Symbol() && val === nothing && cpt !== nothing) + # It means kw have a -C, but it can be a C=nothing. Remove the duplicate that was in kw. + d = KW(kw...); delete!(d, symb) # This confusion is due to the crazziness possible in lelandshade() + end if (equalize == 0) - makecpt(T=@sprintf("%.12g/%.12g/256+n", G.range[5]*(1-0.001), G.range[6]*(1+0.001)), C=cpt, kw...) + t = isempty(d) ? kw : d + makecpt(; T=@sprintf("%.12g/%.12g/256+n", G.range[5]*(1-0.001), G.range[6]*(1+0.001)), C=cpt, t...) else (equalize == 1) ? grd2cpt(G, C=cpt, kw...) : grd2cpt(G, T="$equalize", C=cpt, kw...) end diff --git a/src/rasterpolygonfuns.jl b/src/rasterpolygonfuns.jl index e03963eeaa..27cb729a4c 100644 --- a/src/rasterpolygonfuns.jl +++ b/src/rasterpolygonfuns.jl @@ -87,13 +87,13 @@ is large (think Russia size) because even at a moderately resultion it can imply - `img`: the image from which the stats (`fun`) of each color for each polygon will be computed. - `url`: In case the `img` option is not used, pass the Web Map Server URL (see the `wmsinfo` and `wmsread` functions) from where the the images covering the BoundingBox of each polygon will be downloaded. Warning, this is a much slower - method but potentially usefull when the images to download risk to be very big. + method but potentially useful when the images to download risk to be very big. - `layer`: When the `url` option is used this one becomes mandatory and represents the layer number or layer name of - interest from those provided by the WMS service. That is, both of these forms are allowed: `layer=3` or + interest from those provided by the WMS service. That is, both forms are allowed: `layer=3` or `layer="Invented layer name"` - `pixelsize`: Sets the requested cell size in meters [default]. Use a string appended with a 'd' (e.g. `resolution="0.001d"`) if the resolution is given in degrees. This way works only when the layer is in geogs. -- `append`: By default the color assignement to each of the polygons in the `shapes` vector is achieved by +- `append`: By default, the color assignment to each of the polygons in the `shapes` vector is achieved by appending the fill color to the possibly existing header field. Running the `colorzones` command more than once keeps adding (now ignored, because only the first is used) colors. Setting `append=false` forces rewriting the header field at each run and hence the assigned color is always the one used (but the previous header is cleared out). diff --git a/src/utils_types.jl b/src/utils_types.jl index 27798ead8f..f8f3eaee2d 100644 --- a/src/utils_types.jl +++ b/src/utils_types.jl @@ -1041,7 +1041,7 @@ result (that we easily do with `imshow(mat)`) but return instead a GMTimage obje - `clim`: Specify clims as a two-element vector of the form [cmin cmax], where values of the scaled image less than or equal to cmin are assigned that value. The same goes for cmax. - - `cmap`: If provided, `cmap` is a GMTcpt and its contents is converted to the `GMTimage` colormp. + - `cmap`: If provided, `cmap` is a GMTcpt and its contents is converted to the `GMTimage` colormap. - `GI`: This can be either a GMTgrid or a GMTimage and its contents is used to set spatial contents (x,y coordinates) and projection info that one may attach to the created image result. This is a handy alterative to the `x=, y=, proj4=...` options. diff --git a/test/test_misc.jl b/test/test_misc.jl index 5315b05165..f06e4f4dd4 100644 --- a/test/test_misc.jl +++ b/test/test_misc.jl @@ -42,6 +42,7 @@ getindex(G1,1:2); setindex!(G1, [-1 -1],1:2) size(G1) + size(GMT.GMTcpt()) flipud(G) fliplr(G) flipdim(G.z,1)