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

The surface_or_depth function assumes sea level is at 0 #162

Open
mandli opened this issue Jun 4, 2015 · 2 comments
Open

The surface_or_depth function assumes sea level is at 0 #162

mandli opened this issue Jun 4, 2015 · 2 comments
Assignees

Comments

@mandli
Copy link
Member

mandli commented Jun 4, 2015

GeoClaw has a parameter to adjust the sea_level. I am not sure how to really get this into the function, maybe provide a key word argument for the sea level and default to 0?

def surface_or_depth(current_data, sea_level=0.0):
    ...

I am also not certain what the real effect of this on plotting is and whether there are cases where we could see this.

@rjleveque
Copy link
Member

When we run at different tide levels to incorporate tidal uncertainty in PTHA this is an issue and we need to adjust the color scale to be symmetric about the sea_level used. I've done this by adding something like the following to setplot, where clim_ocean was the cmax value to use over the ocean and clim_CC was to use in a different figure where we zoomed in on Crescent City:

    try:
        tsudata = open(plotdata.outdir+'/geoclaw.data').readlines()
        for line in tsudata:
            if 'sea_level' in line:
                sea_level = float(line.split()[0])
                print "sea_level = ",sea_level
    except:
        print "Could not read sea_level, setting to 0."
        sea_level = 0.

    clim_ocean = 0.2
    clim_CC = 0.5

    cmax_ocean = clim_ocean + sea_level
    cmin_ocean = -clim_ocean + sea_level
    cmax_CC = clim_CC + sea_level
    cmin_CC = -clim_CC + sea_level

and then later used via e.g.:

    plotitem.imshow_cmin = cmin_ocean
    plotitem.imshow_cmax = cmax_ocean

@mandli
Copy link
Member Author

mandli commented Aug 5, 2015

I think reading in of the geoclaw.data file should work via the ClawData framework so you could do that. Also, we could replace the function in geoplot in the setplot function to get this working:

import clawpack.geoclaw.data as data
import clawpack.visclaw.geoplot as geoplot

geo_data = data.GeoClawData()
geo_data.read(os.path.join(plotdata.outdir, 'geoclaw.data'))
geoplot.surface_or_depth = lambda cd: geoplot.surface_or_depth(cd, sea_level=geo_data.sea_level)

but this would require adding the key-word argument. This is a bit shorter and allows this to be set once for the entire script but is a bit less scrutable to someone new at Python. If nothing else this does provide an indication that a user may need to be careful about this.

@rjleveque rjleveque self-assigned this Feb 23, 2019
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