Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Running your code, I got this error as follows: #19

Open
SerdarHelli opened this issue Sep 27, 2022 · 11 comments
Open

When Running your code, I got this error as follows: #19

SerdarHelli opened this issue Sep 27, 2022 · 11 comments

Comments

@SerdarHelli
Copy link

In the settings , I changed

data_settings:
client: IRIS #enter all the clients separated by commas
network: "KOERI" #* for all stations
station: "" # for all stations
channel: BHZ,BHE,BHN #
locations: {"","00"} #List all locations, e.g "","00"

and

Define the geographical region

mnlong: 25 #minimum longitude
mxlong: 45 #maximum longitude
mnlat: 36 #minimum latitude
mxlat: 45 #maximum latitude

rf_data.get_stnxml(network=network, station=station)
File "C:\Users\pc\Desktop\stadium\STADIUM-Py-master\rfsks_support\download_large_data.py", line 82, in get_stnxml
inventory.write(self.inventoryfile, 'STATIONXML')
UnboundLocalError: local variable 'inventory' referenced before assignment
2022/09/27 18:22:44|INFO|

2022/09/27 18:22:44|INFO| Obtaining events catalog
2022/09/27 18:22:44|ERROR| No data available, exiting...

@cplegendre
Copy link
Collaborator

KOERI data are not available from IRIS.
Please try to change the "input_file.yaml" as follows:

client: KOERI #enter all the clients separated by commas
network: "KO" #* for all stations

This should fix the issue.

@Karaca2
Copy link

Karaca2 commented Oct 1, 2022

Dear Dr Cédric

The question relating to the geographical region was asked before by my former student, Serdar helli.
Thanks for your reply. We solved the previous problem according to your reply.
But, there is another problem as follows:

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\axes_axes.py", line 5747, in _pcolorargs
C.shape, Nx, Ny, funcname))

TypeError: Dimensions of C (539, 1080) are incompatible with X (1081) and/or Y (540); see help(pcolormesh)

thanks in advance for your reply

@cplegendre
Copy link
Collaborator

When does this error occurs?
I guess it happens after the computation, when plotting the results. But at which stage?

@Karaca2
Copy link

Karaca2 commented Oct 1, 2022

as you see,
after collecting and processing RF data,

2022/10/01 17:17:22|INFO| Searching and downloading data for RF; KO-AFSR
2022/10/01 17:17:22|INFO| Plotting events map KO-AFSR-RF-events_map.png
Traceback (most recent call last):

File "", line 1, in
runfile('I:/serdar/stadium.py', wdir='I:/serdar')

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "I:/serdar/stadium.py", line 368, in
main()

File "I:/serdar/stadium.py", line 217, in main
oss.select_to_download_events(catalogloc,datafileloc,dest_map,RFsta,rf_data,minmagnitudeRF,maxmagnitudeRF,plot_stations,plot_events,locations,method='RF')

File "I:\serdar\rfsks_support\other_support.py", line 198, in select_to_download_events
rf_data.download_data(catalogtxtloc=catalogloc,datafileloc=datafileloc,tot_evnt_stns=total_events,rem_evnts=rem_events, plot_stations=plot_stations, plot_events=plot_events,dest_map=dest_map,locations=locations)

File "I:\serdar\rfsks_support\download_large_data.py", line 263, in download_data
events_map(evlons=df['evlon'], evlats=df['evlat'], evmgs=evmg, evdps=df['evdp'], stns_lon=slon, stns_lat=slat, destination=dest_map,figfrmt=self.fig_frmt, clon = slon , outname=f'{event_plot_name}')

File "I:\serdar\rfsks_support\plotting_map.py", line 273, in events_map
plot_topo_simple(eq_map,cmap=plt.cm.rainbow)

File "I:\serdar\rfsks_support\plotting_map.py", line 18, in plot_topo_simple
cs = map.pcolormesh(lons,lats,etopo,cmap=cmap,latlon=True,shading='gouraud')

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\mpl_toolkits\basemap_init_.py", line 548, in with_transform
return plotfunc(self,x,y,data,*args,**kwargs)

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\mpl_toolkits\basemap_init_.py", line 3457, in pcolormesh
ret = ax.pcolormesh(x,y,data,**kwargs)

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib_init_.py", line 1601, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\axes_axes.py", line 6157, in pcolormesh
X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\axes_axes.py", line 5747, in _pcolorargs
C.shape, Nx, Ny, funcname))

