{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# OpenBergOld - statistical mode\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime, timedelta\nfrom opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.readers import reader_current_from_track\nfrom opendrift.models.openberg_old import OpenBergOld" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create observation of iceberg track\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "obslon = [3.1, 3.123456]\nobslat = [61.1, 61.132198]\nobstime = [datetime(2015, 11, 16, 0), datetime(2015, 11, 16, 6)]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Initialize model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "steps = 60 # This is the number of forecast steps\no = OpenBergOld(loglevel=30) # Basic drift model suitable for icebergs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Preparing Readers\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "reader_wind = reader_netCDF_CF_generic.Reader(o.test_data_folder() +\n '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc',name='WIND')\n\nreader_current = reader_current_from_track.Reader(\n obslon, obslat, obstime, wind_east=0, wind_north=0,\n windreader=reader_wind, wind_factor=0.018)\n\no.add_reader([reader_current, reader_wind])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seeding elements\n\nIcebergs are moved with the ocean current as per Barker et al (2004),\nin addition to a fraction of the wind speed (wind_drift_factor).\nThis factor depends on the properties of the elements.\nDefault empirical values are:\n- Wind drift fraction: 0.018 (1.8 %) (Garret 1985)\n- Iceberg size: Keel dept = 60m\nWaterline length = 90.5m\nNB! Iceberg size is irrelevant for current_reader with 1D z-profile\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_elements(3.3, 61.3, radius=3000, number=500,\n time=reader_current.start_time)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print('Starting free run .../n')\n\nprint('Start time: ' + str(o.start_time))\n\no.run(time_step=3600, steps=steps)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print and plot results\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.plot(fast=True)\no.animation(fast=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.6" } }, "nbformat": 4, "nbformat_minor": 0 }