Commit 11c9db32 authored by Roelofsen, Hans's avatar Roelofsen, Hans
Browse files

function to get dataframe snl beheertypen

parent 19083482
"""
Function to retrieve default MNP draagkracht for species/bt combination
"""
import pandas as pd
import numpy as np
# Get default mnp draagkracht values
mnp_dk_src = r'w:\PROJECTS\qmar\MNP-SNL-ParameterSet\Parameters_v06_2019_12_09\03_MNP_versie6_par_density_factors_BT2019_v2.csv'
mnp_dk = pd.read_csv(mnp_dk_src, sep=',',usecols=['Species_code', 'Land_type_code', 'Land_type_quality'])
def get_mnp_dk(species_code, bt_code, tab=mnp_dk):
"""
:param species_code: MNP species code starting with S02, S06, S09
:param bt_code: BT code NXX.YY.ZZ
:param tab: source table
:return: float draagrkacht
"""
dk = mnp_dk.loc[(mnp_dk.Species_code == species_code) & (mnp_dk.Land_type_code == bt_code), 'Land_type_quality']
if not dk.empty:
return float(dk)
else:
return np.nan
---
title: "R Notebook"
author: roelo008
date: 26-May-21
output: html_notebook
---
The [R plugin](https://www.jetbrains.com/help/pycharm/r-plugin-support.html) for IntelliJ-based IDEs provides
handy capabilities to work with the [R Markdown](https://www.jetbrains.com/help/pycharm/r-markdown.html) files.
To [add](https://www.jetbrains.com/help/pycharm/r-markdown.html#add-code-chunk) a new R chunk,
position the caret at any line or the code chunk, then click "+".
The code chunk appears:
```{r}
```
Type any R code in the chunk, for example:
```{r}
mycars <- within(mtcars, { cyl <- ordered(cyl) })
mycars
```
Now, click the **Run** button on the chunk toolbar to [execute](https://www.jetbrains.com/help/pycharm/r-markdown.html#run-r-code) the chunk code. The result should be placed under the chunk.
Click the **Knit and Open Document** to built and preview an output.
\ No newline at end of file
"""
pandas dataframe containing .\resources\snl_beheertypen.csv
Hans Roelofsen, 14/07/2021
"""
import os
from pathlib import Path
import pandas as pd
def get_snl_beheertypen_list(benb_dir):
"""
return snl beheertypen list as pandas df
:param benb_dir: directory of benb_utils
:return: pandas dataframe
"""
os.chdir(benb_dir)
return pd.read_csv(r'./resources/snl_beheertypen.csv', sep=',', comment='#', quotechar='"')
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment