4

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
asked Jan 27, 2016 at 12:22
3
  • 1
    If you replace the D with an e, would it work? Commented Jan 27, 2016 at 12:27
  • 1
    I think you have two different problems - the error you're seeing is a result of the arguments you've given to np.empty, not the format of your data. Commented Jan 27, 2016 at 12:32
  • 1
    I think np.empty takes a tuple of dimensions doesn't it? np.empty((cs.TOTAL_SATS, cs.RINEX_NAVIGATION_PARAMETERS)) Commented Jan 27, 2016 at 12:33

1 Answer 1

2

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
answered Jan 27, 2016 at 12:35
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.