How do I customise Default Background Maps?

Post any questions, ideas, or topics related to Jython and Python scripting.
User avatar
m.yunus.a.m.
Posts: 18
Joined: Wed Aug 18, 2021 3:55 am

How do I customise Default Background Maps?

Post by m.yunus.a.m. »

Hello.

Referring to the second attachment, how do I customise Default Background Maps? Specifically:
1. Maps. Using only Antarctica maps and setting its color to white.
2. Lat/Lon. Referring to the first attachment. Lines, Latitude Interval 5, style solid line, color white, and Longitude interval 20, style solid line, color white. Labels, Latitude interval 5, relative to -90, at longitudes 160, color white, alignment SW and Longitude interval 10, relative to 180, at latitudes -65, color white, alignment NE.

If it's possible, I would like to rotate the the lat/lon labels to be parallel to the figure, instead of angled.

I would like to be able to either save this configuration and load if in a script or apply the configuration in the script.

Yunus.

Update: The solution to rotation/orientation of the lat/lon label can be found in viewtopic.php?p=7378#p7378.
Attachments
Screenshot 2021-08-25 124920.png
Screenshot 2021-08-25 124127.png
Last edited by m.yunus.a.m. on Mon Sep 13, 2021 8:31 pm, edited 1 time in total.
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: How do I customise Default Background Maps?

Post by bobc »

Hello,

After making the changes to the default background maps (map lines and lat/lon lines and labels) you can select "File > Default Maps > Save as the Default Map Set" in the Layer Controls tab of the Data Explorer window. After doing this, every time a new tab is created in the current or any future session, only the map lines and lat/lon lines and labels you specified will be displayed. To take this a step further, you could set the South Pole projection to be the default by setting it using the Default Projection dropdown of the Display Window tab of the User Preferences window (Edit > Preferences through the Main Display window).

There is currently no mechanism that allows for changing the orientation of the lat/lon labels in the display. They're always horizontally oriented by default. I wrote up Inquiry 2988 to evaluate adding this functionality, though I don't know if or when this work will be completed. Right when I set my display to the South Pole projection the labels are horizontally-oriented:
lalo_labels.jpg
If I rotate the display counter clockwise so the 180 longitude label is at the top (as it is in your image) then I see the rotated labels:
lalo_labels2.jpg
To cover this specific case of adding the ability to not rotate text/labels when rotation is done to the display, I wrote up Inquiry 2989. Again, I'm unsure of if or when this work will be completed.

Thanks, and please let me know if you have any additional questions.

Bob Carp
McIDAS User Services
User avatar
m.yunus.a.m.
Posts: 18
Joined: Wed Aug 18, 2021 3:55 am

Re: How do I customise Default Background Maps?

Post by m.yunus.a.m. »

Hi, Bob Carp.

I understand that the lat/lon text manipulation that I want is not available. I would probably use GIMP manipulation to add them.

Currently I have the following codes in the Jython console. I'm trying to go through https://www.ssec.wisc.edu/mcidas/softwa ... c/current/ for other functions (although I'm using v1.9beta1). I could not find "setProjection" in the Index page. How do I find the all the Jython commands that can be used in the Jython console?

Code: Select all

panel = buildWindow(height=900, width=900, panelTypes=MAP)
panel[0].setProjection('South Pole')
panel[0].setViewpoint('TNB')
Yunus

Edit: What I found was https://github.com/mcidasv/mcidasv/blob ... mcvadde.py and https://github.com/mcidasv/mcidasv/blob ... kground.py.
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: How do I customise Default Background Maps?

Post by bobc »

Hello,

There are several resources to see which functions are available to use in the Jython Shell (as well as background scripts).
  1. There is a Scripting section of the User's Guide that describes many basic functions and provides sample commands. The bottom of the page has links to additional functions in the Java docs for visAD, netCDF, IDV, and McIDAS-V. You can find more functions for operating on data objects in the JPythonMethods.
  2. The McIDAS-V Documentation page from the McIDAS-V website has a couple scripting tutorials. The Basic Scripting tutorial is for beginners and goes over some commonly-used functions. The Advanced Scripting tutorial goes deeper into the scripting capabilities of McIDAS-V including data analysis and the creation of a function.
  3. From the Main Display window you can select "Tools > Formulas > Jython Library" to open the Jython Library. The last links you gave are actually the "System > McIDAS-V ADDE" library (mcvadde.py) and the "System > Background Processing Functions" library (background.py).
  4. One function you might find very useful is "see()". The see() function allows for listing the functions that can operate on an object. For example, from your lines of code you could run:

    Code: Select all

    print see(panel[0])
    
    This won't print every single function that can operate on the data object, but the large majority of them.
