pymat
pymat

Reputation: 1192

Numpy data types: data type not understood

still fairly new to Numpy in Python...I'm trying to build up my own array from RINEX data (see example):

G13 2014 01 02 02 00 00  .440594740212D-04 -.375166564481D-11  .000000000000D+00
      .290000000000D+02  .705937500000D+02  .382980238378D-08 -.135945866650D+01
      .353716313839D-05  .509947887622D-02  .137723982334D-04  .515366394615D+04
      .352800000000D+06 -.819563865662D-07  .312956454846D+01 -.633299350739D-07
      .979542877504D+00  .129500000000D+03  .219020237787D+01 -.757495838456D-08
     -.431803700643D-09  .100000000000D+01  .177300000000D+04  .000000000000D+00
      .240000000000D+01  .000000000000D+00 -.111758708954D-07  .290000000000D+02
      .345618000000D+06  .400000000000D+01

I'm using the following code for initialised matrix:

parameter_block_list = np.empty(cs.TOTAL_SATS, cs.RINEX_NAVIGATION_PARAMETERS) * np.NaN 

The problem is the conversion of the numbers in the RINEX file block, where each number uses "D" as an exponential. Is there a way in Numpy to make a data type conversion that caters for such data formats? The error I'm receiving is:

TypeError: data type not understood

Upvotes: 4

Views: 5417

Answers (1)

xnx
xnx

Reputation: 25560

I think the reason you're getting data type not understood is that in passing the dimensions of your array to empty as separate arguments, the first is being treated as the shape and the second as the dtype -- see the docs. Perhaps you mean to pass the shape as a tuple:

parameter_block_list = np.empty((cs.TOTAL_SATS, cs.RINEX_NAVIGATION_PARAMETERS)) * np.NaN

Upvotes: 2

Related Questions