Conversation
If you ceate a mask grid (NaN and 1) and want to see how it looks iin grdimage you get this annoyuance: (base) pwessel@MacAttack-> gmt grdimage E_obl_inside_mask.grd -B -pdf t grdimage [ERROR]: Passing zmax <= zmin prevents automatic CPT generation! grdimage [ERROR]: Failed to read CPT (null). psconvert [ERROR]: Unable to decode BoundingBox file /Users/pwessel/.gmt/sessions/gmt_session.11534/psconvert_30470c.bb (maybe no non-white features were plotted?) and a failed plot. The reason is that xmin = zmax = 1 and no CPT can be crafted. Since this is a common situation, this PR allwos for this by checking if We have a grid with NaNs The rest of the data are all 1.0 If so it sets the internal zmax to 2 so that we get a map when no CPT is given.
Esteban82
left a comment
There was a problem hiding this comment.
Approving without testing (in case you need it).
Let me know if you have a grid to test it.
|
Sure: |
Thanks. I will merge it because it works. |
|
Why not increase zmax by one for all zmin=zmax grids? |
|
Hm, yes I see where you are going with this. It is very possible that a user could create a grid that is constant, say 4.67. Then what? Well, we then get the annoying message. But having a constant grid is not a sin that requires lecturing by us. SO I agree, we should extend this to any grid, mask or not, and without having more info, just add 1. |
|
Assuming that is what you meant, I will make another PR that is more general and does this inside the gmt_get_pallete instead. |
Yes, that's exactly what I mean. But adding 1 may not a good idea for small grid values like zmin=zmax=1.0e-5. Perhaps zmax = 2 * zmin is better? |
|
Yes, but depends on the sign I think |
This PR overwrites the changes in #6930 following the discussion therein. A mask grid is just a special case of a constant grid and such grids are allowed. However, without upgrading the automatic CPT creation for grids with zero range we run into trouble. This PR always produces a valid CPT for grids with no range.
This PR overwrites the changes in #6930 following the discussion therein. A mask grid is just a special case of a constant grid and such grids are allowed. However, without upgrading the automatic CPT creation for grids with zero range we run into trouble. This PR always produces a valid CPT for grids with no range.
If you create a mask grid (NaN and 1) and want to see how it looks in grdimage you get this annoyance:
and a failed plot. The reason is that zmin = zmax = 1 and no CPT can be crafted. Since this is a common situation, this PR allows for this by checking if
If so we have a NaN mask and we can then set the internal zmax to 2 so that we get a map when no CPT is given.