CEMPD / VERDI

This is the repo for the VERDI project, written in java.
GNU General Public License v3.0
16 stars 13 forks source link

save tileplot as shapefile from gui #322

Closed lizadams closed 7 months ago

lizadams commented 1 year ago

Describe the bug A user of the CMAS Forum had requested the ability to save data to a shapefile from the command line. I tested this and it appears to work ok for the command line. ./verdi.command -f $cwd/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile -saveImage "shp" $cwd/ozone_shapefile -quit

The following shapefile was created by VERDI: [vcredadmins-MBP:~/Downloads/VERDI_2.1.4] lizadams% ls -rlt total 7528

-rw-r--r-- 1 lizadams staff 579 Apr 28 11:56 ozone_shapefile.prj -rw-r--r-- 1 lizadams staff 1466180 Apr 28 11:56 ozone_shapefile.shp -rw-r--r-- 1 lizadams staff 86340 Apr 28 11:56 ozone_shapefile.shx -rw-r--r-- 1 lizadams staff 269565 Apr 28 11:56 ozone_shapefile.dbf -rw-r--r-- 1 lizadams staff 129373 Apr 28 11:56 ozone_shapefile.fix

However, if I tried to create the same shapefile by using the GUI, I VERDI gave an error. ./verdi.command Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: The method exportShapeFile(String) is undefined for the type MeshPlot

    at anl.verdi.plot.util.PlotExporter.save(PlotExporter.java:184)
    at anl.verdi.plot.util.PlotExporter.run(PlotExporter.java:134)
    at anl.verdi.plot.util.PlotExporterAction.actionPerformed(PlotExporterAction.java:38)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
    at java.desktop/com.apple.laf.AquaMenuItemUI.doClick(AquaMenuItemUI.java:157)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
    at java.desktop/java.awt.Component.processEvent(Component.java:6391)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

To Reproduce Steps to reproduce the behavior:

  1. Create a tile plot: ./verdi.command -f $cwd/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile
  2. Click on 'File Export as Image/GIS'
  3. Add filename to the 'Save As' Text Box. such as: cctm47_ozone
  4. Select from the File Format Options: Shapefile (.shp, .shx, *...)
  5. Click Save
  6. VERDI gives an error, and does not generate a shapefile.

Expected behavior When the user uses the GUI to save the Tile Plot of a variable, layer, and timestep to a shapefile, it should be generated, and match the shapefile that is generated from the command line option. Users need the ability to create a shapefile from both the GUI and the VERDI command line.

Desktop (please complete the following information):

yadongxuEPA commented 1 year ago

Thanks for Liz double-checking this issue !

I got the same error on Atmos when trying to export shapefiles in VERDI GUI in the new builds 20230425.

But this feature works well in our previous builds 20230224. Maybe somehow the code is broken when trying to enable exporting shapefiles in a script.

Tony, please check into this.

Thanks, Yadong

yadongxuEPA commented 1 year ago

Retested VERDI 2.1.4 20230517 builds on Atmos, found that this issue has resolved. Exporting shapefiles from a tile plot in VERDI GUI worked.
Also tested on the command line with: ./verdi.sh -f /work/MOD3APP/yxu/VERDI_2.1.4/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile -saveImage "shp" /work/MOD3APP/yxu/VERDI_2.1.4/data/plots/CCTM_O3_shapefile -quit It also worked.

yadongxuEPA commented 1 year ago

Retested VERDI 2.1.4 20230831 builds on Atmos, confirmed that this issue has resolved. Exporting shapefiles from a tile plot in VERDI GUI worked. Also tested on the command line with: ./verdi.sh -f /work/MOD3APP/yxu/VERDI_2.1.4/data/model/CCTM47_aac_spr06.12k.CONC.2006113.O3.ncf -s "O3[1]" -g tile -saveImage "shp" /work/MOD3APP/yxu/VERDI_2.1.4/data/plots/CCTM_O3_shapefile_again -quit It also worked.

yadongxuEPA commented 12 months ago

Retested VERDI 2.1.4 20230911 and 20230924 builds on Atmos, confirmed that this issue has resolved.

yadongxuEPA commented 8 months ago

Checked VERDI_2.1.5_linux64_20231222.tar.gz on Atmos and it worked.

lizadams commented 8 months ago

Checked VERDI_2.1.5_mac_20240103.tar.gz on mac using both the command line option, and the GUI, and confirmed that both successfully created shapefiles of the tile plot variable.

lizadams commented 7 months ago

Retested using VERDI_2.1.5_mac_20240124.tar.gz on mac

Using both command line and gui worked, successfully created shapefile of the tile plot variable selected.

yadongxuEPA commented 7 months ago

Checked VERDI_2.1.5_linux64_20240124.tar.gz on Atmos and confirmed that both command line and GUI worked.