Couple of features

Post ideas for new functionality you'd like to see in McIDAS-V or ideas for new tutorials.
User avatar
ghansham
Posts: 175
Joined: Thu Nov 11, 2010 5:40 pm

Re: Couple of features

Post by ghansham »

Hi Sir,
I will send you the files tomorrow.
Ghansham
User avatar
ghansham
Posts: 175
Joined: Thu Nov 11, 2010 5:40 pm

Re: Couple of features

Post by ghansham »

Hi All

Some more additions. I have added some more options to control the fonts of Axis Labels.
And another one is that xaxis options of lat/lon/dist also work for DataTransect. I have disabled
yaxis options as it cant be pressure/altitude.
Another interesting bug that I encountered was that when we try to change vertical range in
cross-section views and click "From All Data" in Predefined it actually picks the range of the parameter
and not of the vertical axis. Anyways I have posted that query on IDV forum.
Meanwhile I also tried to fix it for time being;-)...

Another major change I have done in change Vertical Range is that when Auto-Scale is checked,
the "Change" Vertical Range Button remains disabled. The user can change range only when
Auto-Scale is unchecked. This is the way I am thinking.
If anybody thinks this is not correct. Just let me know.

Attached herewith a snapshots showing transect as well font control.

The yaxis scale font color is different from xaxis font color. That is another issue.

regards
Ghansham
Attachments
Cross-Section showing font control
Cross-Section showing font control
This file shows data transect with latitude on xaxis. Also given some control to the user to change axis fonts.
This file shows data transect with latitude on xaxis. Also given some control to the user to change axis fonts.
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: Couple of features

Post by joleenf »

Hi Ghansham,

I am often creating individual images of cross sections to combine into a movie. For those, I often have to type in the lat/lon endpoints manually in the layer controls. If I make a mistake, this can be a time consuming process. After working with this so closely, do you know the methods which change the lat/lon endpoints for the cross section layer? It would be much more efficient to set up a series of points, I could loop through, change the location, capture an image in a script.

Thanks,
Joleen
User avatar
ghansham
Posts: 175
Joined: Thu Nov 11, 2010 5:40 pm

Re: Couple of features

Post by ghansham »

hi Joleen...

You can try something like this in jython script (assuming dc is the crossectioncontrol)
cs_selector =dc.getCrossSectionSelector();
#here start and end are the realtuples defining your start and end points
cs_selector.setPosition(start, end)

I hope it gives you some hint.

It should work. I have not tried though.


regards
Ghansham
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: Couple of features

Post by joleenf »

Hi Ghansham,

I have a feeling there is a step that I miss when I do this. I think I have tried this in the past with the same results as today. For a test, I added a "Display ID" to the cross section layer called "myLayer."

In the jython shell, I used findDisplayControl to get the layer control...

Code: Select all

layerControl = findDisplayControl("myLayer")

# now create earth location objects with the desired lat/lon endpoints
startLoc = Util.makeEarthLocation(38.1,-99.4)
endLoc = Util.makeEarthLocation(28.2,-99.1)

#try using setPosition
layerControl.setPosition(startLoc,endLoc)



I get the following error:
Screen Shot 2013-06-06 at 12.16.19 PM.png


I know this slice is in the data, it is a replication of a push I used interactively. Am I reading this error correctly, does it seem that retrieving the data failed?

Joleen
User avatar
ghansham
Posts: 175
Joined: Thu Nov 11, 2010 5:40 pm

Re: Couple of features

Post by ghansham »

Hi joleen,

Give me a day, caught up with some high priority stuff.
Will get back to you with a sample script.
But I will tell you name of two persons who are jython experts. One is hydra codefather.
They both are Tom. Any guess?
TomW and TomR sir.
I am a big fan of both of them. :-)
I will get back to you.
Regards
Ghansham
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: Couple of features

Post by joleenf »

Hi Ghansham,

No worries. I will check with Tom and Jonathan. I believe this is close to the right path.

Joleen
User avatar
ghansham
Posts: 175
Joined: Thu Nov 11, 2010 5:40 pm

Re: Couple of features

Post by ghansham »

hi..

This script should be able to solve your problem


def makeEarthLocation2(lat, lon):
from visad import Real
from visad import RealType
from visad import RealTuple
from visad import RealTupleType
reals = []
reals.append(lon)
reals.append(lat)
reals.append(0)
return RealTuple(RealTupleType.SpatialEarth3DTuple, reals);

def cstest(filename, choice_name, lon0, lat0, lon1, lat1):
ds=makeDataSource(filename, "FILE.NETCDF")
field=getData(ds.getName(), choice_name)
print field.getType()
control=createDisplay("colorxs", field);
control.applyPreferences()
pause()

cs_selector = control.getCrossSectionSelector();
point_type = cs_selector.getStartPoint().getType()
import ucar.visad.Util as ut
from visad import RealTupleType
if point_type == RealTupleType.SpatialEarth3DTuple:
start = makeEarthLocation2(lat0, lon0)
end = makeEarthLocation2(lat1, lon1)
elif point_type == RealTupleType.LatitudeLongitudeAltitude:
start= ut.makeEarthLocation(lat0, lon0)
end=ut.makeEarthLocation(lat1, lon1)
cs_selector.setPosition(start, end)
pause()
User avatar
ghansham
Posts: 175
Joined: Thu Nov 11, 2010 5:40 pm

Re: Couple of features

Post by ghansham »

Hi Joleen...

use this file.

Ghansham
Attachments
cstest.py
(1.03 KiB) Downloaded 378 times
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: Couple of features

Post by joleenf »

Thank-you!!!!! This is going to save me so much time. Ghansham, your code works well as written, I have also tested blending the interactive display with scripting. In this case, I have already displayed a cross section via the Field Selector[ If I set the layer id and grab the display control as outlined in this post:
viewtopic.php?f=26&t=1019&hilit=layer+id ,

I can get the ColorCrossSectionControl as well. So instead of loading the file via a script:

Code: Select all

   ds=makeDataSource(filename, "FILE.NETCDF")
   field=getData(ds.getName(), choice_name)
   print field.getType()
   control=createDisplay("colorxs", field);
   control.applyPreferences()


I also have the option of

1.) loading via the interactive browser, removing the lines above which retrieve the data (makeDataSource, getData)
2.) setting the layer ID to a known string (eg. "CrIS_RTV") and replacing the createDisplay line with

Code: Select all

control = findDisplayControl("CrIS_RTV")


This is going to be a big help for me! Thanks so much!
Joleen
Post Reply