Skip to content

Commit 0478ea9

Browse files
committed
Cater for ERA5 weather data cells
1 parent 4214f4f commit 0478ea9

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

dataview.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,8 @@ def getData(self, sheet=None):
775775
def in_map(a_min, a_max, b_min, b_max):
776776
return (a_min <= b_max) and (b_min <= a_max)
777777

778+
lat_dim = self.scene.coord_grid[0]
779+
lon_dim = self.scene.coord_grid[1]
778780
self.clear_DataView()
779781
self.dataview_vars = {}
780782
self.dataview_items = []
@@ -817,9 +819,9 @@ def in_map(a_min, a_max, b_min, b_max):
817819
else:
818820
a_lat = 0
819821
a_lon = 0
820-
if in_map(a_lat - 0.25, a_lat + 0.25, self.scene.map_lower_right[0],
822+
if in_map(a_lat - lat_dim / 2., a_lat + lat_dim / 2., self.scene.map_lower_right[0],
821823
self.scene.map_upper_left[0]) \
822-
and in_map(a_lon - 0.3333, a_lon + 0.3333,
824+
and in_map(a_lon - lon_dim / 2., a_lon + lon_dim / 2.,
823825
self.scene.map_upper_left[1], self.scene.map_lower_right[1]):
824826
self.datacells.append([stn.lat, stn.lon])
825827
for i in tmp_tech:
@@ -839,9 +841,9 @@ def in_map(a_min, a_max, b_min, b_max):
839841
except:
840842
continue
841843
a_lon = float(self.dataview_worksheet.cell_value(curr_row, self.dataview_vars['Longitude']))
842-
if in_map(a_lat - 0.25, a_lat + 0.25, self.scene.map_lower_right[0],
844+
if in_map(a_lat - lat_dim / 2., a_lat + lat_dim / 2., self.scene.map_lower_right[0],
843845
self.scene.map_upper_left[0]) \
844-
and in_map(a_lon - 0.3333, a_lon + 0.3333,
846+
and in_map(a_lon - lon_dim / 2., a_lon + lon_dim / 2.,
845847
self.scene.map_upper_left[1], self.scene.map_lower_right[1]):
846848
try:
847849
self.datacells.append([float(self.dataview_worksheet.cell_value(curr_row, self.dataview_vars['Latitude'])),
@@ -896,15 +898,17 @@ def dv_setText():
896898
self.dataview_items.append(txt)
897899
self.scene.addItem(self.dataview_items[-1])
898900

901+
lat_dim = self.scene.coord_grid[0]
902+
lon_dim = self.scene.coord_grid[1]
899903
self.clear_DataView()
900904
opacity = self.opacitySpin.value()
901905
plot_scale = self.scaleSpin.value()
902-
lon_cell = .3125
906+
lon_cell = lon_dim / 2.
903907
cells = []
904908
if self.xsheet.currentText() == 'Exclude':
905909
for cell in self.datacells:
906-
lat = round(round(cell[0] / 0.5, 0) * 0.5, 4)
907-
lon = round(round(cell[1] / 0.625, 0) * 0.625, 4)
910+
lat = round(round(cell[0] / lat_dim, 0) * lat_dim, 4)
911+
lon = round(round(cell[1] / lon_dim, 0) * lon_dim, 4)
908912
ignore = False
909913
for exclude in self.exclude:
910914
if exclude[0] == lat and exclude[1] == lon:
@@ -919,8 +923,8 @@ def dv_setText():
919923
if self.gridcentre.isChecked():
920924
lat_lons = {}
921925
for cel in range(len(cells) -1, -1, -1):
922-
lat = round(round(cells[cel][0] / 0.5, 0) * 0.5, 4)
923-
lon = round(round(cells[cel][1] / 0.625, 0) * 0.625, 4)
926+
lat = round(round(cells[cel][0] / lat_dim, 0) * lat_dim, 4)
927+
lon = round(round(cells[cel][1] / lon_dim, 0) * lon_dim, 4)
924928
lat_lon = str(lat) + '_' + str(lon)
925929
if lat_lon in lat_lons.keys():
926930
tc = lat_lons[lat_lon]
@@ -1002,9 +1006,9 @@ def dv_setText():
10021006
continue
10031007
lat = cell[0]
10041008
lon = cell[1]
1005-
p = self.scene.mapFromLonLat(QtCore.QPointF(lon - lon_cell, lat + .25))
1006-
pe = self.scene.mapFromLonLat(QtCore.QPointF(lon + lon_cell, lat + .25))
1007-
ps = self.scene.mapFromLonLat(QtCore.QPointF(lon - lon_cell, lat - .25))
1009+
p = self.scene.mapFromLonLat(QtCore.QPointF(lon - lon_cell, lat + lat_dim / 2.))
1010+
pe = self.scene.mapFromLonLat(QtCore.QPointF(lon + lon_cell, lat + lat_dim / 2.))
1011+
ps = self.scene.mapFromLonLat(QtCore.QPointF(lon - lon_cell, lat - lat_dim / 2.))
10081012
if plot_scale != 1.:
10091013
x_di = (pe.x() - p.x()) * (1 - plot_scale) / 2.
10101014
y_di = (ps.y() - p.y()) * (1 - plot_scale) / 2.

help.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -3570,12 +3570,12 @@ <h3 id="resourcegrid">Resource Grids</h3>
35703570
<p>This feature utilises summary data stored in a file rather than having to process hourly data from the weather files (see <a href="#resource">Visualising Renewable Resource Attributes</a>).</p>
35713571
<div class="experiment">
35723572
<h3 id="dataview">Data View</h3>
3573-
<p>This experimental feature overlays a set of pie charts or bar charts on the Powermap map, either at individual station locations or based upon the grid of MERRA-2 &ldquo;weather&rdquo; cells. It can be used to visualise the contribution to overall generation from a group of stations. This could assist with identifying optimal placement of stations. For example, identifying potential Renewable Energy Zones could be assisted by running SAM models for identically sized stations placed within each of the cells. When the program is invoked it will display Powermap's coordinates grid. By default the grid is based on geographic coordinates but can be set to show the MERRA-2 cells by setting the <em>merra2_grid</em> property of the <a href="#p_view">[View]</a> Section of the Preferences file to <em>True</em>. The program can accept data in two formats:</p>
3573+
<p>This experimental feature overlays a set of pie charts or bar charts on the Powermap map, either at individual station locations or based upon the grid of &ldquo;weather&rdquo; cells. It can be used to visualise the contribution to overall generation from a group of stations. This could assist with identifying optimal placement of stations. For example, identifying potential Renewable Energy Zones could be assisted by running SAM models for identically sized stations placed within each of the cells. When the program is invoked it will display Powermap's coordinates grid. By default the grid is based on geographic coordinates but can be set to show the weather cells by setting the <em>coord_grid</em> property of the <a href="#p_view">[View]</a> Section of the Preferences file to either <em>e</em> for ERA5-derived weather data or <em>m</em> for MERRA-2 derived weather data. The program can accept data in two formats:</p>
35743574
<ol>
35753575
<li>A table of latitudes and longitudes containing the generation in each location for a number of RE technologies, or</li>
35763576
<li>The summary table from a Powermodel execution from Powermap which contains a list of stations, their technology and generation. This format requires the stations in the list to be present in the Scenarios loaded into Powermap</li>
35773577
</ol>
3578-
<p>The program analyses the generation figures for each or all technologies and ovelays charts that show the relative generation for each station or weather cell compared to the maximum generation figure. In Bar Charts the bars are relative to the maximum generation for any technology while percentages are either relative to the total for the cell or for each technology. In Pie Charts the pie slices indicate the contribution of each technology and the total pie slices and percentages are relative to the maximum generation. The base size (scale) of the charts are the same size as the MERRA-2 cells.</p>
3578+
<p>The program analyses the generation figures for each or all technologies and ovelays charts that show the relative generation for each station or weather cell compared to the maximum generation figure. In Bar Charts the bars are relative to the maximum generation for any technology while percentages are either relative to the total for the cell or for each technology. In Pie Charts the pie slices indicate the contribution of each technology and the total pie slices and percentages are relative to the maximum generation. The base size (scale) of the charts are the same size as the weather cells.</p>
35793579
<p>The Data View options (Properties) are specified in the <a href="#p_dataview">[Dataview]</a> Section of the Preferences file. The associated property is indicated in brackets at the end of the description. The Data View menu displayed by invoking the <em>Show Data View</em> menu option. The menu presented has the following fields:</p>
35803580
<table border="0" class="none">
35813581
<tr><td class="top" style="width: 15%;"><dfn>Recent Files</dfn></td>

0 commit comments

Comments
 (0)