nansencenter / openwind

A python package for estimating high resolution wind from SAR images
41 stars 26 forks source link

OpenWind incompatible with Nansat #37

Open knutfrode opened 6 years ago

knutfrode commented 6 years ago

I have made two local changes in sar_wind.py to be able to process wind:

Wind is now produced, but results look very wrong, and sometimes gives coredumps.

akorosov commented 6 years ago

I was comparing the output before and after the changes but I think they were identical. I will take a close look at that.

knutfrode commented 6 years ago

In the wind files we are using, wind components have standard_name x_wind, y_wind, whereas OpenWind first looks for eastwards_wind, northwards_wind and then falls back to test for x_wind, y_wind. It could be that these fallback tests are not robust enough in OpenWind(?)

akorosov commented 6 years ago

The only difference I noticed was that in the band 'look_direction' these metadata have disappeared:

  units: degrees
  colormap: jet
  short_name: sensor_azimuth
  long_name: Sensor Azimuth Angle
  standard_name: sensor_azimuth_angle
  minmax: 0 360

This is obviously a bug. But is it this bug which causes problems in OpenWind now?

knutfrode commented 6 years ago

This seems to be one part of the problem, as OpenWind expects metadata "standard_name: sensor_azimuth_angle"

But there seems also to be some issues around "eastwards_wind"/"x_wind". I tried to make a workaround, which apparently works, but erroneous output is produced (see attachment). Processing worked fine until recently, so this must be due to some recent change in either OpenWind or Nansat.

openwind_wind_suspicious

mortenwh commented 6 years ago

Regarding metadata; I have now checked two different datasets, and the get_metadata method fails for band metadata:

In [35]: n.get_metadata(1)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-35-1ea8cc3a52f2> in <module>()
----> 1 n.get_metadata(1)

/home/vagrant/miniconda/lib/python2.7/site-packages/nansat/nansat.pyc in get_metadata(self, key, band_id, bandID)
   1067                 metadata = metadata[key]
   1068             except KeyError:
-> 1069                 raise ValueError('%s does not have metadata %s' % (self.filename, key))
   1070 
   1071         return metadata

Serious Nansat bug needing immediate action..... I am working on some wind retrieval now, so will look for possible other issues as well but won't have time to look into s1...

mortenwh commented 6 years ago

Forget the last comment. get_metadata works - just need to properly follow the docs...

akorosov commented 6 years ago

I've fixed the issue with wkv and standard names. It is soon coming into the master version.

knutfrode commented 6 years ago

I tried again now with the latest master version of Nansat, and the develop-version of OpenWind, but keep getting errors like: Cannot find band {'standard_name': 'eastward_wind'}! band_number is from 1 to 2

Does calculation of wind with OpenWind work for you, for wind files which contain x_wind instead of eastward_wind? E.g. this dataset containing wind may be used for testing: http://thredds.met.no/thredds/catalog/meps25files/catalog.html?dataset=meps25files/meps_det_extracted_2_5km_latest.nc