TypeError: Dimensions of C (539, 1080) are incompatible with X (1081) and/or Y (540); see help(pcolormesh)

@cplegendre
Copy link
Collaborator

Interesting. When running on my machine it runs smoothly.
It may be because we are using a different version of matplotlib.
Could you share your environment file? Therefore I could compare with mine.

@cplegendre
Copy link
Collaborator

KO-AFSR-RF-events_map

@cplegendre cplegendre reopened this Oct 1, 2022
@SerdarHelli
Copy link
Author

I am not working on this project but I tried.
These are library with versions. And I tried on python 3.9.7 and windows10 platform
Cartopy==0.18.0
matplotlib==3.5.3
numpy==1.22.1
obspy==1.3.0
pandas==1.3.4
PyYAML==6.0
rf==1.0.1
scipy==1.7.1
Shapely==1.8.4
SplitWavePy==0.3.0
tqdm==4.62.3

Thank you for your time.

@cplegendre
Copy link
Collaborator

The main differences I notice are that we tested this code on Linux and OS X with matplotlib==3.1.1, while you are using matplotlib==3.5.3
I guess this update caused some issues with our code.
You could try:
conda install matplotlib==3.1.1

@Karaca2
Copy link

Karaca2 commented Oct 3, 2022

I installed matplotlib==3.1.1 after removing matplotlib==3.5.3.
I got the same error again
is there any way to solve this problem?

@cplegendre
Copy link
Collaborator

An easy way would be to disable the automated plots (by matplotlib).
In Settings/stepwise.yaml:

plot_settings:
- plot_stations: 0 #plot the stations map of all available stations and all retrieved stations
- plot_events: 0 #plot the stations map of all retrieved events for each station
- plot_all_retrieved_events_stations: 0 

Then plot the necessary images using customized scripts that should be easy to write.

@Karaca2
Copy link

Karaca2 commented Oct 4, 2022

Traceback (most recent call last):

File "", line 1, in
runfile('I:/serdar/stadium.py', wdir='I:/serdar')

File "C:\Users\gulten.polat\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "C:\Users\gulten.polat\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "I:/serdar/stadium.py", line 368, in
main()

File "I:/serdar/stadium.py", line 217, in main
oss.select_to_download_events(catalogloc,datafileloc,dest_map,RFsta,rf_data,minmagnitudeRF,maxmagnitudeRF,plot_stations,plot_events,locations,method='RF')

File "I:\serdar\rfsks_support\other_support.py", line 198, in select_to_download_events
rf_data.download_data(catalogtxtloc=catalogloc,datafileloc=datafileloc,tot_evnt_stns=total_events,rem_evnts=rem_events, plot_stations=plot_stations, plot_events=plot_events,dest_map=dest_map,locations=locations)

File "I:\serdar\rfsks_support\download_large_data.py", line 236, in download_data
strm,res,msg = multi_download(self.client,self.inv,net,stn,slat,slon,elat,elon,evdp,evtime,em,emt,fcat,stalons=rf_stalons,stalats=rf_stalats,staNetNames=rf_staNetNames,phase='P',locations=locations)

File "I:\serdar\rfsks_support\rfsks_extras.py", line 279, in multi_download
strm = retrieve_waveform(client_local,net,stn,t1,t2,stats_dict=stats_args,cha="BHE,BHN,BHZ",loc=loc,pharr = pharr, phasenm = phase)

File "I:\serdar\rfsks_support\rfsks_extras.py", line 228, in retrieve_waveform
filter_traces_rf(st,pharr = pharr)

File "I:\serdar\rfsks_support\rfsks_extras.py", line 48, in filter_traces_rf
if minendtime(alledtimes)-pharr>=startpoint and pharr - maxstarttime(allsttimes)>=endpoint:

File "I:\serdar\rfsks_support\rfsks_extras.py", line 21, in minendtime
minval0 = alledtimes[0]

IndexError: list index out of range

??? I made these changes in stepwise.yaml. It worked until this error:
IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants