Giter VIP home page Giter VIP logo

croco's Introduction

CROCO

Le répertoire croco contient le code CROCO de base

Le répertoire CONFIGS contient les différentes configurations:

  • MEDDY : Meddy dans une configuration idéalisée
  • MOZ : Tourbillon dans la configuration réaliste du canal du Mozambique
  • JETN : Jet et marée interne dans une configuration idéalisée
  • ITBALT : Internal Tide and BALanced Turbulence in an idealized context

Le répertoire util contient des utilitaires python

  • clean_croco.py : pour supprimer tous les xios_client* et xios_server* (sauf le 0) à partir du niveau de répertoire courant et dans les deux niveaux inférieurs
  • kill_datarmor.py : pour tuer sur datarmor tous les chainages d'une simulation en cours
  • restart_datarmor.py : pour relancer sur datarmor une simulation de plusieurs chainages

Installation

Download the repository:

git clone https://github.com/slgentil/croco.git

For pre/post processing, install an appropriate conda-environment. Download Miniconda3 (i.e. for python3) from the conda website and run:

./Miniconda3-latest-Linux-x86_64.sh
conda update conda
conda create -n croco -c conda-forge python=3.8 dask dask-jobqueue \
            xarray zarr netcdf4 python-graphviz \
            jupyterlab ipywidgets \
            cartopy geopandas scikit-learn seaborn \
            hvplot geoviews nodejs \
            intake-xarray gcsfs \
            cmocean gsw \
            xrft \
            pytide pyinterp
conda activate croco
pip install git+https://github.com/xgcm/xgcm.git
conda install -c conda-forge pywavelets
cd croco; pip install -e .

# install croco_visu
conda install -c conda-forge wxpython ffmpeg

# install parcels
conda install -c conda-forge parcels

# pyamg for solving poisson equation
conda install -c conda-forge pyamg

jupyter labextension install @jupyter-widgets/jupyterlab-manager \
                             @pyviz/jupyterlab_pyviz \
                             jupyter-leaflet

see also conda doc

Compilation

Aller dans le répertoire Run_XXX
Ce répertoire ne contient que les sources modifiés de la configuration courante par rapport à CROCO de base
Lancer jobcomp
L'exécutable croco et un lien symbolique vers l'exécutable xios_server.exe sont créés dans le répertoire courant

Lancement sur Datarmor

python chain_datarmor.py workdir nbchain elaptim resolution jobname restart

avec:

  • workdir : répertoire qui sera créé sous DATAWORK ou SCRATCH selon la variable WORK du script python
  • nbchain : nombre de chainages
  • elaptim : temps elapsed pour chaque chainage HH:MM:SS
  • resolution : dépend de la configuration (4,2,1 pour JETN / 128,256,512,1024 pour MEDDY et MOZ)
  • jobname : nom générique des batchs
  • restart : 0 (initial) or 1 (restart)

Le répertoire workdir est créé dans DATAWORK ou SCRATCH
Ce répertoire contient des sous-répertoires t1,t2,... , un répertoire par chainage
Le script python prépare le batch et vous indique comment le lancer.

croco's People

Contributors

slgentil avatar apatlpo avatar noelahaye avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

apatlpo

croco's Issues

list of changes / improvements

General:

  • change name g_default(e.g. to grav). If we are to change this name, we should make sure the modification is also made in gridop and vmodes

In vmodes:

  • method for saving and loading modes

update interp2z in gridop.py

interp2z and interp2z_3d should be updated in gridop.py to be compatible with the fast_interp routine. The latter now includes nearest or linear extrapolation at the top and the bottom, and hence requires 2 more arguments (integers -- 5 args in total). I think the corrected versions are the one in proj_modes.ipynb (in tutorials). Aurélien did the modification of the fast_interp routine, can you confirm and make the changes accordingly?

postp file loading behaviour: grid and his

If I remember correctly, the oldest strategy was to load his by default, then switched to grid, and now we try to be compatible. Here are a few questions regarding these few lines:

croco/crocosi/postp.py

Lines 46 to 51 in a9e5208

if os.path.isfile(self.dirname+'t1/grid.nc'):
_nc_default = ['grid']
else:
# for backward compatibility
_nc_default = ['his']
self.open_nc = list(set(_nc_default + open_nc))

  • first line: shouldn't it be t1/{}grid.nc'.format(prefix)? Otherwise Run.__init__most certainly misses the grid file and switched to old behavior, i.e. load his(and only his) by default. I made the corresponding change in the branch "vmodes".
  • Would that be compatible to use _nc_default only if open_nc is empty?

minor error and suggestions for postp _adjust_grid

I think l. 321 should read "_f0, _beta = None, None" istead of "f0, beta = None, none"

Puisque f est présent dans le netCDF grid, pourquoi ne pas l'utiliser comme coordonnée ? Ca évite d'avoir à donner f0, beta s'ils ne sont pas dans les fichiers de sortie (ce ne sont que des attributs) et de faire potentiellement des erreurs. Par contre on perdrai f_u, f_v, mais ils se recalculent très facilement avec grid.interp

