GXError: Attempting to load too many resources.
PeterTschirhart
Posts: 3
Hi,
I’m trying to load 2048 channels of radiometric spectra data (2 arrays x 1024 channels each) into a dataframe through a Jupyter notebook. I can load a database which has 1024 channels of either downward or upward looking spectra no problem, but if I try to load a database which contains both I get the error “GXError: Attempting to load too many resources”. This seems to happen irrespective of the number of lines I have selected. So my question, is there a limit on the number of database channels which can be loaded into a numpy array/dataframe using the gxapi?
Thank,
The full error:
GXError Traceback (most recent call last)
in ()
8 # load the data into dataframes
9 for l,m in lines.items():
---> 10 npd, ch, fid = gdb.read_line(str(l))
11 df[l] = pd.DataFrame(npd, columns=ch)
C:\Anaconda3\lib\site-packages\geosoft\gxpy\gdb.py in read_line(self, line, channels, dtype, fid, dummy)
1576
1577 # get VVs of data, resampled to a common fid
-> 1578 data = self.read_line_vv(line, channels, dtype, fid, common_fid=True)
1579 if len(data) == 0:
1580 return np.array([]), [], (0.0, 1.0)
C:\Anaconda3\lib\site-packages\geosoft\gxpy\gdb.py in read_line_vv(self, line, channels, dtype, fid, common_fid)
1490 for c in ch_names:
1491 cs = self._db.find_symb(c, gxapi.DB_SYMB_CHAN)
-> 1492 vv = self.read_channel_vv(ls, cs, dtype=dtype)
1493 chvv.append((c, vv))
1494
C:\Anaconda3\lib\site-packages\geosoft\gxpy\gdb.py in read_channel_vv(self, line, channel, dtype)
1372 if dtype is None:
1373 dtype = self.channel_dtype(cs)
-> 1374 vv = gxvv.GXvv(dtype=dtype)
1375 self.lock_read_(cs)
1376 try:
C:\Anaconda3\lib\site-packages\geosoft\gxpy\vv.py in __init__(self, array, dtype, fid, unit_of_measure, dim)
199 if not self._is_float and self._dim != 1:
200 raise VVException(_t('2 or 3 dimensioned data must be float32 or float64'))
--> 201 self._gxvv = gxapi.GXVV.create_ext(gxu.gx_dtype_dimension(self._dtype, self._dim), 0)
202 self.fid = fid
203 self._sr = None
C:\Anaconda3\lib\site-packages\geosoft\gxapi\GXVV.py in create_ext(cls, type, elements)
467 short for the `GXVV `.
468 """
--> 469 ret_val = gxapi_cy.WrapVV._create_ext(GXContext._get_tls_geo(), type, elements)
470 return GXVV(ret_val)
471
gxapi_cy.pyx in gxapi_cy.WrapVV._create_ext()
gxapi_cy.pyx in gxapi_cy._raise_on_gx_errors()
GXError: Attempting to load too many resources.
I’m trying to load 2048 channels of radiometric spectra data (2 arrays x 1024 channels each) into a dataframe through a Jupyter notebook. I can load a database which has 1024 channels of either downward or upward looking spectra no problem, but if I try to load a database which contains both I get the error “GXError: Attempting to load too many resources”. This seems to happen irrespective of the number of lines I have selected. So my question, is there a limit on the number of database channels which can be loaded into a numpy array/dataframe using the gxapi?
Thank,
The full error:
GXError Traceback (most recent call last)
8 # load the data into dataframes
9 for l,m in lines.items():
---> 10 npd, ch, fid = gdb.read_line(str(l))
11 df[l] = pd.DataFrame(npd, columns=ch)
C:\Anaconda3\lib\site-packages\geosoft\gxpy\gdb.py in read_line(self, line, channels, dtype, fid, dummy)
1576
1577 # get VVs of data, resampled to a common fid
-> 1578 data = self.read_line_vv(line, channels, dtype, fid, common_fid=True)
1579 if len(data) == 0:
1580 return np.array([]), [], (0.0, 1.0)
C:\Anaconda3\lib\site-packages\geosoft\gxpy\gdb.py in read_line_vv(self, line, channels, dtype, fid, common_fid)
1490 for c in ch_names:
1491 cs = self._db.find_symb(c, gxapi.DB_SYMB_CHAN)
-> 1492 vv = self.read_channel_vv(ls, cs, dtype=dtype)
1493 chvv.append((c, vv))
1494
C:\Anaconda3\lib\site-packages\geosoft\gxpy\gdb.py in read_channel_vv(self, line, channel, dtype)
1372 if dtype is None:
1373 dtype = self.channel_dtype(cs)
-> 1374 vv = gxvv.GXvv(dtype=dtype)
1375 self.lock_read_(cs)
1376 try:
C:\Anaconda3\lib\site-packages\geosoft\gxpy\vv.py in __init__(self, array, dtype, fid, unit_of_measure, dim)
199 if not self._is_float and self._dim != 1:
200 raise VVException(_t('2 or 3 dimensioned data must be float32 or float64'))
--> 201 self._gxvv = gxapi.GXVV.create_ext(gxu.gx_dtype_dimension(self._dtype, self._dim), 0)
202 self.fid = fid
203 self._sr = None
C:\Anaconda3\lib\site-packages\geosoft\gxapi\GXVV.py in create_ext(cls, type, elements)
467 short for the `GXVV `.
468 """
--> 469 ret_val = gxapi_cy.WrapVV._create_ext(GXContext._get_tls_geo(), type, elements)
470 return GXVV(ret_val)
471
gxapi_cy.pyx in gxapi_cy.WrapVV._create_ext()
gxapi_cy.pyx in gxapi_cy._raise_on_gx_errors()
GXError: Attempting to load too many resources.
0
Comments
-
@PeterTschirhart , yes, this approach has tripped a limit of 2048 resources, which is the maximum number of GXAPI classes instances that can be created at once.
The simple gdb.read_line() will slice your 1024 radiometric channels into 1024 VV's, hence the problem. read_line() is intended for simple applications on relatively simple databases. In your application I suggest reading the specific channels you want, and use read_channel_va() to read the radiometric channels. This will return the channel in a single va, which uses 1 resource rather than 1024.0 -
Prefect, thanks. That way is much faster too.0
This discussion has been closed.