Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/alinea/astk/__init__.py

This file was deleted.

17 changes: 8 additions & 9 deletions src/openalea/astk/TimeControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
Provides utilities for scheduling models in simulation
"""
from __future__ import division
import numpy
#from six.moves import map
#from six.moves import zip
from functools import reduce

class TimeControlSet(object):
import numpy

class TimeControlSet:

def __init__(self, **kwd):
""" Create a TimeControlSet , that is a simple class container for named object"""
Expand All @@ -36,7 +35,7 @@ def simple_delay_timing(delay = 1, steps =1):
return (TimeControlSet(dt=delay) if not i % delay else TimeControlSet(dt=0) for i in range(steps))


class TimeControl(object):
class TimeControl:

def __init__(self, delay=None, steps=None, model=None, weather=None, start_date=None):
""" create a generator-like timecontrol object """
Expand All @@ -63,7 +62,7 @@ def __next__(self):
return next(self._timing)


class TimeControler(object):
class TimeControler:

def __init__(self, **kwd):
""" create a controler for parallel run of time controls
Expand Down Expand Up @@ -96,7 +95,7 @@ def evaluation_sequence(delays):
seq = [[True if i == 0 else False for i in range(int(d))] for d in delays]
return reduce(lambda x,y: x + y, seq)

class EvalValue(object):
class EvalValue:

def __init__(self, eval, value, dt):
self.eval = eval
Expand All @@ -106,7 +105,7 @@ def __init__(self, eval, value, dt):
def __nonzero__(self):
return self.eval

class IterWithDelays(object):
class IterWithDelays:

def __init__(self, values = [None], delays = [1]):
self.delays = delays
Expand Down Expand Up @@ -220,7 +219,7 @@ def rain_filter_node(time_sequence, weather):
filter = rain_filter(time_sequence, weather)
return time_sequence, filter, weather.data

class DegreeDayModel(object):
class DegreeDayModel:
""" Classical degreeday model equation
"""

Expand Down
5 changes: 3 additions & 2 deletions src/openalea/astk/Weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

from __future__ import division
from __future__ import print_function
import pandas
import pytz
from datetime import timedelta
from pathlib import Path

import pandas

from .TimeControl import *
from openalea.astk.sun_position import sun_position
from .sun_position import sun_position
from . import sky_sources as sunsky
from .data_access import meteo00_01

Expand Down
2 changes: 1 addition & 1 deletion src/openalea/astk/colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from math import isnan

class ColorMap(object):
class ColorMap:
"""A RGB color map, between 2 colors defined in HSV code

:Examples:
Expand Down
21 changes: 12 additions & 9 deletions src/openalea/astk/icosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ def split_triangles(vertices, faces, tags=None):
""" Iterate an icosphere by sub-dividing each triangle into 4.

Args:
vertices (list of tuples): list of 3D coordinates of icosphere vertices
faces (list of tuple): list of vertex indices defining the faces
tags (list of int): list of integer identifying a face. if None (default)
no tags are returned
- vertices (list of tuples): list of 3D coordinates of icosphere vertices
- faces (list of tuple): list of vertex indices defining the faces
- tags (list of int): list of integer identifying a face. if None (default)
no tags are returned
Returns:
a list of vertices and a list of faces and, if tags is not None, a list
of tags referencing the tag of the parent face
- a list of vertices and a list of faces and, if tags is not None, a list
of tags referencing the tag of the parent face

This is a python implementation of the C code found here:
http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html
"""
"""
# copy input
new_faces = [f for f in faces]
new_vertices = [v for v in vertices]
Expand Down Expand Up @@ -224,8 +224,11 @@ def split_triangles(vertices, faces, tags=None):


def sorted_faces(center, face_indices, faces):
""" return face indices sorted to form a counter clockwise rotation
around its centroid"""
""" Sort faces.

Return face indices sorted to form a counter clockwise rotation
around its centroid.
"""
indices = [i for i in face_indices]
sorted_indices = [indices.pop(0)]
while len(indices) > 0:
Expand Down
16 changes: 16 additions & 0 deletions src/openalea/astk/pgl_display.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@

# -*- python -*-
#
# Copyright 2016-2025 Inria - CIRAD - INRAe
#
# Distributed under the Cecill-C License.
# See accompanying file LICENSE.txt or copy at
# http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html
#
# WebSite : https://github.com/openalea-incubator/astk
#
# File author(s): Christian Fournier <christian.fournier@inrae.fr>
#
#
#
# ==============================================================================

import warnings
from openalea.astk.colormap import jet_colors

Expand Down
17 changes: 15 additions & 2 deletions src/openalea/astk/plantgl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from __future__ import division
from openalea.plantgl import all as pgl
#from six.moves import range


def _is_iterable(x):
try:
Expand All @@ -23,8 +23,21 @@ def _is_iterable(x):
return False
return True


def get_area_and_normal(scene_geometry):
""" Calculate the area and normal of objects in a PlantGL scene

Parameters
----------
scene_geometry: dict([id, geometry])
Dictionnary of geometries of objects in the scene.

Returns
-------
areas: dict([id, list of float])
Dictionnary of list of surface of triangles composing each object in the scene.
normals: dict([id, list of pgl.Vector3])
Dictionnary of list of normal vectors of triangles composing each object in the scene.
"""

def _surf(ind,pts):
A,B,C = [pts[i] for i in ind]
Expand Down
7 changes: 6 additions & 1 deletion src/openalea/astk/sky_luminance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
f_clear_sky,
all_weather_sky_brightness
)
from openalea.astk.sky_map import ksi_grid, scale_sky, sky_ni, sky_lum
from openalea.astk.sky_map import (
ksi_grid,
scale_sky,
sky_ni,
sky_lum
)


def cie_luminance_gradation(z, a=4, b=-0.7):
Expand Down
2 changes: 1 addition & 1 deletion src/openalea/astk/sky_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import numpy

from .icosphere import turtle_mesh, spherical_face_centers
from openalea.astk.sky_luminance import sky_luminance
from .sky_luminance import sky_luminance
from .sky_map import sky_grid, sky_map, sky_hi


Expand Down
6 changes: 3 additions & 3 deletions src/openalea/astk_wralea/__wralea__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
__editable__ = True
__description__ = ''
__license__ = 'CeCILL-C'
__url__ = 'http://openalea.gforge.inria.fr'
__url__ = 'https://openalea-astk.rtfd.io'
__alias__ = []
__version__ = '1.0.0'
__version__ = '3.0.0'
__authors__ = ''
__institutes__ = None
__institutes__ = 'inria, CIRAD, INRAE'
__icon__ = ''


Expand Down
Loading