Si OK je ferai les modifs nécessaires et ferai un pull request

more general ordering of input vertical grids in fast_interp3D

Hi I noticed something that I was not expecting: it seems like interp2z requires both vertical grids to be ordered the same way. It looks like this behaviour is inherited from fast_interp3D.interp routine. Would you mind check this?
https://nbviewer.jupyter.org/github/NoeLahaye/bacasable/blob/master/debug_interpz_order.ipynb
@apatlpo , @slgentil

What is strange is that in my examples, sometimes I get Nan (I would get wrong values if I use boundary extrapolation), while I never have any target value that is outside the range of initial values (for the z grid), so I hope there is not something worse behind this

All the best,

Noé

fsturb roadmap

List of items to address with fsturb configuration:

  • check forcing on density works for a purely barotropic forcing: it doesn't. Forcing on velocity was implemented instead

  • investigate the forcing amplitude to energy response relationship

  • figure out if relaxation needs to be turned back on

  • implement simple movie generator and make pretty movies

  • implement modal decomposition of the flow and modal energy temporal evolution

  • implement atmospheric forcing for NIW generation

  • turn internal tide back on and adjust sponge layers

xgcm vs. croco run

@apatlpo, @slgentil
I spotted a few bugs / shortcomings, regarding how xgrid (do not) adapt to changes in datasets, e.g. when selecting portions of a dataset. This is illustrated in this notebook

vmodes minor cleaning up and improvement

Projections.

API could be somewhat clarified I believe. When one wants to project onto modes there are several cases:

  • 1D vertical modes: all goes well, in other words, the data horizontal grid does not matter

  • horizontally varying modes: in that case, data needs to be interpolated horizontally first on the vertical mode grid, otherwise the projection will broadcast horizontal dimensions that differ. If this statement is correct we need to more explicitly state this in the docstring. Right now it is unclear whether this horizontal interpolation may be performed within the call to projector not. The notebook for example falsely lead to believe it is the case, as z_rho (on hgrid rho) is passed to project.

very minor detail:

  • vmodes.ipynb / cell 28: set aspect to equal (subplot_kws={'aspect':'equal'})

chunking options when opening CROCOrun objects

We need to find a good way to pass options about chunking when opening CROCOrun objects.
Maybe something along the lines of :

r = pp.CROCOrun(root_path+run, prefix='file_', open_nc=['surf'], ...
 chunks={'his': {'time':1}, 'surf': {'time':None}})

any other ideas?

get_z needs update

it probably should look like something closer to:

def get_z(run, zeta=None, h=None, vgrid='r', hgrid='r'):
    ''' compute vertical coordinates
        zeta should have the size of the final output
        vertical coordinate should be first
    '''

    ds = run['his']
    N = run.N
    hc = run.params['Hc']

    if zeta is not None:
        _zeta = zeta
    else:
        _zeta = ds.ssh
    if h is not None:
        _h = h
    else:
        _h = ds.h
    #
    if hgrid is 'u':
        _zeta = rho2u(_zeta, ds)
        _h = rho2u(_h, ds)
    elif hgrid is 'v':
        _zeta = rho2v(_zeta, ds)
        _h = rho2v(_h, ds)
    #
    sc=run['his']['sc_'+vgrid]
    cs=run['his']['Cs_'+vgrid]

    #
    z0 = (hc * sc + _h * cs) / (hc + _h)
    z = _zeta + (_zeta + _h) * z0
    #z = np.squeeze(_zeta + (_zeta + _h) * z0)  # this should not be here
    # manually swap dims, could also perform align with T,S
    #if z.ndim ==4:
    #    z = z.transpose(z.dims[0], z.dims[3], z.dims[1], z.dims[2])
    #elif z.ndim == 3:
    #    z = z.transpose(sc.dims[0], _zeta.dims[0], _zeta.dims[1])
    #elif z.ndim == 2:
    #    z = z.transpose(sc.dims[0], _zeta.dims[0])
    return z.rename('z_'+vgrid)

I am not sure transposition is necessary, to discuss

get_p in gridop

I added a version of get_p in gridop. What is implemented is a "finite volume" implementation, where the density is integrated level-wise (assuming rho is constant in a given sigma rho-layer) from the surface. i.e. it is strictly equivalent to cumsum on w-levels. This is probably not what is actually implemented in croco, but it gives something satisfying.

Please check that it looks fine (and that it works if you want, but I am currently using it so...) and delete the old version get_p_old if it is OK

List of issues for meeting

List of issues that would be worth discussing in a meeting

  • how to contribute~: git branch, merge, pull request, using issue, tracking modifications, making suggestions, asking questions (on github)
  • strategies for postp and gridop
    ** what to do with grid (xgcm-Grid) ? where to attach it ?

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.