Get and change map object colormap to custom one through GX


Since changing colormaps(for example for comparative profiles) is a chore in Geosoft, I am scripting a GX to do it.
Changing one colormap that is not in the standard folder and a zone file is about... 15 clicks? More?
Pretty much first GX.

I got a list of my maps and I filtered it for the ones I need

def rungx():
project = gxpj.Geosoft_project()
gxc = gx.GXpy()
gxpj.user_message("Maps","Maps: {}".format(project.project_maps))
IP_maps=filter(lambda x: 'IP_' in x, mapnames)
for map in IP_maps:
gxpj.user_message("Maps","Maps: {}".format(map))
with as gmap:
with, "data") as v:

BUT I can't find anything in the documentation that allows me to get the grid and its colormap, nevertheless change it.
Sadly, the tutorial here

also says nothing about how to do a colormap

Any help?


  • With this code I have been able to get the maps loaded so far

    import geosoft.gxpy.gx as gx
    import as gxmap
    import geosoft.gxpy.view as gxview
    import as gxgroup
    import geosoft.gxpy.agg as gxagg
    import geosoft.gxpy.grid as gxgrd
    import geosoft.gxpy.viewer as gxviewer
    import geosoft.gxpy.project as gxpj

    import glob


    gxc = gx.GXpy()

    IP_maps=filter(lambda x: filtterm in x, maplist)

    for maps in IP_maps:
    with as gmap:
    with, "data") as v:
    with gxgroup.Color_map(cmap=p_colormap) as g:
    Here is where I don't know howto change the color map
  • Hi Dietmar,

    Groups in map views that visualize grids are called aggregates in the API. You can get a list of these groups in a view via the group_list_agg method. Each layer in the aggregate has a color map.

    Currently changing the color map is not exposed via the gxpy API but it is available in the lower level gxapi API via set_layer_itr. You can get at the lower level objects via the gxitr property (undocumented) of a instance and the gxagg property of an Aggregate_image.

    Jacques Beaurain

This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!