Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile plot for 3D grid data with layer mean or sum quantities shown in 2D space #345

Open
dkang2 opened this issue Jun 18, 2024 · 31 comments
Assignees

Comments

@dkang2
Copy link
Collaborator

dkang2 commented Jun 18, 2024

Is your feature request related to a problem? Please describe.
Yes. When VERDI is used to visualized 3D tile plots, sometimes it is useful to be able to show the statistics (mean or sum) of the vertical layers (all or a number of layers).
For example, when shown the 3D lightning NO emissions in the following plot:
image
Right now, it can display the tile plots for any individual layer by changing the Layer number. However, it would be useful, if it can compute the mean or total of all or some of the layers for each grid cell and display it as a tile plot.
Describe the solution you'd like
The "Use Layer Range" panel can be used to choose all or some of the layers, and the "Stats" box can provide the function option of either "mean" or "sum", but in this case, it would generate the mean or sum of the vertical layers as chosen from the "Use Layer Range" panel for each grid cell and generate a tile plot for that stat.

Describe alternatives you've considered
None

Additional context
Refer to the screenshot image from VERDI.

@yadongxuEPA
Copy link
Collaborator

yadongxuEPA commented Jul 19, 2024

Tested with VERDI_2.1.5_linux64_20240717.tar.gz on Atmos, found that this issue has partially resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc
We see that "layer_mean" and "layer_sum" were added into the "Stats" dropdown menu.
I did spot check for the values at two grid cells (one at [col=123,row=43) in FL, the other at [col=68,row=76] in CO).
testing_20240717_issue_345
testing_20240717_issue_345_1

Remaining issue 1) the calculated "layer_mean" values are far away from the ones calculated in Excel ("layer_sum" is close enough)
image
image
image

Remaining issue 2) the probed output at the lower left corner displayed the wrong col and row (after selecting "Stats" > "layer_mean" or "layer_sum") (the reason might be the code of the newly fixed grid-cell shifted toward north-east when probed is not pulled into this new feature)
testing_20240717_issue_345_2

@lizadams
Copy link
Contributor

lizadams commented Jul 22, 2024

I've tested on the mac for the dataset and cell that Yadong tested in Florida, and am observing the same issue with layer_mean using VERDI_2.1.5_mac_20240717.tar.gz.

./verdi.command -f $cwd/data/model/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc

I tried taking the layer sum at all of the cells next to cell, row (123, 43), and I can't find a mean that matches the reported value by VERDI. I was thinking that perhaps it was reporting the value for (124,44), but that doesn't seem to be the case.

https://docs.google.com/spreadsheets/d/1-SSRXkJAY2tSXYQjCocoa8u-DPhPqp2mTz6PgEcqNl8/edit?gid=0#gid=0

@lizadams
Copy link
Contributor

I added the lightning dataset as a compressed file to help with future testing. CCTM_LTNGEMIS3D_WWLLNs_20160701.nc.gz
#348

@dkang2
Copy link
Collaborator Author

dkang2 commented Jul 22, 2024

In addition, the layer_mean seems no change over time steps, while the layer_sum changes with time steps. When the layer_mean and layer_sum functions are chosen, the Layer: option box at the top of the plot should be disabled. Please also test the values with different layer options (say from Layer 10 to Layer 15).

image
image

@dkang2
Copy link
Collaborator Author

dkang2 commented Jul 22, 2024

Actually, it is the layer_mean option changes over time steps, but the layer_sum doesn't.

@dkang2
Copy link
Collaborator Author

dkang2 commented Jul 22, 2024

The layer_sum generated unrealistically large negative numbers when probing. See the attached plot:

image

@dkang2
Copy link
Collaborator Author

dkang2 commented Jul 22, 2024

Also noticed that when starting the 20240717 build, the following message is generated:
./verdi.sh -f /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20240725.tar.gz on Atmos, found that this issue has partially resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc

Found that the "layer_mean" calculated values matched with the spot-checked values and "Layer" spinner was grayed-out when the "Stats" is selected at "layer_mean" and "layer_sum".

But the following issues have not resolved:

  1. the probed output at the lower left corner displayed the wrong col and row (after selecting "Stats" > "layer_mean" or "layer_sum")
    testing_20240725_issue_345_1
    testing_20240725_issue_345_3
  2. "layer_sum" does not change at different timesteps

