Skip to content

Commit

Permalink
Adding new NASA SPoRT data source
Browse files Browse the repository at this point in the history
  • Loading branch information
resmaili committed Mar 21, 2024
1 parent 678941d commit f9f3931
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 159 deletions.
116 changes: 58 additions & 58 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
name: documentation
on:
push:
branches:
- main
- master
# paths:
# - docs/**

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 1

# This off the shelf is faster, but doesn't support autodoc/sphinx_gallery
# - name: Build sphinx docs
# uses: ammaraskar/sphinx-action@master
# with:
# docs-folder: "docs/"

# Manual install - works but takes longer
- name: Install Conda and Environment
uses: ./.github/actions/install-conda
with:
python-version: 3.9

- name: Build documents
shell: bash -l {0}
run: |
conda activate devel
pip install -e .
cd docs
cp ../LICENSE.rst ../docs/source/license.rst
cp ../CONTRIBUTING.rst ../docs/source/contributing.rst
cp ../CHANGELOG.rst ../docs/source/changelog.rst
make html
touch build/html/.nojekyll
cd ..
- name: Deploy docs to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build/html/
clean: true
branch: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
clean-exclude: |
.nojekyll
*.md
# name: documentation
# on:
# push:
# branches:
# - main
# - master
# # paths:
# # - docs/**

# jobs:
# docs:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source
# uses: actions/checkout@v3
# with:
# fetch-depth: 1

# # This off the shelf is faster, but doesn't support autodoc/sphinx_gallery
# # - name: Build sphinx docs
# # uses: ammaraskar/sphinx-action@master
# # with:
# # docs-folder: "docs/"

# # Manual install - works but takes longer
# - name: Install Conda and Environment
# uses: ./.github/actions/install-conda
# with:
# python-version: 3.9

# - name: Build documents
# shell: bash -l {0}
# run: |
# conda activate devel
# pip install -e .

# cd docs

# cp ../LICENSE.rst ../docs/source/license.rst
# cp ../CONTRIBUTING.rst ../docs/source/contributing.rst
# cp ../CHANGELOG.rst ../docs/source/changelog.rst

# make html

# touch build/html/.nojekyll

# cd ..

# - name: Deploy docs to gh-pages
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# folder: docs/build/html/
# clean: true
# branch: gh-pages
# token: ${{ secrets.GITHUB_TOKEN }}
# clean-exclude: |
# .nojekyll
# *.md
15 changes: 8 additions & 7 deletions datasources/available.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,14 @@ def _availableat_sharp(dt):
##################################

# NUCAPS DATA AVAILABILITY - JTS
nucaps_conus_j01_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/j01/txt/"
nucaps_conus_aq0_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/aq0/txt/"
nucaps_conus_m01_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m01/txt/"
nucaps_conus_m02_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m02/txt/"
nucaps_conus_m03_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m03/txt/"
nucaps_caribbean_j01_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/caribbean/sharppy/j01/txt/"
nucaps_alaska_j01_url = "https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/alaska/sharppy/j01/txt/"
nucaps_conus_j01_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/j01/txt/"
nucaps_conus_j02_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/j02/txt/"
nucaps_conus_aq0_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/sharppy/aq0/txt/"
nucaps_conus_m01_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m01/txt/"
nucaps_conus_m02_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m02/txt/"
nucaps_conus_m03_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/sharppy/m03/txt/"
nucaps_caribbean_j01_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/caribbean/sharppy/j01/txt/"
nucaps_alaska_j01_url = "https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/alaska/sharppy/j01/txt/"
nucaps_text = ""

##################################
Expand Down
3 changes: 2 additions & 1 deletion datasources/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(self, ds_name, config):
DAY = str(line.split(',')[5])
TIME = str(line.split(',')[6])

