Skip to content

[Bug]: Key Error from plotting function in MaskEditor #25

Description

@michelledvorak

Contact Details

michelle.t.dvorak@gmail.com

What happened?

I expected to launch the maskEditor app with the loaded mask file. I received the same error with a custom topo file so I tried again with the default tx2_3v2 preindustrial topo file and again it did not work.

How to replicate?

I loaded the standard tx2_3v2 topo file (ocean_topo_tx2_3v2_240501.nc), from campaign storage, which contains dimensions lath, lonh.

oceanmask = topo.rename({'lonh':'lon', 'lath':'lat'})
oceanmask = oceanmask.set_coords(['lat','lon'])

crs = cartopy.crs.Orthographic(-140,45)

app0bj = maskEditor(crs=crs, ds=oceanmask['mask'])
app = app0bj.createMaskEditorApp()
display(app)

Relevant log or error output

-> 1128 plt = self.da.sel(ny = slice(gy1, gy2), nx = slice(gx1, gx2)).hvplot.quadmesh(
   1129     'lon', 'lat', 'mask', projection = self.crs, global_extent=True,
   1130     frame_height=540,
   1131     cmap=hv.plotting.util.process_cmap(self.customCM),
   1132     coastline='10m',
   1133     clim=(0,1))
...
KeyError: "'ny' is not a valid dimension or coordinate for Dataset with dimensions FrozenMappingWarningOnValuesAccess({'lon': 540, 'lat': 480})"

Renaming coordinates 'lat'->'ny' and 'lon'->'nx', also throws an error (needs 'lat' and 'lon' coordinates to work)

global attributes

// global attributes:
		:Description = "Ocean Topography Statistics on MOM6 Grid" ;
		:Creator = "Frank Bryan (bryan@ucar.edu)" ;
		:Created = "20240216" ;
		:Generating\ Code = "create_model_topo.f90" ;
		:Model\ Grid\ Version = "tx2_3v2" ;
		:Source\ Topography\ Data = "/glade/campaign/cgd/oce/datasets/obs/SRTM/SRTM15_V2.4.nc" ;
		:Edit\ History = "Hand Edit + Lake Fill 02/16/2024" ;
		:Manual\ edits\ updated\ on\: = "2024-05-01T15:28:43.496410" ;
		:By\: = "Gustavo Marques (gmarques@ucar.edu)" ;
		:url = "https://github.com/NCAR/tx2_3/topography/Append_topo_edits.ipynb" ;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions