Skip to content

Commit

Permalink
Merge pull request #26 from pradal/namespace
Browse files Browse the repository at this point in the history
Move alinea to namespace package
  • Loading branch information
pradal authored Jan 22, 2024
2 parents 0ee5546 + 3e675f4 commit 9a3be6e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 84 deletions.
72 changes: 11 additions & 61 deletions .github/workflows/conda-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,16 @@ name: build_publish_anaconda

on:
push:
branches: [ master ]
branches:
- '**'
tags:
- 'v*'
pull_request:
branches: [ master ]

jobs:
build-and-publish:
name: ${{ matrix.os }}, Python 3.${{ matrix.python-minor-version }} for conda deployment
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [ubuntu-latest]
python-minor-version: [9]
isMaster:
- ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/dev') }}
exclude:
- isMaster: false
os: ubuntu-latest
python-minor-version: 7
- isMaster: false
os: ubuntu-latest
python-minor-version: 8
- isMaster: false
os: macos-latest
python-minor-version: 7
- isMaster: false
os: macos-latest
python-minor-version: 8
- isMaster: false
os: macos-latest
python-minor-version: 9
- isMaster: false
os: windows-latest
python-minor-version: 7
- isMaster: false
os: windows-latest
python-minor-version: 8
- isMaster: false
os: windows-latest
python-minor-version: 9
branches:
- '**'

steps:
- name: Chekout
uses: actions/checkout@v3
- name: Determine publish
uses: haya14busa/action-cond@v1
id: publish
with:
cond: ${{ contains(github.ref, 'master') || startsWith(github.ref, 'refs/heads/v') }}
if_true: 'true'
if_false: 'false'
- name: Build and Publish
uses: openalea/action-build-publish-anaconda@v0.1.3
with:
conda: conda
mamba: true
python: ${{ matrix.python-minor-version }}
numpy: '20.0'
channels: openalea3, conda-forge
token: ${{ secrets.ANACONDA_TOKEN }}
publish: ${{ steps.publish.outputs.value }}
label: main
jobs:
build:
uses: openalea/github-action-conda-build/.github/workflows/conda-package-build.yml@main
secrets:
anaconda_token: ${{ secrets.ANACONDA_TOKEN }}
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from os.path import abspath, normpath
from os.path import join as pj

from setuptools import setup, find_packages
from setuptools import setup, find_namespace_packages


short_descr = "The Alinea.astk package provides utilities for simulation of FSPM models builds under alinea standards"
Expand Down Expand Up @@ -62,7 +62,7 @@ def data_rel_pth(pth):
license='cecill-c',
zip_safe=False,

packages=find_packages('src'),
packages=find_namespace_packages(where='src', include=['alinea', 'alinea.*', 'astk_data']),
package_dir={'': 'src'},

include_package_data=True,
Expand All @@ -71,7 +71,6 @@ def data_rel_pth(pth):
#tests_require=parse_requirements("dvlpt_requirements.txt"),
entry_points={},
keywords='',
test_suite='nose.collector',
)
# #}
# change setup_kwds below before the next pkglts tag
Expand Down
4 changes: 0 additions & 4 deletions src/alinea/__init__.py

This file was deleted.

17 changes: 3 additions & 14 deletions src/alinea/astk/Weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,17 @@
def septo3d_reader(data_file, sep):
""" reader for septo3D meteo files """

def parse(yr, doy, hr):
""" Convert the 'An', 'Jour' and 'hhmm' variables of the
meteo dataframe in a datetime object (%Y-%m-%d %H:%M:%S format)
"""
an, jour, heure = [int(x) for x in [yr, doy, int(hr) / 100]]
dt = datetime(an - 1, 12, 31)
delta = timedelta(days=jour, hours=heure)
return dt + delta

data = pandas.read_csv(data_file,
parse_dates={'date': ['An', 'Jour', 'hhmm']},
date_parser=parse, sep=sep)
data = pandas.read_csv(data_file, sep=sep)
# ,
# usecols=['An','Jour','hhmm','PAR','Tair','HR','Vent','Pluie'])

data['date'] = pandas.to_datetime(data['An'] * 1000 + data['Jour'], format='%Y%j')+pandas.to_timedelta(data.hhmm/100, unit='H')
data.index = data.date
data = data.rename(columns={'PAR': 'PPFD', 'Tair': 'temperature_air',
'HR': 'relative_humidity', 'Vent': 'wind_speed',
'Pluie': 'rain'})
return data


def PPFD_to_global(data):
""" Convert the PAR (ppfd in micromol.m-2.sec-1)
in global radiation (J.m-2.s-1, ie W/m2)
Expand Down Expand Up @@ -86,7 +75,7 @@ def linear_degree_days(data, start_date=None, base_temp=0., max_temp=35.):
return dd - dd[df.index.searchsorted(start_date)]


class Weather(object):
class Weather:
""" Class compliying echap local_microclimate model protocol (meteo_reader).
expected variables of the data_file are:
- 'An'
Expand Down
4 changes: 2 additions & 2 deletions src/alinea/astk/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-

major = 2
minor = 3
post = 2
minor = 4
post = 0

__version__ = ".".join([str(s) for s in (major, minor, post)])
# #}

0 comments on commit 9a3be6e

Please sign in to comment.