wip
This commit is contained in:
parent
3a645d21dc
commit
33cb0dd7da
|
|
@ -1,5 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="LaravelPint">
|
||||
<laravel_pint_settings>
|
||||
<LaravelPintConfiguration tool_path="$PROJECT_DIR$/laravel_app/vendor/bin/pint" />
|
||||
</laravel_pint_settings>
|
||||
</component>
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -1,30 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
filename="report_dummie.docx"
|
||||
weeks_ago="0"
|
||||
report_date="2022-12-12"
|
||||
|
||||
# Parse de command line argumenten
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
# Parse command line arguments
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--weeks_ago=*)
|
||||
weeks_ago="${1#*=}"
|
||||
weeks_ago="${arg#*=}"
|
||||
;;
|
||||
*)
|
||||
echo "Onbekende optie: $1"
|
||||
echo "Unknown option: $arg"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Controleer of de vereiste argumenten zijn ingesteld
|
||||
# Check if required arguments are set
|
||||
if [ -z "$weeks_ago" ]; then
|
||||
echo "Missende argumenten. Gebruik: build_mosiac.sh --weeks_ago=3"
|
||||
echo "Missing arguments. Use: build_mosiac.sh --weeks_ago=3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "Weeks ago: $weeks_ago"
|
||||
cd /Users/mfolkerts/smartCane/r_app
|
||||
Rscript 2_CI_data_prep.R $weeks_ago
|
||||
cd ../r_app
|
||||
Rscript 2_CI_data_prep.R $weeks_ago
|
||||
|
|
@ -1,51 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
filename="report_dummie.docx"
|
||||
weeks_ago="0"
|
||||
report_date="2022-12-12"
|
||||
|
||||
# Parse de command line argumenten
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
# Parse command line arguments
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--filename=*)
|
||||
filename="${1#*=}"
|
||||
filename="${arg#*=}"
|
||||
;;
|
||||
--weeks_ago=*)
|
||||
weeks_ago="${1#*=}"
|
||||
weeks_ago="${arg#*=}"
|
||||
;;
|
||||
--report_date=*)
|
||||
report_date="${1#*=}"
|
||||
report_date="${arg#*=}"
|
||||
;;
|
||||
*)
|
||||
echo "Onbekende optie: $1"
|
||||
echo "Unknown option: $arg"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Controleer of de vereiste argumenten zijn ingesteld
|
||||
if [ -z "$filename" ] || [ -z "$weeks_ago" ] || [ -z $report_date ]; then
|
||||
echo "Missende argumenten. Gebruik: build_reports.sh --filename=hello.txt --weeks_ago=3 --report_date=2020-01-01"
|
||||
# Check if required arguments are set
|
||||
if [ -z "$filename" ] || [ -z "$weeks_ago" ] || [ -z "$report_date" ]; then
|
||||
echo "Missing arguments. Use: build_reports.sh --filename=hello.txt --weeks_ago=3 --report_date=2020-01-01"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Je script logica hier
|
||||
# Script logic here
|
||||
echo "Filename: $filename"
|
||||
echo "Weeks ago: $weeks_ago"
|
||||
echo "Report date: $report_date"
|
||||
|
||||
#script_dir="$(dirname "$0")"
|
||||
#echo $script_dir;
|
||||
#/bin/ps aux | grep fontd
|
||||
#output_file="/Users/mfolkerts/smartCane/laravel_app/storage/app/chemba/$filename"
|
||||
|
||||
#echo "Output file: $output_file"
|
||||
echo '\n'
|
||||
|
||||
echo 'zx28tb' | /usr/bin/sudo -S launchctl load -w /System/Library/LaunchAgents/com.apple.fontd.useragent.plist
|
||||
cd /Users/mfolkerts/smartCane/r_app
|
||||
#Rscript -e "rmarkdown::render('/Users/mfolkerts/smartCane/r_app/CI_Report_dashboard_planet.Rmd', 'all')"
|
||||
#Rscript 1_harvest_data_EcoFarm_v2.R
|
||||
#Rscript 2_CI_data_prep.R $weeks_ago
|
||||
Rscript -e "rmarkdown::render('CI_report_dashboard_planet.Rmd', output_file='$filename', params=list(ref='$ref', report_date='$report_date'))"
|
||||
Rscript -e "rmarkdown::render('CI_report_dashboard_planet.Rmd', output_file='$filename', params=list(ref='$ref', report_date='$report_date'))"
|
||||
|
|
@ -6,10 +6,8 @@
|
|||
use App\Models\ProjectDownload;
|
||||
use Illuminate\Bus\Batchable;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Process\Exceptions\ProcessFailedException;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Carbon\Carbon;
|
||||
|
|
@ -37,42 +35,32 @@ public function __construct(ProjectDownload $download, Carbon $date,)
|
|||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$projectFolder = base_path('../');
|
||||
|
||||
$command = [
|
||||
sprintf('%srunpython.sh', $projectFolder),
|
||||
sprintf('%srunpython.sh', base_path('../')),
|
||||
sprintf('--date=%s', $this->date->format('Y-m-d')),
|
||||
sprintf('--days=%d', $this->days),
|
||||
sprintf('--project_dir=%s', $this->download->project->download_path),
|
||||
];
|
||||
|
||||
// Convert commands array to a single string
|
||||
|
||||
$process = new Process($command);
|
||||
$process->setTimeout(3600); // stel een geschikte timeout in
|
||||
$process->start();
|
||||
$process->setTimeout(3600);
|
||||
$process->run();
|
||||
|
||||
try {
|
||||
$process->wait(function ($type, $buffer) use (&$myOutput) {
|
||||
logger($buffer);
|
||||
});
|
||||
} catch (ProcessFailedException $exception) {
|
||||
logger('error', $exception->getMessage());
|
||||
if (!$process->isSuccessful()) {
|
||||
logger('error', $process->getErrorOutput());
|
||||
}
|
||||
|
||||
$this->download->update([
|
||||
'status' => 'completed',
|
||||
]);
|
||||
$this->download->update(['status' => 'completed']);
|
||||
}
|
||||
|
||||
public static function handleForDate(Project $project, Carbon $date)
|
||||
{
|
||||
$filename = sprintf('%s.tif', $date->format('Y-m-d'));
|
||||
$filename = $date->format('Y-m-d') . '.tif';
|
||||
if ($project->downloads()->where(['status' => 'completed', 'name' => $filename])->count() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$path = sprintf('%s/%s/%s', $project->download_path, 'merged_final_tif', $filename);
|
||||
$path = $project->download_path . '/merged_final_tif/' . $filename;
|
||||
return new self(
|
||||
$project->downloads()->create([
|
||||
'name' => $filename,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public function handle(): void
|
|||
|
||||
$process = new Process($command);
|
||||
$process->setTimeout(120);
|
||||
$currentPath = '/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin/Users/mfolkerts/anaconda3/bin:/Library/Apple/usr/bin';
|
||||
$currentPath = 'usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin/Users/mfolkerts/anaconda3/bin:/Library/Apple/usr/bin';
|
||||
|
||||
$process->setEnv(['PATH' => $currentPath.':/usr/local/Cellar/pandoc/3.1.8/bin/pandoc']);
|
||||
// $process->setTimeout(36000); // stel een geschikte timeout in
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ message("starting ", file)
|
|||
# names(CI) <- c("green","nir")
|
||||
message("raster loaded")
|
||||
|
||||
|
||||
|
||||
CI <- CI[[2]]/CI[[1]]-1
|
||||
# CI <- CI$nir/CI$green-1
|
||||
message("CI calculated")
|
||||
|
|
@ -100,7 +98,6 @@ message("CI calculated")
|
|||
|
||||
# v_crop <- mask_raster(v, pivot_sf_q)
|
||||
return(CI)
|
||||
|
||||
}
|
||||
|
||||
# rasters_masked <- map(filtered_files, create_mask_and_crop, pivot_sf_q)
|
||||
|
|
|
|||
Loading…
Reference in a new issue