remote_csv = f'https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/{region}/sharppy/{satID}/csv/{YEAR}{MONTH}{DAY}{TIME}/{satID}_{region}.csv'
remote_csv = f'https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/{region}/sharppy/{satID}/csv/{YEAR}{MONTH}{DAY}{TIME}/{satID}_{region}.csv'
self._csv_fields, self._points = loadNUCAPS_CSV(remote_csv)
else:
# Do nothing if data source name in xml does not match the selected data source.
Expand Down Expand Up @@ -288,6 +288,7 @@ def getAvailableAtTime(self, **kwargs):
stns_avail = self.getPoints()
if self._name.lower() in available.availableat and self._ds_name.lower() in available.availableat[self._name.lower()]:
#avail = available.availableat[self._name.lower()][self._ds_name.lower()](dt)

try:
avail = available.availableat[self._name.lower()][self._ds_name.lower()](dt)
stns_avail = []
Expand Down
20 changes: 13 additions & 7 deletions datasources/standard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,37 @@
</outlet>
</datasource>
<datasource name="NUCAPS CONUS NOAA-20" ensemble="false" observed="true">
<outlet name="STC" url="https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<outlet name="STC" url="https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<time first="0" range="0" delta="0" offset="0" delay="1" cycle="1200" archive="2184" start="-" end="-"/>
<points csv="nucaps_default.csv" />
</outlet>
</datasource>
<datasource name="NUCAPS CONUS MetOp-B" ensemble="false" observed="true">
<outlet name="STC" url="https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<!-- <datasource name="NUCAPS CONUS NOAA-21" ensemble="false" observed="true">
<outlet name="STC" url="https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<time first="0" range="0" delta="0" offset="0" delay="1" cycle="1200" archive="2184" start="-" end="-"/>
<points csv="nucaps_default.csv" />
</outlet>
</datasource>
</datasource> -->
<!-- <datasource name="NUCAPS CONUS MetOp-B" ensemble="false" observed="true">
<outlet name="STC" url="https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<time first="0" range="0" delta="0" offset="0" delay="1" cycle="1200" archive="2184" start="-" end="-"/>
<points csv="nucaps_default.csv" />
</outlet>
</datasource> -->
<datasource name="NUCAPS CONUS MetOp-C" ensemble="false" observed="true">
<outlet name="STC" url="https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m03/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<outlet name="STC" url="https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/conus/sharppy/m03/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<time first="0" range="0" delta="0" offset="0" delay="1" cycle="1200" archive="2184" start="-" end="-"/>
<points csv="nucaps_default.csv" />
</outlet>
</datasource>
<datasource name="NUCAPS Caribbean NOAA-20" ensemble="false" observed="true">
<outlet name="STC" url="https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/caribbean/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<outlet name="STC" url="https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/caribbean/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<time first="0" range="0" delta="0" offset="0" delay="1" cycle="1200" archive="2184" start="-" end="-"/>
<points csv="nucaps_default.csv" />
</outlet>
</datasource>
<datasource name="NUCAPS Alaska NOAA-20" ensemble="false" observed="true">
<outlet name="STC" url="https://geo.nsstc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/alaska/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<outlet name="STC" url="https://nssrgeo.ndc.nasa.gov/SPoRT/jpss-pg/nucaps/gridded/alaska/sharppy/j01/txt/{year}{month}{day}{cycle}/{srcid}.txt" format="nucaps" >
<time first="0" range="0" delta="0" offset="0" delay="1" cycle="1200" archive="2184" start="-" end="-"/>
<points csv="nucaps_default.csv" />
</outlet>
Expand Down
149 changes: 63 additions & 86 deletions runsharp/full_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

NUCAPS_reg_sat = {
"NUCAPS CONUS NOAA-20": ["conus", "j01"],
"NUCAPS CONUS NOAA-21": ["conus", "j02"],
"NUCAPS CONUS Aqua": ["conus", "aq0"],
"NUCAPS CONUS MetOp-A": ["conus", "m02"],
"NUCAPS CONUS MetOp-B": ["conus", "m01"],
"NUCAPS CONUS MetOp-C": ["conus", "m03"],
"NUCAPS Caribbean NOAA-20": ["caribbean", "j01"],
"NUCAPS Alaska NOAA-20": ["alaska", "j01"]
}

