Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EBVCubeVisualizerPlugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
no67wuwu
EBVCubeVisualizerPlugin
Commits
45b3d2a3
Commit
45b3d2a3
authored
Oct 12, 2022
by
Emmanuel Heriberto Oceguera Conchas
Browse files
Options
Downloads
Patches
Plain Diff
added a new definition to plot and save the data
parent
df97a3f0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
netCDF_visualizer_funtionality.py
+33
-15
33 additions, 15 deletions
netCDF_visualizer_funtionality.py
with
33 additions
and
15 deletions
netCDF_visualizer_funtionality.py
+
33
−
15
View file @
45b3d2a3
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#we import the impotant libraries and modules
#we import the impotant libraries and modules
#always import the libraries and modules at the top of the code
#always import the libraries and modules at the top of the code
from
json
import
load
from
PyQt5.QtCore
import
*
from
PyQt5.QtCore
import
*
from
PyQt5.QtGui
import
*
from
PyQt5.QtGui
import
*
from
PyQt5.QtWidgets
import
*
from
PyQt5.QtWidgets
import
*
...
@@ -101,19 +102,36 @@ class maskAndFuntionality (BASE, WIDGET):
...
@@ -101,19 +102,36 @@ class maskAndFuntionality (BASE, WIDGET):
def
loadNetCDF
(
self
):
def
loadNetCDF
(
self
):
"""
This function loads the netCDF file
"""
"""
This function loads the netCDF file
"""
#we get the path from the text space
#we get the path from the text space
path
=
self
.
text_set
.
text
()
if
self
.
text_set
.
text
()
==
""
:
#if the text space is empty
QmessageBox
.
warning
(
None
,
"
Warning
"
,
"
Please select a netCDF file
"
)
#we show a warning
else
:
#if the text space is not empty
path
=
self
.
text_set
.
text
()
#we get the path from the text space
#we load the netCDF file
#we load the netCDF file
self
.
nc
=
Dataset
(
path
,
'
r
'
,
format
=
'
NETCDF4
'
)
ncFile
=
nc
.
dataset
(
path
,
'
r
'
,
format
=
'
NETCDF4
'
)
#we get the name of the variables
#we get the variables from the netCDF file
self
.
variables
=
self
.
nc
.
variables
.
keys
()
ncVar
=
ncFile
.
variables
#we set the name of the variables in the combo box
#we get the names of the variables
self
.
txt_tab_dataSet
.
addItems
(
self
.
variables
)
ncVarNames
=
ncVar
.
keys
()
#we get the name of the dimensions
#we get the dimensions of the variables
self
.
dimensions
=
self
.
nc
.
dimensions
.
keys
()
ncVarDimensions
=
ncVar
.
values
()
#we set the name of the dimensions in the combo box
#we get the attributes of the variables
self
.
txt_tab_dataSet
.
addItems
(
self
.
dimensions
)
ncVarAttributes
=
ncVar
.
values
()
#we get the values of the variables
ncVarValues
=
ncVar
.
values
()
#we get the units of the variables
ncVarUnits
=
ncVar
.
values
()
#we show the variables in the list
self
.
list_variables
.
addItems
(
ncVarNames
)
#we show the dimensions in the list
self
.
list_dimensions
.
addItems
(
ncVarDimensions
)
#we show the attributes in the list
self
.
list_attributes
.
addItems
(
ncVarAttributes
)
#we show the values in the list
self
.
list_values
.
addItems
(
ncVarValues
)
#we show the units in the list
self
.
list_units
.
addItems
(
ncVarUnits
)
#we close the netCDF file
ncFile
.
close
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment