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

Issue15 simplify #16

Merged
merged 53 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
06d470b
#15: simplify SARwind.__init__
mortenwh Apr 15, 2024
c02433b
#15: fix main syntax errors
mortenwh Apr 16, 2024
57676c5
#15: full test coverage
mortenwh Apr 16, 2024
bd2edc2
#15: some metadata corrected
mortenwh Apr 16, 2024
9a3a960
#15: Remove title
mortenwh Apr 17, 2024
1ad13e2
#15: complete and valid metadata
mortenwh Apr 17, 2024
74452a4
#15: fix syntax errors
mortenwh Apr 17, 2024
f3d5781
#15: start revising broker and sar data search
mortenwh Apr 18, 2024
589d35d
#15: add module
mortenwh Apr 21, 2024
519d2c9
#15: revert to Frode's version
mortenwh Apr 21, 2024
fe99933
#15: remove code that is not needed anymore
mortenwh Apr 22, 2024
bf0bd4a
#15: check topography
mortenwh Apr 22, 2024
30a2424
#15: search functions done
mortenwh Apr 22, 2024
9b5d503
#15: prepare script for SAR wind processing
mortenwh Apr 22, 2024
35a571d
#15: remove obsolete tests
mortenwh Apr 22, 2024
8c80dc7
#15: tests
mortenwh Apr 22, 2024
c3c6813
#15: back to full coverage
mortenwh Apr 22, 2024
9985e47
#15: fix syntax
mortenwh Apr 22, 2024
a8ca4bc
#15: check if a SAR dataset has already been processed
mortenwh Apr 22, 2024
8ef4801
#15: change logfile a bit
mortenwh Apr 22, 2024
63a1f98
#15: export MMD and required changes
mortenwh Apr 23, 2024
d27e962
#15: tests passing
mortenwh Apr 24, 2024
b36c76d
#15: minor bug fix
mortenwh Apr 24, 2024
09fe601
#15: bug fix
mortenwh Apr 25, 2024
bc73e07
#15: tests when nansat not installed
mortenwh Apr 26, 2024
6fcf487
#15: full coverage when nansat is installed
mortenwh Apr 26, 2024
9a21fa3
#15: update reqs
mortenwh Apr 26, 2024
986a9b4
#15: fix syntax
mortenwh Apr 26, 2024
d73e53f
#15: change function name and let skiptest rule
mortenwh Apr 26, 2024
8918170
#15: update pytest.ini
mortenwh Apr 26, 2024
4c1ec60
#15: update pytest.ini
mortenwh Apr 26, 2024
e49fdda
#15: fix typo
mortenwh Apr 26, 2024
c282354
#15: pip installable?
mortenwh Apr 26, 2024
12ac510
#15: move script installation
mortenwh Apr 26, 2024
99d1858
#15: try again
mortenwh Apr 26, 2024
4726ac5
#15: try again
mortenwh Apr 26, 2024
300a1ba
#15: add init file
mortenwh Apr 26, 2024
08332ec
#15: test and adapt
mortenwh Apr 29, 2024
f50f55d
#15: fix syntax
mortenwh Apr 29, 2024
46bee07
#15: adjustments after further testing
mortenwh Apr 29, 2024
ed967d1
#15: handle when nansat is not installed
mortenwh Apr 29, 2024
872323b
#15: remove some packages
mortenwh Apr 30, 2024
3b9ab3e
#15: get rid of gcps and use lon/lat bands instead
mortenwh Apr 30, 2024
3ff43bc
#15: clean metadata, and add time of each variable
mortenwh Apr 30, 2024
f8349fa
#15: fix syntax and add docstring
mortenwh Apr 30, 2024
3bd6cf4
#15: more code including projected datasets
mortenwh May 3, 2024
f837a80
#15: should now be quite complete
mortenwh May 3, 2024
dfca42c
#15: update parent MMD and update title
mortenwh May 3, 2024
49112a6
#15: use export2thredds for projected data
mortenwh May 3, 2024
ee8ec1d
#15: check time difference
mortenwh May 4, 2024
63fd5b3
#15: fix syntax
mortenwh May 4, 2024
c6d1e73
#15: adjust check
mortenwh May 4, 2024
17e8d10
#15: update test
mortenwh May 4, 2024
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
5 changes: 2 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
pyTestCov:
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11']
runs-on: ubuntu-latest
steps:
- name: Python Setup
Expand All @@ -24,13 +24,12 @@ jobs:
run: |
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
pip install --upgrade pip
pip install -r requirements.txt
pip install pytest-timeout
pip install pytest-cov
pip install pytest-mock
- name: Run Tests
run: python -m pytest -v -m unittests --cov=sarwind --timeout=120
run: python -m pytest -v --cov=sarwind --timeout=120
- name: Upload to Codecov
uses: codecov/codecov-action@v3
231 changes: 0 additions & 231 deletions broker.py

