Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 19 additions & 32 deletions .github/workflows/dist-build.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: Build Windows binary
permissions:
contents: read

on:
push:
branches:
- release

env:
APP_RELEASE_VERSION: '0.1'
PYTHON_VERSION: '3.13.7'

jobs:
build-windows:
runs-on: windows-2022
Expand All @@ -15,15 +21,15 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.13.7'
python-version: $PYTHON_VERSION

- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-3.13.7-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-pip-$PYTHON_VERSION-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-3.13.7-
${{ runner.os }}-pip-$PYTHON_VERSION-

- name: Install dependencies
run: pip install -r requirements.txt
Expand All @@ -41,14 +47,14 @@ jobs:
include-package: netCDF4,cftime
include-module: netCDF4.utils
include-data-dir: "C:\\hostedtoolcache\\windows\\Python\\3.13.7\\x64\\Lib\\site-packages\\offline_folium=offline_folium"
include-data-files: "qwebchannel.js=qwebchannel.js"
include-data-files: "qwebchannel.js=qwebchannel.js,offline_folium=offline_folium"
nofollow-import-to: scipy.integrate
copyright: 'GNU General Public License v3.0'
#windows-console-mode: disable
windows-icon-from-ico: 'icon.png'
company-name: 'Rok Kuk'
product-name: 'NetSeeDF'
file-version: '0.1'
file-version: $APP_RELEASE_VERSION

- name: Upload artifact
id: artifact_upload
Expand All @@ -58,12 +64,6 @@ jobs:
name: dist-build-windows
path: build

- name: If executable upload success
if: steps.artifact_upload.conclusion == 'success'
run: |
echo "Executable uploaded successfully" >> $GITHUB_STEP_SUMMARY
echo "uploaded='true'" >> $GITHUB_OUTPUT

- name: If executable upload fails
if: failure() && steps.artifact_upload.conclusion == 'failure'
run: |
Expand All @@ -80,15 +80,15 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.13.7'
python-version: $PYTHON_VERSION

- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-3.13.7-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-pip-$PYTHON_VERSION-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-3.13.7-
${{ runner.os }}-pip-$PYTHON_VERSION-

- name: Install dependencies
run: pip install -r requirements.txt
Expand All @@ -113,7 +113,7 @@ jobs:
macos-app-icon: 'icon.png'
company-name: 'Rok Kuk'
macos-app-name: 'NetSeeDF'
macos-app-version: '0.1'
macos-app-version: $APP_RELEASE_VERSION

- name: Upload artifact
id: artifact_upload
Expand All @@ -123,12 +123,6 @@ jobs:
name: dist-build-macos
path: build

- name: If executable upload success
if: steps.artifact_upload.conclusion == 'success'
run: |
echo "Executable uploaded successfully" >> $GITHUB_STEP_SUMMARY
echo "uploaded='true'" >> $GITHUB_OUTPUT

- name: If executable upload fails
if: failure() && steps.artifact_upload.conclusion == 'failure'
run: |
Expand All @@ -145,23 +139,22 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.13.7'
python-version: $PYTHON_VERSION

- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-3.13.7-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-pip-$PYTHON_VERSION-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-3.13.7-
${{ runner.os }}-pip-$PYTHON_VERSION-

- name: Install dependencies
run: pip install -r requirements.txt

- name: Install offline_folium map files
run: python -m offline_folium

# Remove problematic brew libs if Intel Mac
- name: Remove problematic brew libs
run: |
brew remove --force --ignore-dependencies openssl@3
Expand All @@ -184,7 +177,7 @@ jobs:
macos-app-icon: 'icon.png'
company-name: 'Rok Kuk'
macos-app-name: 'NetSeeDF'
macos-app-version: '0.1'
macos-app-version: $APP_RELEASE_VERSION

- name: Upload artifact
id: artifact_upload
Expand All @@ -194,12 +187,6 @@ jobs:
name: dist-build-macos-intel
path: build

- name: If executable upload success
if: steps.artifact_upload.conclusion == 'success'
run: |
echo "Executable uploaded successfully" >> $GITHUB_STEP_SUMMARY
echo "uploaded='true'" >> $GITHUB_OUTPUT

- name: If executable upload fails
if: failure() && steps.artifact_upload.conclusion == 'failure'
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ dist
.venv
profile_stats.prof
netseedf.dist
netseedf.build
netseedf.onefile-build
netseedf.cmd
netseedf.exe
7 changes: 7 additions & 0 deletions datawindow_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ def __init__(self, file_name, variable_name, file_path):
except Exception:
pass

# display description of the variable if given in the NetCDF file
try:
desc_label = QLabel("Description: \t" + variable_data.description, wordWrap=True)
layout.addWidget(desc_label)
except Exception:
pass

# display the data in a table
data_table = QTableWidget(self)
data_table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers)
Expand Down
9 changes: 7 additions & 2 deletions datawindow_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ def __init__(self, file_name, variable_name, file_path):
except Exception:
pass

print(ncfile.variables)

# display calendar type if given the NetCDF file
try:
if variable_data.calendar is not None:
Expand All @@ -54,6 +52,13 @@ def __init__(self, file_name, variable_name, file_path):
except Exception:
pass