testing_20240725_issue_345_2
testing_20240725_issue_345_3

  1. Got these Java library error messages when bring up VERDI GUI or run it from command line
    testing_20240725_issue_345_error_message

@dkang2
Copy link
Collaborator Author

dkang2 commented Aug 1, 2024

Just quickly tested the 20240731 build, the layersum stat is partially resolved with changing timesteps. However, when the Use Layer Range is selected, the values don't seem to change by changing different layers, for instance, set Min: 10 and Max: 20. The layer_sum and layer_mean values should respond to different selections of layer range. In addition, the title should change from "Layer 1 NO[1]" to Layer_mean or Layer_sum NO[layerX-layerY]. As I'm pondering with the plot, another feature would be to add the layer_sum and layer_mean as variables in the variables list such as NO_layer_sum_Lx-Ly. With this, if there is another file that contains the column values, the difference plots between the calculated stats (sum or mean) and the values from another file can be created. We can discuss more on our next meeting for clarification. In addition, the SLF4J problem is still there as before.

@dkang2
Copy link
Collaborator Author

dkang2 commented Aug 26, 2024

Just tested the 20240824 build for the layer stats. It partially worked by allowing choosing the layer ranges, but the stats are not right. As shown in the plot below, when the layers range 8-18 is selected, the values are all 0s and at the terminal it throws Error messages: 2024.08.26 08:53:13.523 [Thread-4] ERROR anl.verdi.plot.gui.FastTilePlot - Error occurred during computing statistics
java.lang.ArrayIndexOutOfBoundsException: Index 11 out of bounds for length 11
at gov.epa.emvl.GridCellStatistics.computeLayers(GridCellStatistics.java:398) ~[?:?]
at gov.epa.emvl.GridCellStatistics.computeStatistics(GridCellStatistics.java:130) ~[?:?]
at anl.verdi.plot.gui.FastTilePlot.computeStatistics(FastTilePlot.java:1796) ~[?:?]
at anl.verdi.plot.gui.FastTilePlot.copySubsetLayerData(FastTilePlot.java:1969) ~[?:?]
at anl.verdi.plot.gui.FastTilePlot.access$14(FastTilePlot.java:1922) ~[?:?]
at anl.verdi.plot.gui.FastTilePlot$5.run(FastTilePlot.java:575) ~[?:?]
at java.lang.Thread.run(Thread.java:1583) [?:?]
image

In addition, when the layer statistics are selected, probably the ">0.12" box can be disabled or hidden from the scene:

image

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20240824.tar.gz on Atmos, found that this issue has improved but only partially resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc
the following issues have not resolved:

  1. the probed output at the lower left corner displayed the wrong col and row (after selecting "Stats" > "layer_mean" or "layer_sum")
    testing_20240824_issue_345_1
  2. "layer_sum" and "layer_mean" do not change according to user's layer range settings.
    testing_20240824_issue_345_4
    testing_20240824_issue_345_3
  3. did not receive the error messages as described by Daiwen in the command window, but there were lots print-out messages as below
    testing_20240824_issue_345_5

@lizadams
Copy link
Contributor

lizadams commented Aug 28, 2024

Tested with VERDI_2.1.5_mac_20240824.tar.gz

When I choose select layer range from 34-35, the top two layers in the model, and then select layer_sum or layer_mean, VERDI throws an error that I think is related to the off-by-one index issue.

2024.08.28 14:14:08.973 [AWT-EventQueue-0] ERROR anl.verdi.plot.gui.FastTilePlot - Error occurred during computing statistics
java.lang.ArrayIndexOutOfBoundsException: Index 33 out of bounds for length 2

It is looking for layer 33 instead of layer 34.

Created a plot of NO, and then used Controls > Set Rows and Columns to a subdomain region:
Rows: 34 to 38
Columns 128 to 131

I can successfully use the statistics menu options of layer_mean and layer_sum if I create a tile plot without restricting the number of layers.
verdi_index_values_of_cell_location_do_not_match_when_using_stat_menu_option_layer_sum

