CDAT / vcs

Visualization Control System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"VCS" module produces missing values?

leiduan4320 opened this issue · comments

Dear all,

I am using cdat8 "VCS" module to plot a map. My data has a horizontal resolution of 192 latitude by
288 longitude;

I only want to show part of the may, so I wrote in my script:

v=vcs.init(); v.setcolormap('rainbow_no_grn')
color_map=v.getisofill('quick')
print color_map.list()
color_map.projection = 'linear'
color_map.datawc_x1= -20
color_map.datawc_x2= 50
color_map.datawc_y1= -50
color_map.datawc_y2= 50

However, "VCS" shows no value between longitude -1.25 to 0 (plot attached). Is there any way to fix this problem?

Best

som_pe_tre

I searched and found that this issue has been reported previously: "CDAT/cdat#2122"

Any solution available?

Also, as mentioned in that thread and tested here, the boxfill method does not have such a problem.

However, when I use the boxfill method, the "box.levels=[]" and "box.fillareacolors=[]" cannot work (vcs just uses the default range and fillareacolor)

@lei4320 this is likely due to your input data not being recognized as wrapping, this can be due to bad bounds on your longitude.
If you could point me to your input/plot data I could take a look.
In the mean time you can try to "fix" the data

lon = data.getLongitude()
lon.designateCircular(360.)
x.plot(data)

Please let me knowmif that fixes your issue.

Also please send me the output of:

lon = data.getLongitude()
print(lon.isCircular())
print(lon.getBounds())

@lei4320 for boxfill to use levels you need to set its type to custom

b = vcs.createboxfill()
b.boxfill_type
b.boxfill_type = 'custom'

@lei4320 please see: https://cdat.llnl.gov/Jupyter/boxfill/boxfill.html for more info on how to use boxfill. Also lots of interesting tips at: https://cdat.llnl.gov/tutorials.html

Sorry for responding late. The mentioned way above does not seem to work for me. But I have fixed this problem manually by adding an additional column in my data as well as the longitude.

Another issue I am stilling trying to understand is that (not sure if it's related to vcs), when I tried to plot parts of the map by setting "datawc" and saved in *.ps format, sometimes the figure is damaged and cannot be opened correctly by the illustrator.

Thanks very much.

I noticed issue with ghostscript being too old to open ps sometimes. Never tried with illustrator. Could you please attach an example of damaged postscript, it might help us track an issue.

Hi,

one example of the damaged plot is attached. I also attached the data and script.

# Script starts from here---
f=cdms.open('sample_data.nc')
data=f('sample_data')
hatch=f('sample_hatch')

color_map = v.createisofill()
hatch_map = v.createisofill()
hatch_map.fillareastyle='hatch'
hatch_map.fillareaindices=[12]
hatch_map.levels = [-0.5,0.5]
hatch_map.fillareacolors= ['grey']

color_map.datawc_x1= -20 #1e+20
color_map.datawc_x2= 50 #1e+20
color_map.datawc_y1= -50 #1e+20
color_map.datawc_y2= 50 #1e+20
hatch_map.datawc_x1= -20 #1e+20
hatch_map.datawc_x2= 50 #1e+20
hatch_map.datawc_y1= -50 #1e+20
hatch_map.datawc_y2= 50 #1e+20

color_map.levels=[-1e20,-1.1,-0.9,-0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9,1.1,1e20]
color_map.fillareacolors=[60,70,80,90,100,110,240,170,190,190,200,210,220]
v.plot(data,color_map)
v.plot(hatch,hatch_map)
v.postscript('fix_pe_wat')
v.close()

data_and_plots.zip