Code Monkey home page Code Monkey logo

Comments (4)

iainrussell avatar iainrussell commented on August 28, 2024 2

Hi @meteoDaniel,

Many thanks for this report! I hope I have good news for you :)

First, it seems that you found an interesting behaviour in pdbufr - it expects 'proper' tuples as input, and if you omit the trailing comma as you do in columns=('airTemperature') then it is not passed as a tuple, but as a single element, and pdbufr does not properly handle that. So change that line to columns=('airTemperature',) to get something generated by pdbufr! I'll add an issue to get that fixed.

The second point is that we have quite a large code refactor waiting to be released - if you're in a position to install pdbufr from git, I encourage you to do so and use the latest master branch. We used data very similar to yours to test develop and test it with, so we expect it to work with this version. When I do this, I get sensible results from your filter (I hand-checked a few using Metview's BUFR examiner, otherwise known as CodesUI in its standalone form).

I'd be interested to know if these tips allow you to get what you need from pdbufr.

Cheers,
Iain

from pdbufr.

iainrussell avatar iainrussell commented on August 28, 2024 1

Hi @meteoDaniel,

Glad the fix is working!

For timePeriod, I think you may just have a typo? There is no timePeriod of 10.0 in the data (I believe), but there is -10, and putting that in the filter instead of 10 works for me. I can also query all the unique values of timePeriod like this:

# use a tuple to represent a range of values
df = pdbufr.read_bufr(
        'Z__C_EDZW_20210214100000_bda01,synop_bufr_GER_999999_999999__MW_536.bin',
             columns=('maximumWindGustSpeed',  'stationNumber', 'data_datetime', 'timePeriod'),
             filters={'timePeriod': slice(-10000.0, 10000.0)},
             required_columns=False)
print(df)
un = np.unique(df.timePeriod)
print(df.timePeriod[un])

and I get this:

-1800 
-360
-60
-30
-24
-12
-10
-1 
 0

Metview also agrees that these are all the values in the file.

For your larger question, I think I'm getting a bit lost in terms of what you want. I can indeed see that this is a complicated BUFR file, so it would be good to be able to handle it properly. Can you describe what information you'd like to retrieve from it please?

Many thanks!
Iain

from pdbufr.

meteoDaniel avatar meteoDaniel commented on August 28, 2024

@iainrussell thanks for this update. E.g. filtering for the 2m Temperature works right now.

I want to give you an update of my investigations:

  1. Filtering maximumWindGustSpeed by timePeriod is not supported (from the version I have took yesterday from the repo).
df = pdbufr.read_bufr(
        'Z__C_EDZW_20210214100000_bda01,synop_bufr_GER_999999_999999__MW_536.bin',
             columns=('maximumWindGustSpeed',  'stationNumber', 'data_datetime'),
             filters={'timePeriod': [10.]},
             required_columns=False)
  1. To extract all informations correctly I think the best strategy (please correct me If I am wrong) is to parse the bufr file for meta data first:
meta_data = pdbufr.read_bufr(
        'Z__C_EDZW_20210214100000_bda01,synop_bufr_GER_999999_999999__MW_536.bin',
            columns=( 'latitude', 'longitude', 'stationNumber', 'stationOrSiteName', 'heightOfStationGroundAboveMeanSeaLevel', 'data_datetime'),
            required_columns=False)

And then a value (here airTemperature) with the stationNumber to map meta_data to the measures:

df = pdbufr.read_bufr(
        'Z__C_EDZW_20210214100000_bda01,synop_bufr_GER_999999_999999__MW_536.bin',
             columns=('airTemperature', 'stationNumber', 'data_datetime'),
              filters={'heightOfSensorAboveLocalGroundOrDeckOfMarinePlatform': 2.0},
           required_columns=False)

I think the point is that this strategy only works if I can match each measure to the correct stationNumber?!
What do you think ?

And I have testes other timePeriod variables and they did not worked, too.

from pdbufr.

meteoDaniel avatar meteoDaniel commented on August 28, 2024

Thanks a lot for your support. I will make further investigations later on pdbufr.

from pdbufr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.