Closed limaolin1981611 closed 3 years ago
A "cone" is always defined by two points, but you may seed along a segment/track with method seed_along_trajectory. This might not be available for Leeway yet, but I will try to generalise it soon.
Here is an example of seeding from shapefile: https://opendrift.github.io/gallery/example_seed_from_shapefile.html#sphx-glr-gallery-example-seed-from-shapefile-py
This method is a wrapper around seed_within_polygon, which you can use directly if you have extracted the polygons (fom shapefile or other source).
Regarding the questions by email:
I want to use ocean environment data, such as hycom, gfs and wrf. How can I change these data to the format that can be used in opendrift? Are there some examples?
OpenDrift can read almost any CF-compliant netCDF-files. So you should convert the data to this format. Alternatively, you may also make or adapt a reader to your output format.
In issue https://github.com/OpenDrift/opendrift/issues/96, you gave some data that could be used. However, these datas can not be used now.Can you give the new url of these datas?
An updated list of valid Thredds URLs is available in this file: https://github.com/OpenDrift/opendrift/blob/master/opendrift/scripts/data_sources.txt
For the three questions: 1.According to your reply, I can use seed_within_polygon and seed_from_shapefile in leeway. Next, I will make my own polygon and shapefile for my project. 2.I will try to convert the data to CF-compliant netCDF-files. 3.I have looked into the Thredds URLs. The urls below maybe usefull. https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd http://tds.hycom.org/thredds/dodsC/GLBy0.08/latest http://tds.hycom.org/thredds/dodsC/GLBy0.08/expt_93.0/uv3z http://tds.hycom.org/thredds/dodsC/GLBu0.08/expt_91.2/uv3z (1) The three hycom urls The datas of GLBu0.08/expt_91.2 are inactive. The datas of GLBy0.08/expt_93.0 can be download from ftp.
I download hycom_glby_930_2020040512_t180_uv3z.nc from ftp, use reader_netCDF_CF_generic.Reader to read it, but there are some errors as follows:
07:51:01 INFO: Opening dataset: D:\Project\SAR\opendrift-master\tests\test_data\hycom_glby_930_2020040512_t180_uv3z.nc
07:51:01 INFO: Opening file with Dataset
Traceback (most recent call last):
File "D:/Project/SAR/opendrift-master/leeway_demo_point.py", line 28, in
I think the reason is the file is a single file for t180. So, how to use multiple files?
(2)The ncep_global urls The datas can be download from OPENDAP. Can I download datas from ftp or https such as hycom or necp's gfs.
To merge several files with just a single time step, you may use wildcard in the filename.
Whether you can download hycom or ncep from ftp or htp, you should check on the respective websites. I guess this is possible, but OpenDrift will only download directly from OPeNDAP.
I have solved the question about "merge several files and errors of using my gfs and hycom data". I have rewrited the Matlab code according to the files of arome_subset_16Nov2015.nc and norkyst800_subset_16Nov2015.nc.But there are some questions about the x_sea_water_velocity and y_sea_water_velocity:1.In the norkyst800_subset_16Nov2015.nc file, the x_sea_water_velocity and y_sea_water_velocity have attributes of missing_value, scale_factor and add_offset.2.If I add attribute of missing_value to my file, there are errors of "no x_sea_water_velocity and y_sea_water_velocity ".3.How does attributes of missing_value, scale_factor and add_offset worked?
Important thing is that variables have attributtes "standard_name". Is this the case?
Thanks for your reply.
I have added the attributtes "standard_name" correctly to the water_u and water_v files. If I add one or more atributtes among "missing_value", "scale_factor" and "add_offset", the errors appear as follows. If not, it's correct. So how does atrributes of "missing_value", "scale_factor" and "add_offset" work in the opendrift?
C:\ProgramData\Anaconda3\envs\opendrift\python.exe D:/Project/SAR/opendrift-master/leeway_point.py06:19:58 INFO: OpenDriftSimulation initialised (version 1.2.0)06:19:58 INFO: Opening dataset: D:\Project\SAR\opendrift-master\tests\test_data\hycom_gfs/20200403/gfs_1p00_sfc_wind_uv_ChianSea_2020040300_t000_t072.nc06:19:58 INFO: Opening file with Dataset06:19:58 INFO: Opening dataset: D:\Project\SAR\opendrift-master\tests\test_data\hycom_gfs/20200403/hycom_glb_sfc_water_uv_ChianSea_2020040300_t000_t072.nc06:19:58 INFO: Opening file with Dataset06:20:03 INFO: Seeding elements of object type 26: LIFE-RAFT-NB-1 (Life-raft, no ballast (NB) system, general (mean values))06:20:03 WARNING: plotting fast. this will make your plots less accurate.06:20:06 INFO: Time to make plot: 0:00:02.66187606:20:06 INFO: Config validation OK06:20:06 INFO: Adding a dynamical landmask with max. priority based on assumed maximum speed of 1.5 m/s. Adding a customised landmask may be faster...06:20:09 INFO: Using existing reader for land_binary_mask06:20:09 INFO: All points are in ocean06:20:10 INFO: 2020-04-03 00:00:00 - step 1 of 72 - 2000 active elements (0 deactivated)06:20:10 INFO: ========================06:20:10 INFO: Exception:06:20:10 INFO: could not convert string to float: '-30000S'06:20:10 INFO: ========================06:20:10 WARNING: Missing variables: ['x_sea_water_velocity', 'y_sea_water_velocity']06:20:10 WARNING: The simulation stopped before requested end time was reached.06:20:10 INFO: ========================06:20:10 INFO: End of simulation:06:20:10 INFO: No more active elements, quitting.06:20:10 INFO: Traceback (most recent call last): File "D:\Project\SAR\opendrift-master\opendrift\models\basemodel.py", line 2250, in run raise ValueError('No more active elements, quitting.')ValueError: No more active elements, quitting.
06:20:10 INFO: "Missing variables: ['x_sea_water_velocity', 'y_sea_water_velocity']", 'The simulation stopped before requested end time was reached.'
06:20:10 INFO: ========================Traceback (most recent call last): File "D:\Project\SAR\opendrift-master\opendrift\models\basemodel.py", line 2250, in run raise ValueError('No more active elements, quitting.')ValueError: No more active elements, quitting.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "D:/Project/SAR/opendrift-master/leeway_point.py", line 127, in
Process finished with exit code 1
The reading of netCDF-files (and thus parsing of missing_value
, scale_factor
and add_offset
) is handled by the Python-NetCDF4 library, and not directly by OpenDrift.
Could you post a ncdump of your file contents? Best within triple backwards-quotes (`) so that it is better readable on GitHub.
Can Leeway Seed elements along cone which contains more than two points? Can Leeway Seed elements using shapefile?