Coder Social home page Coder Social logo

Collocation performance about cis-troll-match HOT 2 OPEN

duncanwp avatar duncanwp commented on June 26, 2024
Collocation performance

from cis-troll-match.

Comments (2)

adybbroe avatar adybbroe commented on June 26, 2024

Concerning collocation performance we made a test case and tested both cis and pyresample on kind of the same set of data. The test case is mapping a sub-section of VIIRS M-bands onto Meteosat-10 SEVIRI.

In order to have a reasonable small chunk of data in order for cis to complete in a reasonable amount of time (a few minutes) we subsetted the data by longitude/latitude (10-12 degrees East and 43-45 degrees north). We chose to do only nearest neighbour resampling/collocation with both cis and pyresample.

The number of data points in the cis-example was 2192 and it took 86.2 seconds

The subsetting with pytroll was done a little differently. The VIIRS scene was remapped onto a small Plate Caree frame corresponding to the same longitude/latitude boundaries. The number of data points were 5476 (74x74) and the collocation time was 1.5 seconds.

The hardware:
Laptop-PC running RHEL version 7.2
2 Hyperthreaded CPUs
Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
16Gb RAM

from cis-troll-match.

adybbroe avatar adybbroe commented on June 26, 2024

Here is the code snippets for the two scenarios (cis/pytroll and pure pytroll).
First cis (leaving out the actual loading using satpy:

    seviri_data = met10scn[0.6]
    seviri_area = seviri_data.info['area']
    seviri_units = seviri_data.info['units']
    lonlat = seviri_area.get_lonlats()
    seviri_lats = Coord(
        lonlat[1], Metadata(standard_name='latitude',
                            units='degrees'), 'y')
    seviri_lons = Coord(
        lonlat[0], Metadata(standard_name='longitude',
                            units='degrees'), 'x')

    ug_seviri = UngriddedData(
        seviri_data, Metadata(name=seviri_data.info['name'], units=seviri_data.info['units']), [seviri_lats, seviri_lons])

    data = scn['M05']
    area = data.info['area']
    units = data.info['units']
    lats = Coord(
        area.lats, Metadata(standard_name='latitude', units='degrees'), 'y')
    lons = Coord(
        area.lons, Metadata(standard_name='longitude', units='degrees'), 'x')
    print(area.lons.info)
    ug = UngriddedData(
        data, Metadata(name=data.info['name'], units=data.info['units']), [lats,
                                                                           lons])

    sub_seviri = ug_seviri.subset(x=[10, 12], y=[43, 45])
    sub = ug.subset(x=[10, 12], y=[43, 45])

    import time
    tic = time.time()
    col = sub_seviri.sampled_from(sub, kernel='nn_horizontal', h_sep=5.0)
    print time.time() - tic

And here with pytroll code only:

    lscn = met10scn.resample('testframe')
    seviri_data = lscn[0.6]
    seviri_area = seviri_data.info['area']
    seviri_units = seviri_data.info['units']
    lonlat = seviri_area.get_lonlats()

    data = scn['M05']
    area = data.info['area']
    units = data.info['units']

    import time
    tic = time.time()
    output_swath = geometry.SwathDefinition(lons=lonlat[0],
                                            lats=lonlat[1])
    input_swath = geometry.SwathDefinition(lons=area.lons,
                                           lats=area.lats)

    result = kd_tree.resample_nearest(input_swath,
                                      data,
                                      output_swath,
                                      radius_of_influence=10000,
                                      epsilon=0.5,
                                      fill_value=None)

    mask = result.mask | seviri_data.mask
    result.mask = mask
    seviri_data.mask = mask

    coldata = (result.compressed().ravel(), seviri_data.compressed().ravel())
    print time.time() - tic

from cis-troll-match.

Related Issues (5)

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.