I hope this information is useful, but please let me know if you have any further questions.

Thanks,
Bob Carp
User avatar
m.yunus.a.m.
Posts: 18
Joined: Wed Aug 18, 2021 3:55 am

Re: How do I customise Default Background Maps?

Post by m.yunus.a.m. »

Hi Bob Carp.

What are the differences between Satellite>Imagery and Satellite>HYDRA. When I open a Mod021KM using HYDRA, the option in the Field Selector are Multispectral>Emissive Bands, Image Display Band 31.

I tried adding a local ADDE server, but which format should I use? I'm interested in identifying system in the vicinity of Ross Sea.

Yunus.
User avatar
jayh
Posts: 424
Joined: Thu Jan 15, 2009 10:34 pm

Re: How do I customise Default Background Maps?

Post by jayh »

Hi Yunus-

You would choose the "MODIS MOD 02 - Level- 1B Calibrated Geolocated Radiances" Format. The list represents all the ADDE servers available for local data display.

Satellite>HYDRA gives you access to the HYDRA multispectral display tools, Satellite>Imagery is a more general display tool for all ADDE data with resolution and band tools. In the Field selector you will be able to select calibrated values for each band to display under their drop downs.

Thanks, Jay
User avatar
m.yunus.a.m.
Posts: 18
Joined: Wed Aug 18, 2021 3:55 am

Re: How do I customise Default Background Maps?

Post by m.yunus.a.m. »

Hello,

When you create a display, such as MODlayer2=panel.createLayer('Image Display', Image2), is there a way to create the layer but not display it first? I would like to apply some modification before displaying the image.

Yunus
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: How do I customise Default Background Maps?

Post by bobc »

Hello,

There is no way to operate on a layer without first creating/displaying it. You could display the layer and immediately toggle off the visibility with:

Code: Select all

MODlayer2.setLayerVisible(False)
From here, you can operate on the layer. For example:

Code: Select all

MODlayer2.setEnhancement('Temperature')
And then toggle the visibility of the layer back on with:

Code: Select all

MODlayer2.setLayerVisible(True)
Thanks,
Bob
User avatar
m.yunus.a.m.
Posts: 18
Joined: Wed Aug 18, 2021 3:55 am

Re: How do I customise Default Background Maps?

Post by m.yunus.a.m. »

Hi Bob,

Would it be possible to request this as a feature? Some of the feature like streamlines are quite taxing on a PC with only iGPU (i5-4460 to be exact). I have taken advantage of using latLonBounds, xStride, and yStride, to reduce the amount of data being displayed. But it seems, my ancient PC is struggling with it.

Yunus
User avatar
m.yunus.a.m.
Posts: 18
Joined: Wed Aug 18, 2021 3:55 am

Re: How do I customise Default Background Maps?

Post by m.yunus.a.m. »

Hello,

I hope it's fine for me to post other question using this thread. I find that imagery added through Data Explorer>Data Sources>HYDRAhas better quality than imagery added through loadADDEImage(). Would it be possible to add imagery using the HYDRA through the Jython script?

Would it be possible to apply the enhancement done by HYDRA towards data loaded using loadADDEImage()? Below is a snippet of the code I'm using to load the ADDE Image. I'm currently plotting the MOD021KM and ERA5 together.

Code: Select all

Data_Dir = 'G:/My Drive/Terra Nova Bay Work in Progress/Raw-Data/MODIS-MOD021KM/Terra/20160521'
Terra20160521 = makeLocalADDEEntry(dataset='TEST1', imageType='MOD021KM', mask=Data_Dir, format='MODS', save=False) 
Image1=loadADDEImage(server='localhost',localEntry=Terra20160521,\
       time=file_Time_formatted_1.strftime("%X"),day=file_Time_formatted_1.strftime("%Y%j"),\
       band=31,size='ALL',unit='BRIT')
  
MOD1=panel.createLayer('Image Display', Image1)
Yunus.
Attachments
Hydra.png
adde.png
Post Reply