nansencenter / sea_ice_drift

Sea ice drift from Sentinel-1 SAR imagery using open source feature tracking
GNU General Public License v3.0
41 stars 17 forks source link

sid.get_drift_FT() Error #10

Closed Antarekai closed 6 years ago

Antarekai commented 6 years ago

uft, vft, lon1ft, lat1ft, lon2ft, lat2ft = sid.get_drift_FT() was error ValueError: does not have metadata time_coverage_start

How can I solve this problem?

lucearth commented 6 years ago

Hi, I have exactly the same problem than Antarekai, it looks that get_drift somehow erase the metadata and just keep/change it to {'filename': '/vsimem/VF2RNYE1OL.vrt'},

Thank you,

Luc

akorosov commented 6 years ago

Hello guys! Thank you for interest! I'll have a look at it. Maybe it comes from a newer version of Nansat.

akorosov commented 6 years ago

@Antarekai and @lucearth , which data do you use for calculating the drift? I believe I know the source of the problem. get_drift_FT() relies on Nansat to get time of the first and the second image. It should work well for Sentinel-1 and ASAR data but may fail for other satellite products. If you ask to derive ice drift from images not supported by Nansat - it may not be able to. So which data do you use?

lucearth commented 6 years ago

Hi @akorosov , Thanks for the quick answer, I used the files from the example (Sentinel 1 tif files), if I open it with the function Nansat, there is absolutely no problem, if I show you the corresponding n.get_metadata() I get : {'AREA_OR_POINT': 'Area', 'ORBIT_DIRECTION': 'Ascending', 'TIFFTAG_DATETIME': '2016:10:05 20:31:44', 'TIFFTAG_IMAGEDESCRIPTION': 'Sentinel-1A EW GRD MR L1', 'TIFFTAG_SOFTWARE': 'Sentinel-1 IPF 002.72', 'filename': '/vsimem/L155IGXKDO.vrt', 'instrument': '{"Category": "Earth Remote Sensing Instruments", "Class": "Active Remote Sensing", "Type": "Imaging Radars", "Subtype": "", "Short_Name": "SAR", "Long_Name": "Synthetic Aperture Radar"}', 'platform': '{"Category": "Earth Observation Satellites", "Series_Entity": "Sentinel GMES", "Short_Name": "SENTINEL-1A", "Long_Name": ""}', 'satellite': 'unknown', 'sensor': 'unknown', 'source_type': 'unknown', 'time_coverage_end': '2016-10-05T14:25:46.637455', 'time_coverage_start': '2016-10-05T14:24:46.638593'}

The problem is when I use the function get_drift(), if I use %debug to locate the error and print the metadata after preprocessing of the function I get : {'filename': '/vsimem/EL5MTKQ5VC.vrt'} Most of the metadata have gone, Thanks a lot, Luc

akorosov commented 6 years ago

Hi Luc, thank you for detailed answer. It is abit strange because I fixed this bug quite a while ago. You can see here: https://github.com/nansencenter/sea_ice_drift/blob/45474522d85e0ec979013f53fa867e939f167507/sea_ice_drift/lib.py#L220 I copy all metadata from the input file into the sid.n1 and sid.n2 objects.

I made usage of time_coverage_start optional now. If it is not available in the input data then a user should provide max_drift parameter instead of max_speed (which has a default value).

lucearth commented 6 years ago

Thank you for the answer, Somehow I had the old version of Sea ice drift. It is a bit weird, I am sure I git clone the directory. But all good with the commits you show me, Luc

akorosov commented 6 years ago

@lucearth , that great! Can you tell a bit what you are using that for? Just curious...