Hello, I recently set a pygmt environment on a new machine. I used anaconda and the version 0.3.0 package available on condaforge (conda install -c conda-forge pygmt=0.3.0).
I was running a script that uses the transparency option ( fig.grdimage(imageFile.data,C="shakemap_pgv_mks.cpt",t=60))
and I got the following warning:
psconvert [WARNING]: Input file has transparency but your gs version 9.52 has a bug preventing it - please downgrade to 9.50
And sure enough the transparency option was ignored and the plot was generated without the required transparency.
My question is how can I downgrade gmt (and thus psconvert) to an older version that supports the transparency option?
I tried conda install -c conda-forge gmt=6.1.1 but I still get the same error.
This will reproduce the error (if you create an fresh anaconda enviroment using the current version 0.3.0 of gmt in anaconda forge).
import pygmt
import pandas as pd
import xarray as xr
import numpy as np
### constants
sw4origin = (39.3058,-120.0052)
#sw4Xlength,sw4Ylength = 34000,34000 #in meters
#figure out the end of my region based on these dimenstions
#sw4OriginUTM = utm.from_latlon(sw4origin[0],sw4origin[1],11,"N")
#sw4EndX,sw4EndY = sw4OriginUTM[1]+sw4Xlength,sw4OriginUTM[0]+sw4Ylength
sw4EndLat,sw4EndLong = (39.62135044626656, -119.62277186293804)
region = [-120.0052,sw4EndLong,39.3058,sw4EndLat]
lat0,lon0=(39.310047, -119.999954)
latend,lonend = (39.610416, -119.61958)
### generate 2 fake xarrays
sampleXarray = np.zeros(shape=(128,145),dtype=np.float32)
for i in range(sampleXarray.shape[0]):
for j in range(sampleXarray.shape[1]):
sampleXarray[i,j] = i+j
underlayedXarray = np.copy(sampleXarray)
sampleXarray = np.abs(np.sin(sampleXarray))
#plt.imshow(sampleXarray)
#correctly georeference these fake xarray
xcoords = np.arange(lat0,latend,(latend-lat0)/sampleXarray.shape[0])
ycoords = np.arange(lon0,lonend,(lonend-lon0)/sampleXarray.shape[1])
dims = ['x','y']
coords = {"x":xcoords,"y":ycoords}
sampleXarray = xr.DataArray(sampleXarray,dims=dims,coords=coords)
underlayedXarray = xr.DataArray(underlayedXarray,dims=dims,coords=coords)
#attempt to plot, show that transparency is ignored
fig = pygmt.Figure()
fig.basemap(region=region,projection="M8i", frame=True)
#plot the underlying xarray (in my real problem this would be my hillshade)
fig.grdimage(underlayedXarray,C="gray")
pygmt.makecpt(cmap="viridis", series=[0.0, np.max(sampleXarray.data)], continuous=True)
fig.grdimage(sampleXarray, C=True, t=60)
fig.show()
Thank You,