# Start the logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(pathname)s %(funcName)s Line #: %(lineno)d %(levelname)-8s %(message)s',
Expand Down Expand Up @@ -538,37 +549,15 @@ def update(times):
self.run_dropdown.update()

if len(filtered_times) > 0:
# JTS - Handle how real-time and off-line NUCAPS data is displayed.
if self.model == "NUCAPS Case Study NOAA-20" \
or self.model == "NUCAPS Case Study Suomi-NPP" \
or self.model == "NUCAPS Case Study Aqua" \
or self.model == "NUCAPS Case Study MetOp-A" \
or self.model == "NUCAPS Case Study MetOp-B" \
or self.model == "NUCAPS Case Study MetOp-C":
# Reading in archived NUCAPS data
if ("NUCAPS Case Study" in self.model):
self.run_dropdown.clear()
self.run_dropdown.addItem(self.tr("- Viewing archived data - "))
self.run_dropdown.setCurrentIndex(0)
self.run_dropdown.update()
self.run_dropdown.setEnabled(False)
elif self.model == "NUCAPS CONUS NOAA-20" \
or self.model == "NUCAPS CONUS Suomi-NPP" \
or self.model == "NUCAPS CONUS Aqua" \
or self.model == "NUCAPS CONUS MetOp-A" \
or self.model == "NUCAPS CONUS MetOp-B" \
or self.model == "NUCAPS CONUS MetOp-C" \
or self.model == "NUCAPS Caribbean NOAA-20" \
or self.model == "NUCAPS Caribbean Suomi-NPP" \
or self.model == "NUCAPS Caribbean Aqua" \
or self.model == "NUCAPS Caribbean MetOp-A" \
or self.model == "NUCAPS Caribbean MetOp-B" \
or self.model == "NUCAPS Caribbean MetOp-C" \
or self.model == "NUCAPS Alaska NOAA-20" \
or self.model == "NUCAPS Alaska Suomi-NPP" \
or self.model == "NUCAPS Alaska Aqua" \
or self.model == "NUCAPS Alaska MetOp-A" \
or self.model == "NUCAPS Alaska MetOp-B" \
or self.model == "NUCAPS Alaska MetOp-C":

# Reading NUCAPS data
elif ("NUCAPS" in self.model) and ("Case Study" not in self.model):
# Load the empty csv for days that have no data and refresh the map.
self.data_sources = data_source.loadDataSources()
self.run_dropdown.setCurrentIndex(times.index(self.run))
Expand All @@ -581,38 +570,15 @@ def update(times):
self.run_dropdown.setCurrentIndex(times.index(self.run))
self.run_dropdown.update()
self.run_dropdown.setEnabled(True)

elif len(filtered_times) == 0:
if self.model == "Observed" \
or self.model == "NUCAPS Case Study NOAA-20" \
or self.model == "NUCAPS Case Study Suomi-NPP" \
or self.model == "NUCAPS Case Study Aqua" \
or self.model == "NUCAPS Case Study MetOp-A" \
or self.model == "NUCAPS Case Study MetOp-B" \
or self.model == "NUCAPS Case Study MetOp-C":
string = "obs"
elif self.model == "NUCAPS CONUS NOAA-20" \
or self.model == "NUCAPS CONUS Suomi-NPP" \
or self.model == "NUCAPS CONUS Aqua" \
or self.model == "NUCAPS CONUS MetOp-A" \
or self.model == "NUCAPS CONUS MetOp-B" \
or self.model == "NUCAPS CONUS MetOp-C" \
or self.model == "NUCAPS Caribbean NOAA-20" \
or self.model == "NUCAPS Caribbean Suomi-NPP" \
or self.model == "NUCAPS Caribbean Aqua" \
or self.model == "NUCAPS Caribbean MetOp-A" \
or self.model == "NUCAPS Caribbean MetOp-B" \
or self.model == "NUCAPS Caribbean MetOp-C" \
or self.model == "NUCAPS Alaska NOAA-20" \
or self.model == "NUCAPS Alaska Suomi-NPP" \
or self.model == "NUCAPS Alaska Aqua" \
or self.model == "NUCAPS Alaska MetOp-A" \
or self.model == "NUCAPS Alaska MetOp-B" \
or self.model == "NUCAPS Alaska MetOp-C":
# Load the empty csv for days that have no data and refresh the map.
if ("Observed" in self.model) or ("NUCAPS" in self.model):
string = "obs"
self.data_sources = data_source.loadDataSources()
if ("Case Study" not in self.model):
self.data_sources = data_source.loadDataSources()
else:
string = "runs"

