GithubHelp home page GithubHelp logo

fesom / pyfesom Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 6.0 19.61 MB

python library and tools for pre and post processing of the FESOM ocean model files

Home Page: http://pyfesom.readthedocs.io/en/latest/index.html

License: MIT License

Jupyter Notebook 98.68% Python 1.31% Shell 0.01%
oceanography ocean climate ocean-model ocean-modelling ocean-sciences

pyfesom's Introduction

THIS PROGECT IS NOT SUPPORTED ANYMORE AND ARCHIVED

Please use https://github.com/FESOM/pyfesom2 instead

pyfesom

Collection of tools for basic handling of FESOM ocean model output.

MIT licensed Documentation Status Binder

Documentation (tools and library)

http://pyfesom.readthedocs.io/en/latest/index.html

Examples of library usage

Requirements

We try to support both python 2.7 and possibly 3.4.

  • numpy
  • scipy
  • pandas
  • netCDF4

pyfesom's People

Contributors

dsidoren avatar janstreffing avatar koldunovn avatar strawpants avatar trackow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyfesom's Issues

Unable to change the color label

I have a problem with the color label.

I want to remove the white color of the planets on my plot, but I keep getting errors. this is my script

`def plot_holoviews(mesh, data, wireframe=False, cmap=None, proj='pc', data_name='data',clabel=None, levels=None):

elem2 = mesh.elem[mesh.no_cyclic_elem]
data = np.ma.masked_equal(data, 0)

verts = pd.DataFrame({'Longitudes':mesh.x2, 'Latitudes':mesh.y2, 'data':data})
tris = pd.DataFrame({'v0':elem2[:,0],'v1':elem2[:,1], 'v2':elem2[:,2]})
fesom_mesh = gv.TriMesh((tris, verts), crs=crs.PlateCarree())
if wireframe:
    verts2 = pd.DataFrame({'Longitudes':mesh.x2, 'Latitudes':mesh.y2})
    trimesh = gv.TriMesh((tris, verts2), crs=crs.PlateCarree())
    wireframe_plot = datashade(trimesh, interpolation=None, cmap=['black'])

if proj == 'pc':
    projection=crs.PlateCarree()
    width=800,
    height=500,
    y_range=(-80,90)
elif proj == 'np':
    projection=crs.NorthPolarStereo()
    width = 500,
    height = 500,
    y_range=(60,90)
elif proj == 'sp':
    projection=crs.SouthPolarStereo()
    width = 500,
    height = 500,
    y_range=(-90,-30)

if cmap is None:
    cmap=cmo.balance
    
main_plot = rasterize(fesom_mesh, interpolation=None, y_range=y_range).opts(
                    tools=["hover"],
                    width=width[0],
                    height=height[0],

projection=projection,

                    colorbar=True,
                    cmap=cmap,
                    colorbar_position="bottom",
                    clabel=clabel,
                    fontscale=1.3,
                    color_levels=levels
                )
if wireframe:
    return main_plot * gv.feature.coastline() * wireframe_plot
else:
    return main_plot * gv.feature.coastline()`

After Loading my data, I did this;

levels=[-5,-4,-3,-2,-1,0,1,2,3,4,5] and the this;
plot_holoviews(mesh, data0, clabel="sea surface temperature", levels=levels)

I don't know what the problem is, can someone help me with this?

Thank you

More flexible naming of the output files

As agreed during a meeting on 25.06.2021 with @koldunovn , it would be great if PyFesom could support a wider range of naming conventions for FESOM output files.

At the moment it only supports the following naming convention:

<variable>.<ID>.<Year>.nc

However, in ESM-Tools for example, we often do monthly and even daily restarts, and copy these files into a common folder, therefore needing to change the name using a time stamp. The format we've been using for that is:

<cariable>.<ID>.<YearMonth>.<Day>.nc

An example of how the output looks like for a finished simulation of AWICM3 using ESM-Tools can be found here: /work/ollie/mandresm/esm_yaml_test/eternal_awicm3_daily/outdata/fesom/

White line when plotting with polar stereo projections

Hi,
I am trying to plot FESOM1.4 with in a SouthPolarStereo projection and get this white line at one meridian, similar to what you have mentioned here, @koldunovn : https://github.com/koldunovn/pi_mesh_python/blob/master/triangular_mesh_maps_NorthPolarStereo.ipynb

