Get and change map object colormap to custom one through GX

Hi.

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?
Anyway.
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))
mapnames=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 gxmap.Map.open(map) as gmap:
with gxview.View.open(gmap, "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
https://geosoftgxdev.atlassian.net/wiki/spaces/GXD93/pages/108528042/2D+Views+and+Maps

also says nothing about how to do a colormap

Any help?
Tagged:

Comments

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

    import geosoft.gxpy.gx as gx
    import geosoft.gxpy.map as gxmap
    import geosoft.gxpy.view as gxview
    import geosoft.gxpy.group 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

    p_colormap=Geosoft\\Grids\\Profiles\\IP_bell.zon'
    filtterm='IP_'

    gxc = gx.GXpy()
    path='Geosoft\\'
    maplist=glob.glob(path+'*.map')

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

    for maps in IP_maps:
    #print(maps)
    with gxmap.Map.open(maps) as gmap:
    with gxview.View.open(gmap, "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 gxpy.group.Color_map instance and the gxagg property of an Aggregate_image.

    Regards,
    Jacques Beaurain

This discussion has been closed.