OpenDrift / opendrift

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

Problem in Basemap #17

Closed dharanidharan12 closed 8 years ago

dharanidharan12 commented 8 years ago

Sorry for Troubling you, I just want to create a base map for Chennai Coast. but, I don't know how to create the basemap. Please help me to create the map for Chennai Coast.

Thanks in Advance!!!

knutfrode commented 8 years ago

Hi,

A basemap reader can be created like this by giving the lon and lat values of the lower left corner ("llcrnr") and upper right corner ("urcrnr"):

from readers import reader_basemap_landmask reader_basemap = reader_basemap_landmask.Reader( llcrnrlon=79.7, llcrnrlat=12.6, urcrnrlon=81.0, urcrnrlat=13.8, resolution='f', projection='merc')

Resolution 'f' ('full') is the finest, and may take a few seconds to generate. For more information about the parameters, see the original Basemap documentation: http://matplotlib.org/basemap/api/basemap_api.html Also I recommend to study the example-python-scripts bundled with OpenDrift

Best regards from Knut-Frode

dharanidharan12 commented 8 years ago

Thanks!! now working on it. But ,how to create the netcdf file for the basemap

knutfrode commented 8 years ago

I am not sure what you mean by "creating the netcdf file"?

The created "basemap reader" is a Reader-object which can provide a coastline for an opendrift simulation: https://github.com/knutfrode/opendrift/wiki/How-to-run-a-trajectory-simulation

2016-08-09 15:00 GMT+02:00 Dharani_Dharan notifications@github.com:

Thanks!! now working on it. But ,how to create the netcdf file for the basemap

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/knutfrode/opendrift/issues/17#issuecomment-238545036, or mute the thread https://github.com/notifications/unsubscribe-auth/AE-uo8Zox68SNZokuj1Gix09k6xGtBkfks5qeHoJgaJpZM4Jf0JK .

dharanidharan12 commented 8 years ago

Please Help!!! Right now I am facing issues related to save animated image and to control the flow of oil!

a.plot(filename='path/filename.png') I am getting the plotted image and also the image get saved as png.

how to save the animation image in a directory. here a=OpenOil(loglevel=0) while using

a.animation() I am getting the animation image in gif format But don't know, how to save the (animated image ) gif image (in a specific path).

How to control the oil flow, while running the code it's just like spraying the oil, at a fast rate. how to slow down the flow of oil.

trondkr commented 8 years ago

Just use the optional argument 'filename'. E.g:

plotFilename='figures/myplot.gif' o.plot(linecolor='z',filename=plotFilename)

Will save the plot to the existing local folder 'figures' under the name 'myplot.gif'

dharanidharan12 commented 8 years ago

I changed it , but it's not working for me.. Error ValueError: Format "gif" is not supported.

What I did wrong.. for this changes takeplace, whether it requires any package or file to import

knutfrode commented 8 years ago

If 'gif' does not work, you can try with '.png' for plot() and '.mp4' for animation()

For mp4-animation you might need to install FFMPEG library, as discussed in this section: https://github.com/knutfrode/opendrift/wiki/How-to-run-a-trajectory-simulation#6-plotting-and-analysing-the-results

dharanidharan12 commented 8 years ago

I Am using this code for creating the wind. o.fallback_values['y_wind'] = 05

Whether It is right???

And I want to create current for my location. Which line of code have to implement to create the current.

Thanks in Advance!!

johannesro commented 8 years ago

You have to implement an ocean model to create current for your location. This is not done in opendrift, but with separate models.

For example, use ROMS: http://www.myroms.org/

or download current data from existing ocean models, i.e. https://hycom.org/dataserver/glb-analysis

You will need to read up on how to use these tools and datasets.

dharanidharan12 commented 8 years ago

local variable 'io_module' referenced before assignment error: models/opendrift.py in init, line 187

what i did wrong ...

While migrating the code with the pythonpath.

please help. thanks in advance!!!

knutfrode commented 8 years ago

It is hard to say what causes this error without more information about which commands you have executed, how you set your PATH, etc.

However, it could happen that your folder got messy after the recent structure changes of OpenDrift. I recommend that you delete your whole opendrift-folder, and download and install from scratch, as explained here: https://github.com/knutfrode/opendrift/wiki#download-and-installation

Then you can check that everything works by running the testall-script, and the example-scripts.

2016-09-01 10:12 GMT+02:00 Dharani_Dharan notifications@github.com:

local variable 'io_module' referenced before assignment error: models/opendrift.py in init, line 187

what i did wrong ...

While migrating the code with the pythonpath.

please help. thanks in advance!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/knutfrode/opendrift/issues/17#issuecomment-244007770, or mute the thread https://github.com/notifications/unsubscribe-auth/AE-uoyAcFz_QzcqvkvEPnuqw6p_CRNTCks5qlojygaJpZM4Jf0JK .

dharanidharan12 commented 8 years ago

I migrated the code using the django framework, path and the entire folder were same as in opendrift. just created the foldername as oilapp and pasted the folders and files from opendrift. using urls.py I called the sample file with these lines of code only...

!/usr/bin/env python

from datetime import datetime, timedelta from readers import reader_basemap_landmask from readers import reader_netCDF_CF_generic from models.openoil import OpenOil o = OpenOil(loglevel=0) # Set loglevel to 0 for debug information print o but its showing io_module error.

error: Could not import iomodule netcdf

without django framework , I created a samplefolder and moved the files from opendrift, there it works fine. !Thanks in advance!!

Another Problem

how to use different kinds of oils such as gasoline, kerosene, crudeoil

Please Help!!!

knutfrode commented 8 years ago

OpenDrift has hitherto focussed mainly on the transport (horisontal and vertical) due to various forcing (typical current, wind and waves) Oil weathering is presently very primitive, and basically "density" is the only parameter you can set when seeding (see e.g. example_oil3d_verticalmixing.py). More proper oil weathering will be added to OpenOil and OpenOil3D within the coming months.

For more sophisticated treatment of oil weathering, the NOAA PyGnome model is recommended: https://github.com/NOAA-ORR-ERD/PyGnome

2016-09-01 11:01 GMT+02:00 Dharani_Dharan notifications@github.com:

how to use different kinds of oils such as gasoline, kerosene, crudeoil

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/knutfrode/opendrift/issues/17#issuecomment-244019271, or mute the thread https://github.com/notifications/unsubscribe-auth/AE-uo-RBJRLctUPk1LwpKsf5KJLBwtZBks5qlpRMgaJpZM4Jf0JK .

johannesro commented 8 years ago

delete your opendrift code and download it again in a new directory, that will solve the problem.

Johannes Röhrs, PhD Norwegian Meteorological Institute www.met.no / www.yr.no

johannes.rohrs@met.no +47 41654886

On Thu, Sep 1, 2016 at 10:12 AM, Dharani_Dharan notifications@github.com wrote:

local variable 'io_module' referenced before assignment error: models/opendrift.py in init, line 187

what i did wrong ...

While migrating the code with the pythonpath.

please help. thanks in advance!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/knutfrode/opendrift/issues/17#issuecomment-244007770, or mute the thread https://github.com/notifications/unsubscribe-auth/AITeqzF1A0ON6nrvYORTjlxbQq6KCYLYks5qlojzgaJpZM4Jf0JK .

dharanidharan12 commented 8 years ago

Issue Solved... Thanks I solved the io_module error.

the export folder is not related properly. so the io_netcdf.py is not read.

Now I fixed the issue.

Thanks !!!