I was just wondering, where to get the *.txt from (elements.txt, xnodes.txt, etc.) as they seem to be crucial for getting rid of this white line. Or are there other ways to accomplish that? Could someone maybe clarify this?

problems with processing velocity data

I did't find examples about processing FESOM velocity data using pyfesom, and I met some problems I coudn't figure out:

  1. u, elem_no_nan = pf.get_data(f.variables['u'][time_id,:],mesh,lv_dep)
    the output u is 2-d, not like temp whose output is 1-d and is the same size as mesh.x2. What's the corresponding grid of the u?
  2. If I use pf.fesom2regular(u, mesh, lonn, latt, how='idist', k=10) directly, is the output right for me to use in lon/lat grid? Is there a need to use pf.vec_rotate_r2g ?

Defined cases for Atlantic, Indik, and Pacific Ocean in `plot_transect_map`

I would like to suggest to allow restricting the plot_transect_map to the three ocean basis.

plot_transect_map(lon_start, lat_start, lon_end, lat_end,
                      mesh, npoints=30, view = 'w', stock_img=False):
    :
    if view=='w':
      :
      :
    elif view=='atl':
        # Atlantic
        ax = plt.subplot(111, projection=ccrs.Mercator(central_longitude=0))
        ax.set_extent([25, -85, -75, 70], crs=ccrs.PlateCarree())
    elif view=='ind':
        # Indik
        ax = plt.subplot(111, projection=ccrs.Mercator(central_longitude=70))
        ax.set_extent([140, +15, -75, 30], crs=ccrs.PlateCarree())
    elif view=='pac':
        # Pacific
        ax = plt.subplot(111, projection=ccrs.Mercator(central_longitude=-180))
        ax.set_extent([-255, -70, -75, 67], crs=ccrs.PlateCarree())   
    else:
:

ImportError

Hi, I'm trying to import pyfesom but it raised this error:

ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pyfesom.pyfesom as pf

File ~/Desktop/Nw_Sea/FESOM/pyfesom/pyfesom/init.py:15
13 from .ut import *
14 from .climatology import *
---> 15 from .transect import *
16 from .plotting import *
20 author = 'FESOM team'

File ~/Desktop/Nw_Sea/FESOM/pyfesom/pyfesom/transect.py:13
1 # -- coding: UTF-8 --
2 # This file is part of pyfesom
3 #
(...)
8 #
9 ################################################################################
12 import numpy as np
---> 13 import pyproj
14 from .ut import tunnel_fast1d, vec_rotate_r2g
15 import numpy as np

File ~/miniforge3/envs/py38/lib/python3.8/site-packages/pyproj/init.py:49
32 all = [
33 "Proj",
34 "Geod",
(...)
45 "show_versions",
46 ]
47 import warnings
---> 49 import pyproj.network
50 from pyproj._datadir import ( # noqa: F401
51 _pyproj_global_context_initialize,
52 set_use_global_context,
53 )
54 from pyproj._show_versions import show_versions # noqa: F401

File ~/miniforge3/envs/py38/lib/python3.8/site-packages/pyproj/network.py:10
6 from typing import Union
8 import certifi
---> 10 from pyproj._network import ( # noqa: F401
11 _set_ca_bundle_path,
12 is_network_enabled,
13 set_network_enabled,
14 )
17 def set_ca_bundle_path(ca_bundle_path: Union[Path, str, bool, None] = None) -> None:
18 """
19 .. versionadded:: 3.0.0
20
(...)
38 variables.
39 """

ImportError: dlopen(/Users/auroralin/miniforge3/envs/py38/lib/python3.8/site-packages/pyproj/_network.cpython-38-darwin.so, 0x0002): Library not loaded: '@rpath/libtiff.5.dylib'
Referenced from: '/Users/auroralin/miniforge3/envs/py38/lib/libproj.21.0.2.dylib'
Reason: tried: '/Users/auroralin/miniforge3/envs/py38/lib/libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/lib/libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/lib/libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/lib/python3.8/site-packages/pyproj/../../../libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/lib/libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/lib/libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/lib/python3.8/site-packages/pyproj/../../../libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/bin/../lib/libtiff.5.dylib' (no such file), '/Users/auroralin/miniforge3/envs/py38/bin/../lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file)

And I find libtiff.6.dylib in the specific path, but no libtiff.5.dylib.
It bothers me a lot, and with your kind help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.