Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 881174c8 authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

First implementation of the little module with tools for the F90 modules.

parent 52162a99
import sys
import os
import inspect
import importlib
def localdir(follow_symlinks=True):
if getattr(sys, 'frozen', False): # py2exe, PyInstaller, cx_Freeze
......@@ -15,21 +16,28 @@ def adddirtopath(dir) :
sys.path.append(localdir()+'/'+dir)
return
def compile90(dir) :
adddirtopath(dir)
if MPI == sys.modules['mpi4py'].MPI :
if MPI.COMM_WORLD.Get_rank() == 0 :
err=os.system("cd "+localdir()+"/F90subroutines ; make all")
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
else :
print("Not compiling on other cores")
MPI.COMM_WORLD.Barrier()
else :
def compilef90(mod) :
adddirtopath(localdir()+"/F90subroutines")
try :
MPI
except :
err=os.system("cd "+localdir()+"/F90subroutines ; make all")
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
else :
if MPI == sys.modules['mpi4py'].MPI :
if MPI.COMM_WORLD.Get_rank() == 0 :
err=os.system("cd "+localdir()+"/F90subroutines ; make all")
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
else :
print("Not compiling on other cores")
MPI.COMM_WORLD.Barrier()
else :
print("MPI exists but is not from mpi4py module")
sys.exit()
return
......@@ -9,17 +9,8 @@ import codecs
import os
from inspect import currentframe, getframeinfo
import sys
localdir=os.path.dirname(getframeinfo(currentframe()).filename)
sys.path.append(localdir+'/F90subroutines')
"""
F90=localdir+'/F90subroutines'
err=os.system("cd "+F90+"; make all")
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
"""
from diagst import *
#
import F90tools as F90T
#
import getargs
config = getargs.SetupConfig()
......@@ -28,6 +19,10 @@ log_master, log_world = getargs.getLogger(__name__)
INFO, DEBUG, ERROR = log_master.info, log_master.debug, log_world.error
INFO_ALL, DEBUG_ALL = log_world.info, log_world.debug
#
F90T.adddirtopath("F90subroutines")
F90T.compilef90("diagst")
import diagst
#
class Locations :
def __init__(self, bbox) :
import RPPtools as RPP
......@@ -279,6 +274,7 @@ class Locations :
#
class PlacedLocations :
def __init__(self, GraphFile) :
#
nc = Dataset(GraphFile, 'r')
self.nbloc = nc.dimensions["locations"].size
self.gridshape = [nc.dimensions["y"].size,nc.dimensions["x"].size]
......@@ -331,7 +327,7 @@ class PlacedLocations :
"""
g0 = self.nbpt_glo[int(j)-1,int(i)-1] # -1 Because F -> C
b0 = int(k)
mask = diagst.upstmask(
mask = diagst.diagst.upstmask(
nbpt = self.nbpt,
nbasmax = self.nbasmax,
routetogrid = self.routetogrid,
......
......@@ -7,8 +7,8 @@ from inspect import currentframe, getframeinfo
from netCDF4 import Dataset
from netCDF4 import stringtochar, chartostring, stringtoarr
#
localdir=os.path.dirname(getframeinfo(currentframe()).filename)
sys.path.append(localdir+'/Stations')
import F90tools as F90T
F90T.adddirtopath("Stations")
FillValue = 1.e+20
#
# Gather user input.
......
Markdown is supported
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