self.run_dropdown.addItem(self.tr("- No " + string + " available - "))
self.run_dropdown.setCurrentIndex(0)
self.run_dropdown.update()
Expand Down Expand Up @@ -712,42 +678,53 @@ def get_run(self, index):
logging.debug("Calling full_gui.get_run")

# JTS - The region and satID strings will be used to construct the dynamic path to the csv files in data_source.py.
if self.model == "NUCAPS CONUS NOAA-20":
region = 'conus'
satID = 'j01'
elif self.model == "NUCAPS CONUS Aqua":
region = 'conus'
satID = 'aq0'
elif self.model == "NUCAPS CONUS MetOp-A":
region = 'conus'
satID = 'm02'
elif self.model == "NUCAPS CONUS MetOp-B":
region = 'conus'
satID = 'm01'
elif self.model == "NUCAPS CONUS MetOp-C":
region = 'conus'
satID = 'm03'
elif self.model == "NUCAPS Caribbean NOAA-20":
region = 'caribbean'
satID = 'j01'
elif self.model == "NUCAPS Alaska NOAA-20":
region = 'alaska'
satID = 'j01'
# if self.model == "NUCAPS CONUS NOAA-20":
# region = 'conus'
# satID = 'j01'
# if self.model == "NUCAPS CONUS NOAA-21":
# region = 'conus'
# satID = 'j02'
# elif self.model == "NUCAPS CONUS Aqua":
# region = 'conus'
# satID = 'aq0'
# elif self.model == "NUCAPS CONUS MetOp-A":
# region = 'conus'
# satID = 'm02'
# elif self.model == "NUCAPS CONUS MetOp-B":
# region = 'conus'
# satID = 'm01'
# elif self.model == "NUCAPS CONUS MetOp-C":
# region = 'conus'
# satID = 'm03'
# elif self.model == "NUCAPS Caribbean NOAA-20":
# region = 'caribbean'
# satID = 'j01'
# elif self.model == "NUCAPS Alaska NOAA-20":
# region = 'alaska'
# satID = 'j01'

# Write the data source, region, satellite ID, year, month, day and time info to a temporary text file.
if self.model.startswith("NUCAPS"):
nucaps_year = self.cal_date.year()
nucaps_month = None
nucaps_day = None

if self.cal_date.month() < 10:
nucaps_month = f'0{self.cal_date.month()}'
else:
nucaps_month = self.cal_date.month()
if self.cal_date.day() < 10:
nucaps_day = f'0{self.cal_date.day()}'
else:
nucaps_day = self.cal_date.day()
lut = NUCAPS_reg_sat[self.model]
region = lut[0]
satID = lut[1]

nucaps_year = self.cal_date.year()
# nucaps_month = None
# nucaps_day = None

# if self.cal_date.month() < 10:
# nucaps_month = f'0{self.cal_date.month()}'
# else:
# nucaps_month = self.cal_date.month()
# if self.cal_date.day() < 10:
# nucaps_day = f'0{self.cal_date.day()}'
# else:
# nucaps_day = self.cal_date.day()

nucaps_day = str(self.cal_date.day()).zfill(2)
nucaps_month = str(self.cal_date.month()).zfill(2)

nucaps_time = self.run_dropdown.currentText()[-8:-4]
selected_ds = self.model
Expand Down
Loading

0 comments on commit f9f3931

Please sign in to comment.