# display description of the variable if given in the NetCDF file
try:
desc_label = QLabel("Description: \t" + variable_data.description, wordWrap=True)
layout.addWidget(desc_label)
except Exception:
pass

# display the data in a table
data_table = QTableView(self)
data_table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers)
Expand Down
7 changes: 7 additions & 0 deletions datawindow_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ def __init__(self, file_name, variable_name, file_path):
except Exception:
pass

# display description of the variable if given in the NetCDF file
try:
desc_label = QLabel("Description: \t" + variable_data.description, wordWrap=True)
layout.addWidget(desc_label)
except Exception:
pass

# display the data in a table
data_table = QTableView(self)
data_table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers)
Expand Down
30 changes: 15 additions & 15 deletions netseedf.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ def on_selection_change(self, current, previous):


if __name__ == "__main__":
import argparse
import cProfile
#import argparse
#import cProfile

parser = argparse.ArgumentParser(description="NetSeeDF Application")
parser.add_argument('--profile', action='store_true', help='Enable profiling')
args = parser.parse_args()
#parser = argparse.ArgumentParser(description="NetSeeDF Application")
#parser.add_argument('--profile', action='store_true', help='Enable profiling')
#args = parser.parse_args()

try: # Set taskbar icon on Windows
from ctypes import windll # Only exists on Windows.
Expand All @@ -251,13 +251,13 @@ def on_selection_change(self, current, previous):
window = MainWindow()
window.show()

if args.profile:
profile_filename = 'profile_stats.prof'
print(f"Profiling enabled. Results will be saved to {profile_filename}")
with cProfile.Profile() as pr:
exit_code = app.exec()
pr.dump_stats(profile_filename)
print(f"Profile data saved to {profile_filename}. You can analyze it with 'python -m pstats {profile_filename}' or a visualization tool like SnakeViz.")
sys.exit(exit_code)
else:
sys.exit(app.exec())
# if args.profile:
# profile_filename = 'profile_stats.prof'
# print(f"Profiling enabled. Results will be saved to {profile_filename}")
# with cProfile.Profile() as pr:
# exit_code = app.exec()
# pr.dump_stats(profile_filename)
# print(f"Profile data saved to {profile_filename}. You can analyze it with 'python -m pstats {profile_filename}' or a visualization tool like SnakeViz.")
# sys.exit(exit_code)
# else:
sys.exit(app.exec())
11 changes: 8 additions & 3 deletions plotwindow_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ def __init__(self, file_name, variable_name, file_path):
except Exception:
pass

ncfile.close()
# display description of the variable if given in the NetCDF file
try:
desc_label = QLabel("Description: \t" + variable_data.description, wordWrap=True)
layout.addWidget(desc_label)
except Exception:
pass

scheme = QWebEngineUrlScheme(b'qrc')
scheme.setFlags(QWebEngineUrlScheme.Flag.LocalScheme | QWebEngineUrlScheme.Flag.LocalAccessAllowed)
Expand All @@ -107,10 +112,10 @@ def __init__(self, file_name, variable_name, file_path):
maplayout.addWidget(self.view)

# intial data load
ncfile = Dataset(self.file_path, "r")
variable_data = ncfile.variables[self.variable_name]
masked_data = ma.masked_equal(variable_data, self.fill_value)

ncfile.close()

image, colorbar = self.getb64image(masked_data)

# map raster layer
Expand Down
13 changes: 9 additions & 4 deletions plotwindow_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ def __init__(self, file_name, variable_name, file_path):
except Exception:
pass

# display description of the variable if given in the NetCDF file
try:
desc_label = QLabel("Description: \t" + variable_data.description, wordWrap=True)
layout.addWidget(desc_label)
except Exception:
pass

slice_selector_widget = QWidget()
slice_selector_layout = QHBoxLayout()
slice_selector_layout.setAlignment(Qt.AlignmentFlag.AlignLeft)
Expand Down Expand Up @@ -156,8 +163,6 @@ def __init__(self, file_name, variable_name, file_path):
self.units_are_kelvin = True
layout.addWidget(temp_convert_widget)

ncfile.close()

scheme = QWebEngineUrlScheme(b'qrc')
scheme.setFlags(QWebEngineUrlScheme.Flag.LocalScheme | QWebEngineUrlScheme.Flag.LocalAccessAllowed)
QWebEngineUrlScheme.registerScheme(scheme)
Expand All @@ -175,15 +180,15 @@ def __init__(self, file_name, variable_name, file_path):
maplayout.addWidget(self.view)

# intial data load
ncfile = Dataset(self.file_path, "r")
variable_data = ncfile.variables[self.variable_name]
if self.slice_dim_index == 0: # select the slice and read it into memory from disk
sliced_data = variable_data[0, :, :]
elif self.slice_dim_index == 1:
sliced_data = variable_data[:, 0, :]
else:
sliced_data = variable_data[:, :, 0]

ncfile.close()

sliced_data = ma.masked_equal(sliced_data, self.fill_value)

image, colorbar = self.getb64image(sliced_data)
Expand Down
Loading