This file was deleted.

8 changes: 0 additions & 8 deletions config.json

This file was deleted.

6 changes: 5 additions & 1 deletion nansat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ dependencies:
- parallel=20211022=ha770c72_0
- paramiko=2.8.0=pyhd8ed1ab_0
- parmap=1.5.3=pyhd8ed1ab_0
- parso=0.8.2=pyhd8ed1ab_0
- partd=1.2.0=pyhd8ed1ab_0
- pathspec=0.10.3=pyhd8ed1ab_0
- pcre=8.45=h9c3ff4c_0
Expand Down Expand Up @@ -272,3 +271,8 @@ dependencies:
- zipp=3.6.0=pyhd8ed1ab_0
- zlib=1.2.11=h36c2ea0_1013
- zstd=1.4.9=ha95c52a_0
- pip:
- xdg
- pytest
- pytest-cov
- ipdb
Empty file added nansat_mappers/__init__.py
Empty file.
88 changes: 88 additions & 0 deletions nansat_mappers/mapper_sarwind.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import netCDF4

import numpy as np

from nansat.exceptions import WrongMapperError
from nansat.vrt import VRT


class Mapper(VRT):

def __init__(self, filename, gdal_dataset, metadata, *args, **kwargs):

try:
ds = netCDF4.Dataset(filename)
except OSError:
raise WrongMapperError
if "title" not in ds.ncattrs():
raise WrongMapperError
else:
if "urface wind" not in ds.title or "NRCS" not in ds.title:
raise WrongMapperError
longitude = ds['longitude'][:].data
latitude = ds['latitude'][:].data
for attr in ds.ncattrs():
content = ds.getncattr(attr)
metadata[attr] = content
super(Mapper, self)._init_from_lonlat(longitude, latitude)

# Get rid of GDAL additions to metadata keys
metadata = VRT._remove_strings_in_metadata_keys(metadata, ['NC_GLOBAL#', 'GDAL_'])
self.dataset.SetMetadata(metadata)
self.band_vrts = {
"wind_direction": VRT.from_array(ds["wind_direction"][:].filled(fill_value=np.nan)),
"look_relative_wind_direction": VRT.from_array(
ds["look_relative_wind_direction"][:].filled(fill_value=np.nan)),
"windspeed": VRT.from_array(ds["windspeed"][:].filled(fill_value=np.nan)),
"model_windspeed": VRT.from_array(ds["model_windspeed"][:].filled(fill_value=np.nan)),
}

metaDict = []

wdir_metadict = {}
for attr in ds["wind_direction"].ncattrs():
wdir_metadict[attr] = ds["wind_direction"].getncattr(attr)
metaDict.append({
'src': {
'SourceFilename': self.band_vrts["wind_direction"].filename,
'SourceBand': 1
},
'dst': wdir_metadict,
})

lookrel_metadict = {}
for attr in ds["look_relative_wind_direction"].ncattrs():
lookrel_metadict[attr] = ds["look_relative_wind_direction"].getncattr(attr)
metaDict.append({
'src': {
'SourceFilename': self.band_vrts["look_relative_wind_direction"].filename,
'SourceBand': 1
},
'dst': lookrel_metadict,
})

wspeed_metadict = {}
for attr in ds["windspeed"].ncattrs():
wspeed_metadict[attr] = ds["windspeed"].getncattr(attr)
metaDict.append({
'src': {
'SourceFilename': self.band_vrts["windspeed"].filename,
'SourceBand': 1
},
'dst': wspeed_metadict,
})

mwspeed_metadict = {}
for attr in ds["model_windspeed"].ncattrs():
mwspeed_metadict[attr] = ds["model_windspeed"].getncattr(attr)
metaDict.append({
'src': {
'SourceFilename': self.band_vrts["model_windspeed"].filename,
'SourceBand': 1
},
'dst': mwspeed_metadict,
})

self.create_bands(metaDict)

self.fix_global_metadata
Loading
Loading