{"id":4836,"date":"2021-03-05T14:36:51","date_gmt":"2021-03-05T13:36:51","guid":{"rendered":"https:\/\/fjordos.usn.no\/?page_id=4836"},"modified":"2023-02-14T12:09:21","modified_gmt":"2023-02-14T11:09:21","slug":"tilgang-pa-data","status":"publish","type":"page","link":"https:\/\/fjordos.usn.no\/?page_id=4836","title":{"rendered":"Tilgang p\u00e5 data"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">NetCDF-filer med data<\/h2>\n\n\n\n<p>Hindcast-data som NetCDF-filer finnes her: <a rel=\"noreferrer noopener\" href=\"https:\/\/thredds.met.no\/thredds\/catalog\/fjordos\/fjordos2_hindcast\/v6\/exp1\/catalog.html\" target=\"_blank\">https:\/\/thredds.met.no\/thredds\/catalog\/fjordos\/fjordos2_hindcast\/v6\/exp1\/catalog.html<\/a><\/p>\n\n\n\n<p>Operasjonelle data som NetCDF-filer finnes her: <a rel=\"noreferrer noopener\" href=\"https:\/\/thredds.met.no\/thredds\/catalog\/fjordos\/operational_archive\/catalog.html\" target=\"_blank\">https:\/\/thredds.met.no\/thredds\/catalog\/fjordos\/operational_archive\/catalog.html<\/a><\/p>\n\n\n\n<p>F\u00e5r du ikke tak i data? Sjekk status for thredds-tjenesten p\u00e5 <a href=\"https:\/\/status.met.no\/\">https:\/\/status.met.no\/<\/a> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Eksempler p\u00e5 hvordan data&#8217;en kan leses<\/h2>\n\n\n\n<h5 class=\"wp-block-heading\">Eksempel 1: Hente og plotte dybdematrisen (Matlab)<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>        FOfil = 'https:\/\/thredds.met.no\/thredds\/dodsC\/fjordos\/fjordos2_hindcast\/v6\/exp1\/ocean_his_0001.nc4';\n        lon_rho = ncread(FOfil,'lon_rho');\n        lat_rho = ncread(FOfil,'lat_rho');\n        h = ncread(FOfil,'h');\n        mask = ncread(FOfil,'mask_rho');\n        h(~mask) = NaN;\n\n        ha = pcolor(lon_rho,lat_rho,h);\n        set(ha,'EdgeColor','none')\n        caxis(&#91;0,200]);\n        ylabel(colorbar,'Depth &#91;m]','fontsize', 12, 'fontweight', 'bold','color','k')\n        xfac = cos(mean(lat_rho(:))*pi\/180);\n        set(gca, 'DataAspectRatio', &#91;1 xfac 1] );\n        xlabel('Lengdegrad (^oE)','Fontsize',12,'FontWeight','bold')\n        ylabel('Breddegrad (^oN)','Fontsize',12,'FontWeight','bold')\n        axis tight\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Eksempel 2: Hente og plotte vannstand ved Oscarsborg (Matlab)<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>        FOfil = 'https:\/\/thredds.met.no\/thredds\/dodsC\/fjordos\/fjordos2_hindcast\/v6\/exp1\/ocean_his_0001.nc4';\n        ocean_time = ncread(FOfil,'ocean_time');\n        tid = ocean_time\/3600\/24 + datenum(&#91;1970,01,01,00,00,00]);\n        zeta = squeeze(ncread(FOfil,'zeta',&#91;201,583,1],&#91;1,1,Inf]));\n        plot(tid,zeta,'r')\n        datetick('x')\n        ylabel('Vannstand &#91;cm]','FontWeight','bold','FontSize',12)\n\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Eksempel 3: Hente og plotte dybdematrisen (Python)<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>        from netCDF4 import Dataset\n        import numpy as np\n        import cmocean \n        import matplotlib.pyplot as plt\n        from mpl_toolkits.basemap import Basemap\n\n        # Henter data fra thredds\n        url = 'https:\/\/thredds.met.no\/thredds\/dodsC\/fjordos\/operational_archive\/daily\/ocean_his.nc_2018021400'\n        nc = Dataset(url)\n\n        # Plukker ut dyp-data\n        h = nc.variables&#91;'h']&#91;:,:]\n        mask_rho = nc.variables&#91;'mask_rho']&#91;:,:]\n        lon = nc.variables&#91;'lon_rho']&#91;:,:]\n        lat = nc.variables&#91;'lat_rho']&#91;:,:]\n        h=np.ma.masked_where(mask_rho &lt; 0.5,h)\n\n        # Plotter\n        fig = plt.figure(figsize=(5,5))\n        m = Basemap(projection='stere',lon_0=10.5,lat_0=59.5,lat_ts=60,\n                      llcrnrlon=10.00,urcrnrlon=11.2,\n                      llcrnrlat=58.97,urcrnrlat=59.93,\n                      rsphere=6.371e+06, resolution='i')\n\n        # draw parallels.\n        parallels = np.arange(0.,90.,0.1)\n        m.drawparallels(parallels,labels=&#91;1,0,0,0],fontsize=10)\n        # draw meridians\n        meridians = np.arange(0.,360.,0.2)\n        m.drawmeridians(meridians,labels=&#91;0,0,0,1],fontsize=10)\n        # depth\n        x,y = m(lon,lat)\n        cmes = m.pcolormesh(x,y,h,cmap=cmocean.cm.deep,vmin=0,vmax=400)\n        cbar = m.colorbar(cmes,location='right',pad=\"10%\")\n        cbar.set_label('Depth &#91;m]')\n        m.plot\n\n        plt.show()\n        <\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NetCDF-filer med data Hindcast-data som NetCDF-filer finnes her: https:\/\/thredds.met.no\/thredds\/catalog\/fjordos\/fjordos2_hindcast\/v6\/exp1\/catalog.html Operasjonelle data som NetCDF-filer finnes her: https:\/\/thredds.met.no\/thredds\/catalog\/fjordos\/operational_archive\/catalog.html F\u00e5r du ikke tak i data? Sjekk status for thredds-tjenesten p\u00e5 https:\/\/status.met.no\/ Eksempler p\u00e5 hvordan data&#8217;en kan leses Eksempel 1: Hente og plotte dybdematrisen (Matlab) Eksempel 2: Hente og plotte vannstand ved Oscarsborg (Matlab) Eksempel 3: Hente og plotte &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/fjordos.usn.no\/?page_id=4836\"> <span class=\"screen-reader-text\">Tilgang p\u00e5 data<\/span> Les mer &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"parent":2079,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4836","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/pages\/4836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4836"}],"version-history":[{"count":9,"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/pages\/4836\/revisions"}],"predecessor-version":[{"id":4987,"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/pages\/4836\/revisions\/4987"}],"up":[{"embeddable":true,"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=\/wp\/v2\/pages\/2079"}],"wp:attachment":[{"href":"https:\/\/fjordos.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}