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

fgmax data issues fg.x and fg.y are no longer increasing #582

Open
cjeffr opened this issue Dec 5, 2023 · 2 comments
Open

fgmax data issues fg.x and fg.y are no longer increasing #582

cjeffr opened this issue Dec 5, 2023 · 2 comments

Comments

@cjeffr
Copy link

cjeffr commented Dec 5, 2023

I've updated my installation to the most recent version from 5.8.2 and with that some of my fgmax plotting routines failed. I found that fg.x and fg.y are no longer increasing but are the same value across the array. I'm wondering if I'm missing an input change somewhere? I did not remember reading changes to fgmax in the release notes but I did see completed pull requests where changes were made recently. My file moriches_fgmax.data was created using version 5.8.2.
Thanks for your help.

Example arrays below with fg.x I can also paste or share screen shots of fg.y if needed. My fgmax declaration is below and the example I have as well.

INPUT:

rundata.fgmax_data.num_fgmax_val = 2
fgmax_grids = rundata.fgmax_data.fgmax_grids

fg = fgmax_tools.FGmaxGrid()
fg.point_style = 4
fg.min_level_check = 6
fg.tstart_max = days2seconds(0.5) # just before wave arrives
fg.tend_max = days2seconds(1.333) # when to stop monitoring max values
fg.dt_check = 5.*3600 # how often to update max values
fg.interp_method = 0
fg.xy_fname = '../../fgmax_data/moriches_fgmax.data' # file of 0/1 values in tt3 format
fgmax_grids.append(fg) # written to fgmax_grids.data

EXAMPLE OUTPUT

fg.x == [-72.87995372 -72.87995372 -72.87995372 ... -72.87995372 -72.87995372
-72.87995372]
fg.X == array([[-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631],
[-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631],
[-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631],
...,
[-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631],
[-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631],
[-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631]])

Since fg.x = fg.X[:,0] I tried swapping the rows and columns fg.X[0,:] and I get my expected result.
array([-72.87995372, -72.87986113, -72.87976853, ..., -72.5802315 ,
-72.5801389 , -72.58004631])

@rjleveque
Copy link
Member

@cjeffr: This is probably a result of the changes in #561, which was included in v5.9.1.

I think this change should have fixed a bug in earlier versions where fg.x was improperly set to fg.X[0,:] rather than fg.X[:,0]. Is it possible that your Python script that calls fgmax_tools.read_output() was taking that bug into account and resetting fg.x after reading? I ask because I had some scripts like that, which I had to modify after fixing the bug.

I just tried running the example in
$CLAW/geoclaw/examples/tsunami/chile2010_fgmax-fgout
and it seems to run ok, and adding

    print(fg.X[:3, :3])
    print('x = ',fg.x[:3])

at the end of the function plot_fgmax_grid in plot_fgmax.py and then running this script prints out

[[-119.91666667 -119.91666667 -119.91666667]
 [-119.75       -119.75       -119.75      ]
 [-119.58333334 -119.58333334 -119.58333334]]
x =  [-119.91666667 -119.75       -119.58333334]

as expected.

Hope this helps you debug. Let us know if you continue to have problems.

@cjeffr
Copy link
Author

cjeffr commented Dec 6, 2023

Yes I think my plotting routine didn't take into account the indexing added into read_output() I will try that and if it goes well I'll close this issue.

Thanks!

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

2 participants