OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
249 stars 120 forks source link

CMEMS not importing #480

Closed Nichsouz closed 3 years ago

Nichsouz commented 3 years ago

Hello,

I'm trying to import CMEMS data to opendrift but no success. I have used the following line:

o.add_readers_from_list(['{"reader": "reader_cmems", "dataset": "global-analysis-forecast-phy-001-024-hourly-t-u-v-ssh", "cmems_user": cmems_user, "cmems_password": cmems_password}', 'https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd'])

object of type 'NoneType' has no len( ). Creating reader from JSON failed.

knutfrode commented 3 years ago

Hi,

A bug has apparently been introduced recently, so that this CMEMS-reader did not work anymore. However, I made a fix now so that it again works. So please update your OpenDrift and try again.

Nichsouz commented 3 years ago

It worked. Thanks a lot.

If possible, keeping on with the same issue, I've been trying to change the database of CMEMS to MED00-CMCC-CUR-AN-FC-HTS from MEDSEA_ANALYSIS_FORECAST_PHY_006_013 data. I am focusing on the Mediterranean Sea.. and I wished for more accurate data. Apparently, the database set name is not sufficient to make the reader understand the variables. Any suggestions?

Regards,

knutfrode commented 3 years ago

After some trial and error, it seems that one for some reason need to add -DGF to the productID:

cmems = reader_cmems.Reader(
        product='MEDSEA_ANALYSIS_FORECAST_PHY_006_013-DGF',
        dataset='med00-cmcc-cur-an-fc-hts',
        variable_mapping = {
            'u0': 'x_sea_water_velocity',
            'v0': 'y_sea_water_velocity'})

However, the downloaded XML/metadata-file seems to have quite a different structure than for other CMEMS datasets, and therefore the automatic downloading of the netCDF-file does not work. I am not sure which standard this is supposed to follow, and thus it is difficult to make a generic parsing/downloading of CMEMS datasets. It would have been much easier if CMEMS data were available through OPeNDAP/Thredds, but this seems not to happen.

Thus the best way is probably to first download these files locally/manually and then use this as input to OpenDrift simulations. Or alternatively to find a data provider other than CMEMS.

knutfrode commented 3 years ago

Closing this issue. Please re-open if still relevant.