I also noted that when you change the columns and rows to create a subdomain, the min and max on the legend do not change, to use a min and max over this subdomain region, so I changed the min, max values using configure plot.
verdi_correct_index_without_using_stats_option

Note that the index of the cell value when not using statistics menu is correct.

I then changed statistics to none, and recorded the value of NO in the grid cell for each layer (probing the grid cell after changing the layer)
Found that the layer_sum and layer_mean matched a calculation done in this spreadsheet.

https://docs.google.com/spreadsheets/d/1en5RTdqVo228ENhsIJoqUghZ8OMNmP8AvDpXE7b7pg8/edit?usp=sharing

However, due to problem with the grid cell indexing, the statistics don't work for a restricted number of layers.

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 5, 2024

The 20240904 build partially solved the problem. When calculate the layer stats, some occasions work, some others don't. For example, if all the layers and when the min layer between 1-13, it works. As long as the min layer is selected above 14, the layer stats values become all 0s (both layer_sum and layer_mean). Without going through the layers, it is difficult to find out and the errors seem odd.

image

image

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 5, 2024

Further check the "Use Layer Range", it seems even more weird: Here is the table the stats work (w) or not (x)
Min Max w/x
14 <=26 x
14 >26 w
15 <=28 x
15 > 28 w
16 <= 30 x
16 >30 w

To generalize the relationship, it holds: 2n - 1, that is for Min layer n, when the max layer is >= 2n - 1 the layer stats start to work, if the max layer is less than 2n - 1, it failed. For min layer = 1, it works for all layers, but for n = 2, it only fails when max layer is also 2, works all other layers. For n =5, it works when max is larger than 8.

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20240904.tar.gz on Atmos, found that this issue has improved but only partially resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc

  1. Confirmed that the issue of probed output at the lower left corner displayed the wrong col and row has resolved.
  2. the "layer_sum" and "layer_mean" displayed incorrect values for user's layer range settings.
    For example, when "Use Layer Range" set at "min=9, max=20", the "layer_sum" at cell (123,43) should be 0.871 instead of 0.664 as shown in this screenshot.

testing_20240904_issue_345_1
when "Use Layer Range" set at "min=15, max=30", the "layer_sum" at cell (123,43) should be 34.760 instead of 8.929 as shown in this screenshot.
testing_20240904_issue_345_2

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20240919.tar.gz on Atmos, found that this issue has not resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc
when "Use Layer Range" set at "min=9, max=20", change "stats" drop-down menu to "layer sum" or "layer mean", stopped working and pop-up an error message shown as below:

testing_20240919_issue_345_1

Lots of error messages also showed up in the command window:
testing_20240919_issue_345_2

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 24, 2024

Yes, I got the same error message. Without doing any further, at the first step with the title plot, when layer_sum or layer_mean is selected, the error message occurs as Yadong reported.

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 26, 2024

Tested the 20240925 build on Atmos with selections of different layer ranges, the layer_sum and layer_mean functions seem work correctly. I also did the probing test, and the values and grid cells matched with those shown at the bottom of plot panel. Though I haven't gone into the specific numbers with the layer stats, I think, in general, the issue is resolved. Waiting for more detailed tests and on other platforms and I'm confident that we are close to solving this issue.

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 26, 2024

One additional request (for Tony) regarding the Layer_sum and Lay_mean plots, on the title instead of "Layer Sum NO[1]", is that possible to add the layer range, i.e., "layer (10-25) Sum/Mean NO[1]". When I tried to select the different layer ranges and make the plots, I got lost at which is which.
image

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20240925.tar.gz on Atmos, found that this issue has not resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc

  1. the "layer_sum" and "layer_mean" displayed incorrect values for user's layer range settings.
    when "Use Layer Range" set at "min=9, max=20", the "layer_sum" at cell (123,43) should be 0.871 instead of 2.614 as shown in this screenshot
    testing_20240925_issue_345_1
    the "layer_mean" at cell (123,43) should be 0.073 instead of 0.360 as shown in the screenshot.

testing_20240925_issue_345_4
2) Every time when switch back to "stats" at "none" then go back to display "layer_sum" value again, the values get bigger and bigger
This is the first time switch from "none" to "layer_sum"
testing_20240925_issue_345_1
this is the second time switch from "none" to "layer_sum"
testing_20240925_issue_345_2
this is the third time switch from "none" to "layer_sum"
testing_20240925_issue_345_3

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 30, 2024

I just had a brief test for the 20240929 test on Atmos. For the Layer_Sum and Layer_Mean functions, the results still don't seem right (this time, I probe the numbers). For example, for Col 55 and Row 111, at timestep 1, the layer ranges from 20-25, when I added all the individual layer numbers, it gives me layer_sum of 59.697, while the plot shows 179.089

image

@dkang2
Copy link
Collaborator Author

dkang2 commented Sep 30, 2024

In addition, when going through the timesteps from 1-24 in the animation mode, if the values are probed, it changes every loop; the values are increasing incrementally. I guess that the calculation isn't done properly by separating the timesteps.

@yadongxuEPA
Copy link
Collaborator

yadongxuEPA commented Sep 30, 2024

Tested with VERDI_2.1.5_linux64_20240929.tar.gz on Atmos, found that this issue has not resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc

the "layer_sum" and "layer_mean" displayed incorrect values for user's layer range settings, the "layer_sum" and "layer_mean" values are even higher than those in 20240925 builds, thus they are far away from the correct values calculated from individual values at the probed grid-cell.
when "Use Layer Range" set at "min=9, max=20", the "layer_sum" at cell (123,43) should be 0.871 instead of 149.312 as shown in this screenshot, the "layer_mean" at cell (123,43) should be 0.073 instead of 3.211 as shown in the screenshot.

testing_20240929_issue_345_1
testing_20240929_issue_345_2

@dkang2
Copy link
Collaborator Author

dkang2 commented Oct 8, 2024

Just tested the 20241007 build on Atmos, and it seems to me that the miscalculation of Layer_Sum and Layer_Mean has been corrected. The test was done only at one grid cell and one layer range, it should be tested further on other platforms and additional data points. It should work for other situations 👍

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20241007.tar.gz on Atmos, found that this issue has resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc
checked the "layer_sum" and "layer_mean" values at different layer range at multiple time steps, confirmed that the displayed values are correct (testing results are summarized at the table shown as below).
image

@yadongxuEPA
Copy link
Collaborator

Attach more screenshots from the above test:
testing_20241007_builds_issue_345_2
testing_20241007_builds_issue_345_3

testing_20241007_builds_issue_345_4
testing_20241007_builds_issue_345_5
testing_20241007_builds_issue_345_6
testing_20241007_builds_issue_345_7

@dkang2
Copy link
Collaborator Author

dkang2 commented Oct 10, 2024

Tested the 20241009 build. It worked as expected and the title change looks great. Thank Tony for the quick turn-around.

@dkang2
Copy link
Collaborator Author

dkang2 commented Oct 10, 2024

While using the newest build for my application, just found a minor issue with the color scale bar. The range of scales seem only calculated based on the first timestep for Layer_mean and Layer_sum values. When stepping forward in time, the scale bar doesn't change, but the max values can exceed the max value indicated by the scale bar. See the following screen shots:

image

image

The scale should be based on the values across all the timesteps instead of just the first timestep as any other multiple timestep title plots.

@dkang2
Copy link
Collaborator Author

dkang2 commented Oct 12, 2024

Tested the 20241011 build, the issue with the scale bar mentioned in the previous post has been resolved.

@yadongxuEPA
Copy link
Collaborator

Tested with VERDI_2.1.5_linux64_20241011.tar.gz on Atmos, confirmed that the title with the selected layer range info and the legend issue reported by Daiwen have resolved.
used this data file: /home/yxu01/data_files_for_VERDI_testing/CCTM_LTNGEMIS3D_WWLLNs_20160701.nc
testing_20241011_builds_issue_345_1
testing_20241011_builds_issue_345_2
testing_20241011_builds_issue_345_3

@yadongxuEPA
Copy link
Collaborator

yadongxuEPA commented Oct 14, 2024

But I noticed a minor issue in these builds, the probed time step and layer (displayed in the left corner) should start from 0, so they should always be -1 compared with the ones displayed at the top of the tile plot. This issue only occurs for "Statics" set at "None", other statics (like 'layer_sum', 'layer_mean' shown as above) are correct.

testing_20241011_builds_issue_345_6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants