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

Unclear elements of the example evaluation instructions #107

Open
richsdixon opened this issue Nov 17, 2020 · 2 comments
Open

Unclear elements of the example evaluation instructions #107

richsdixon opened this issue Nov 17, 2020 · 2 comments

Comments

@richsdixon
Copy link

richsdixon commented Nov 17, 2020

I've successfully run the Port Hedland example and now I'm trying to run the example evaluation of the Port Hedland dataset that's on your website but I've hit a problem, and I'm looking for some clarification in the instructions, please - as getting the evaluation output will be central to my use of the model.

In the Evaluation example, the script says:

An example configuration for executing an evaluation. Other sections of the configuration file should remain unchanged

Something isn't clear in the notes - are we supposed to running the evaluation code:

a) using existing output directories from Port Hedland example?
or
b) using an entirely new output data directory (i.e. the evaluation is run in entirely separate directory from the initial example) ?

I've tried both and neither seem to work.

When I follow b) above and create all new output directories, running the evaluation into a new directory (port_hedland_eval rather than port_hedland that was used for the initial test simulation) - the run crashes, looking for hazard.nc in the output directories:

2020-11-17 21:45:55: Creating hazard database
2020-11-17 21:45:55: Running database update
2020-11-17 21:45:55: Creating location database
2020-11-17 21:45:55: Couldn't open dat file ./output/port_hedland_eval/process/dat/port_hedland.dat
2020-11-17 21:45:55: Building the hazard database...
2020-11-17 21:45:55: Creating table tblLocations
2020-11-17 21:45:55: Creating table tblEvents
2020-11-17 21:45:55: Creating table tblWindSpeed
2020-11-17 21:45:55: Creating table tblHazard
2020-11-17 21:45:56: Creating table tblTracks
2020-11-17 21:45:56: Inserting records into tblHazard
2020-11-17 21:45:56: Traceback (most recent call last):
2020-11-17 21:45:56: File "tcrm.py", line 648, in startup
2020-11-17 21:45:56: main(configFile)
2020-11-17 21:45:56: File "tcrm.py", line 70, in wrap
2020-11-17 21:45:56: res = f(*args, **kwargs)
2020-11-17 21:45:56: File "tcrm.py", line 558, in main
2020-11-17 21:45:56: doDatabaseUpdate(configFile)
2020-11-17 21:45:56: File "tcrm.py", line 462, in doDatabaseUpdate
2020-11-17 21:45:56: database.run(configFile)
2020-11-17 21:45:56: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 782, in run
2020-11-17 21:45:56: db.processHazard()
2020-11-17 21:45:56: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/Utilities/parallel.py", line 132, in wrap
2020-11-17 21:45:56: return f(*args, **kwargs)
2020-11-17 21:45:56: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 571, in processHazard
2020-11-17 21:45:56: ncobj = Dataset(hazardFile)
2020-11-17 21:45:56: File "netCDF4/_netCDF4.pyx", line 2135, in netCDF4._netCDF4.Dataset.init
2020-11-17 21:45:56: File "netCDF4/_netCDF4.pyx", line 1752, in netCDF4._netCDF4._ensure_nc_success
2020-11-17 21:45:56: FileNotFoundError: [Errno 2] No such file or directory: b'./output/port_hedland_eval/hazard/hazard.nc'

....this suggests that I should probably be using existing directories that have already been run, i.e. method a) above.

So when I follow method a) above and use the same output directories as the initial Port Hedland example, the run goes on for longer, but I first up get multiple errors saying this below, which suggests that the tblEvents doesn't want to be overwritten and I should be using a separate database:

2020-11-18 02:14:23: Creating hazard database
2020-11-18 02:14:23: Running database update
2020-11-18 02:14:23: Couldn't open dat file ./output/port_hedland/process/dat/port_hedland.dat
2020-11-18 02:14:23: Building the hazard database...
2020-11-18 02:14:23: Creating table tblLocations
2020-11-18 02:14:23: Creating table tblEvents
2020-11-18 02:14:23: Creating table tblWindSpeed
2020-11-18 02:14:23: Creating table tblHazard
2020-11-18 02:14:23: Creating table tblTracks
2020-11-18 02:14:24: Problem inserting events into tblEvents:
Traceback (most recent call last):
File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 378, in insertEvents
self.execute(INSEVENTS, eventparams)
sqlite3.IntegrityError: UNIQUE constraint failed: tblEvents.eventNumber
2020-11-18 02:14:24: Pre-existing event with the same eventNumber attribute
Traceback (most recent call last):
File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 378, in insertEvents
self.execute(INSEVENTS, eventparams)
sqlite3.IntegrityError: UNIQUE constraint failed: tblEvents.eventNumber
2020-11-18 02:14:24: Check that you are not overwriting an existing database.
Traceback (most recent call last):
File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 378, in insertEvents
self.execute(INSEVENTS, eventparams)
sqlite3.IntegrityError: UNIQUE constraint failed: tblEvents.eventNumber
2020-11-18 02:14:24: UNIQUE constraint failed: tblEvents.eventNumber
Traceback (most recent call last):
File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 378, in insertEvents
self.execute(INSEVENTS, eventparams)
sqlite3.IntegrityError: UNIQUE constraint failed: tblEvents.eventNumber
2020-11-18 02:14:24: Problem inserting events into tblEvents:
Traceback (most recent call last):
File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 378, in insertEvents
self.execute(INSEVENTS, eventparams)
sqlite3.IntegrityError: UNIQUE constraint failed: tblEvents.eventNumber
2020-11-18 02:14:24: Pre-existing event with the same eventNumber attribute
Traceback (most recent call last):
File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/database/init.py", line 378, in insertEvents
self.execute(INSEVENTS, eventparams)
sqlite3.IntegrityError: UNIQUE constraint failed: tblEvents.eventNumber
2020-11-18 02:14:24: Check that you are not overwriting an existing database.

.........followed by a crash a few hours later with the following error reported:

2020-11-18 06:09:48: Traceback (most recent call last):
2020-11-18 06:09:48: File "tcrm.py", line 648, in startup
2020-11-18 06:09:48: main(configFile)
2020-11-18 06:09:48: File "tcrm.py", line 70, in wrap
2020-11-18 06:09:48: res = f(*args, **kwargs)
2020-11-18 06:09:48: File "tcrm.py", line 562, in main
2020-11-18 06:09:48: doEvaluation(config)
2020-11-18 06:09:48: File "tcrm.py", line 497, in doEvaluation
2020-11-18 06:09:48: Evaluate.run(configFile)
2020-11-18 06:09:48: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/Evaluate/init.py", line 34, in run
2020-11-18 06:09:48: pd.run()
2020-11-18 06:09:48: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/Evaluate/pressureDistribution.py", line 576, in run
2020-11-18 06:09:48: self.plotPressureMean()
2020-11-18 06:09:48: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/Utilities/parallel.py", line 132, in wrap
2020-11-18 06:09:48: return f(*args, **kwargs)
2020-11-18 06:09:48: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/Evaluate/pressureDistribution.py", line 342, in plotPressureMean
2020-11-18 06:09:48: figure.plot()
2020-11-18 06:09:48: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/PlotInterface/maps.py", line 309, in plot
2020-11-18 06:09:48: self.subplot(axes, subfigure)
2020-11-18 06:09:48: File "/media/richd/1717d605-655a-4b57-9857-163ab0c9c2f0/tcrm/test/tcrm-3.1.4/PlotInterface/maps.py", line 441, in subplot
2020-11-18 06:09:48: vmax=vmax, cmap=cmap)
2020-11-18 06:09:48: File "/home/richd/anaconda3/envs/tcrm/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py", line 1451, in pcolormesh
2020-11-18 06:09:48: result = self._pcolormesh_patched(*args, **kwargs)
2020-11-18 06:09:48: File "/home/richd/anaconda3/envs/tcrm/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py", line 1469, in _pcolormesh_patched
2020-11-18 06:09:48: if not self._hold:
2020-11-18 06:09:48: AttributeError: 'GeoAxesSubplot' object has no attribute '_hold'

Thanks in advance in helping out here and sorry for the daft questions, but I've taken this as far as I can I think without more intimate working knowledge of the model...

@wcarthur
Copy link
Member

It looks like the first time through, you've built the database files, and populated tblEvents with details of the simulated tracks. See lines 6-9:

2020-11-17 21:45:55: Creating hazard database
2020-11-17 21:45:55: Running database update
2020-11-17 21:45:55: Creating location database
2020-11-17 21:45:55: Couldn't open dat file ./output/port_hedland_eval/process/dat/port_hedland.dat
2020-11-17 21:45:55: Building the hazard database...
2020-11-17 21:45:55: Creating table tblLocations
2020-11-17 21:45:55: Creating table tblEvents
2020-11-17 21:45:55: Creating table tblWindSpeed
2020-11-17 21:45:55: Creating table tblHazard
2020-11-17 21:45:56: Creating table tblTracks
2020-11-17 21:45:56: Inserting records into tblHazard
2020-11-17 21:45:56: Traceback (most recent call last):
2020-11-17 21:45:56: File "tcrm.py", line 648, in startup
...

On running a second time through, the database already exists, and it's not set up to overwrite the existing data. Quickest solution in this case is to delete the hazard.db and locations.db files that were generated before re-running the model.

The plotting error seems to be buried in the cartopy library - I can't immediately see anywhere that the hold methods are called in the TCRM plotting routines. I have seen an issue like those with cartopy before, but can't immediately put my mind to where it was, or the cause of it.

@richsdixon
Copy link
Author

The plotting error seems to be buried in the cartopy library - I can't immediately see anywhere that the hold methods are called in the TCRM plotting routines. I have seen an issue like those with cartopy before, but can't immediately put my mind to where it was, or the cause of it.

Thanks for the issue re: the hazard and location .db files. Re: the cartopy error I'd found another error (that I didn't note) that a suggestion online mentioned it was an issue with Cartopy 1.0.16: so I am now using Cartopy 1.0.18 - so maybe this is the cause.

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