Page 2 of 2

Re: building new color tables from ascii text?

Posted: Wed Apr 21, 2021 7:31 pm
by bobc
Hi Joleen,

There are no updates to report with inquiry 2385. I spent some time experimenting in the Jython Shell and discovered how you can apply min/max values after importing an enhancement. Here's how that works:

Code: Select all

a = importEnhancement('C:/Users/rcarp/joleen_enhancements/clavrx_cloud_type.cmap', 'NAME4', 'CATEGORY')
enh = a.getJavaInstance()
enh.setRange(ucar.unidata.util.Range(0, 14))
From the Jython Shell, you can run:

Code: Select all

print(see(enh))
This will print out the different commands you can run on the "enh" data object. Note that there is a function called "setBreakpoints", but I haven't been able to get it to work successfully yet. I tried running it as:

Code: Select all

enh.setBreakpoints(java.util.ArrayList([1.0,2.0,3.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0]))
While this doesn't error and the lister function returns a list of breakpoints:

Code: Select all

print(enh.getBreakpoints())
> [1.0, 2.0, 3.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0]
if I go to the Color Table Editor and open the enhancement I can see the min/max (0 / 14) values set earlier, but no breakpoints are drawn in the enhancement.

Hopefully this is enough information to help you going forwards, but please let me know if you have any other problems/questions.

Thanks,
Bob

Re: building new color tables from ascii text?

Posted: Sat Apr 09, 2022 2:10 am
by ghansham
I will post the code long time ago that I wrote to generate linear color table
using color list and break point list (break points placed un-evenly).
We need a gui where we have a table which has two columns.
1. Break point
2. Color value.
And break points should be strictly either in ascending or descending order.
Then we can use the code I post to generate the visad compatible color table.


Meanwhile please have a look on colour maps here:
https://reading-escience-centre.gitbook ... e/content/

It has defined colour maps based on functions.
Thredds uses wms services of ncwms.
And ncwms uses edal in backend for image generation.

We can use this approach also. Its pretty elegant and very much standardized.
Author is Guy griffiths. I must say has done this part very nicely.

Re: building new color tables from ascii text?

Posted: Thu Apr 14, 2022 8:18 pm
by bobc
Thanks for your input, Ghansham. I added your comments to inquiry 2385.

Bob Carp