mscross / pysplit

A package for HYSPLIT air parcel trajectory analysis.
BSD 3-Clause "New" or "Revised" License
144 stars 79 forks source link

All of the sudden problem with generate_bulk traj #88

Closed NBolohanUO closed 2 years ago

NBolohanUO commented 2 years ago

Hey all,

Out of nowhere, I have started receiving this error on scripts that previously would run no problem. The problem occurred after I deleted old trajectories but I'm confused because the problem is happening when I try to generate a new trajectory. The error is as follows:

Traceback (most recent call last): File "C:\Users\Noah Bolohan\AppData\Local\Programs\Python\Python39\Scripts\PySplit\MPBLDDJuly2005Model3BugFix.py", line 76, in pysplit.generate_bulktraj(basename, hysplit_working, output_dir, meteo_dir, years, months, hours, altitudes, coordinates, run) File "C:\ProgramData\Anaconda3\envs\pysplitenv\lib\site-packages\pysplit\trajectory_generator.py", line 165, in generate_bulktraj call(hysplit) File "C:\ProgramData\Anaconda3\envs\pysplitenv\lib\subprocess.py", line 339, in call with Popen(*popenargs, *kwargs) as p: File "C:\ProgramData\Anaconda3\envs\pysplitenv\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in init super(SubprocessPopen, self).init(args, **kwargs) File "C:\ProgramData\Anaconda3\envs\pysplitenv\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "C:\ProgramData\Anaconda3\envs\pysplitenv\lib\subprocess.py", line 1207, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

I'm not really sure how to read this error and solve my problem, but it feels very much out of my reach. Could someone help me solve this?

NBolohanUO commented 2 years ago

To add, I can successfully run the given trajectory_generator file no problem, and here is my code. I've tried to copy-paste from working scripts as much as I could but as soon as I get to the generate_bulktraj, I get my above error.

#Import modules
#--------------
import numpy as np
import pandas as pd
import pysplit
import matplotlib.pyplot as plt

#Setup parameters
#----------------

N=1; #number of beetle samples per day

tm=2367.57; #minimum flight time (seconds)
alpha=0.670579; #flight time shape parameter

mu=17.11348307; #temperature logistic pdf location
s=2.53918177 #temperature pdf scale

## LandingNoiseCovariance=0.001*np.identity(2); #Covariance for 2D Gaussian random noise RV

#Creat Hysplit trajectory group and map objects, for each day
#---------------------------------------------

fig, ax=plt.subplots()
mapcorners =  [-124, 50, -115, 58]
standard_pm = [-110,20,40,30]
param_dict = {'projection':'lcc', 'latlon_labelspacing':(2,2),
              'latlon_spacing':(1,1), 'latlon_fs':16, 'drawstates':True,
              'resolution':'l'}
map_params=pysplit.MapDesign(mapcorners,standard_pm,**param_dict)
MPBMap=map_params.make_basemap(ax=ax)

hysplit_working = r'C:\hysplit\working'
meteo_dir = r'C:\hysplit\working'
output_dir = r'C:\Users\Noah Bolohan\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.9\trajectories\MPBJuly2005\Model3\Jul17'

#Start Algorithm
#---------------

# Assign starting parameters and plot starting point
basename = 'MPBLDDJuly2005'
years = [2005]
months = [7]
hours = [19]
run = 1
coordinates = (55.941,-121.405)

mappable=pysplit.traj_scatter(0,coordinates[1],coordinates[0],
                              MPBMap,size=50,edgecolor='red')

for i in range(0,N):
    #Assign RVs for beetle behaviour
    BeetleColour=list(np.random.choice(range(256), size=3)/256)
    altitudes=[10*np.random.choice(range(65))+10];
    randomflight=np.random.uniform(0,1);
    randomtemp=np.random.uniform(0.0001,1);
    MaxFlightTime=20
    TemperatureThresholdInterval=5
##    MaxFlightTime=min(np.floor(tm*pow(1-randomflight,-1/alpha)/3600),8);
##    TemperatureThresholdInterval=np.abs(-s*np.log(1/randomtemp-1));

    #Generate initial trajectory and plot it
    pysplit.generate_bulktraj(basename, hysplit_working, output_dir, meteo_dir,
                              years, months, hours, altitudes, coordinates, run,
                              monthslice=slice(16, 17, 1), hysplit='C:\hysplit\exec\hyts_std.exe')
NBolohanUO commented 2 years ago

I was able to fix this issue by having my meteo_dir folder separate from my hysplit_working folder. This wasn't an issue in the past but I suppose all of the sudden it was!