Windy Community
    • Unread
    • Categories
    • Groups
    • Go to windy.com
    • Register
    • Login

    Help running a new plugin - error on the Windy plugin page

    Windy Plugins
    6
    22
    7.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • johnckealyJ
      johnckealy
      last edited by

      Hi,

      I've written a new plugin, called windy-plugin-skewt:

      https://github.com/johnckealy/windy-plugins-skewt

      I've successfully published it with npm, but when I try it out at https://www.windy.com/plugins, I get the following error:

      TypeError: Plugin.instance is not a function

      The package.json info displays, it just won't run. I realise that's not much to go on, but is there any chance someone at windy could have a quick look? It runs just fine locally using https://www.windy.com/dev. I'm hoping it will be a really useful plugin if I can get it going.

      Thanks!

      Gkikas LGPZG ivoI 2 Replies Last reply Reply Quote 3
      • Gkikas LGPZG
        Gkikas LGPZ Moderator @johnckealy
        last edited by

        @johnckealy
        Well done John!
        Hope someone of the Windy team will help you
        and soon your SkewT plugin will be available to all of us.

        1 Reply Last reply Reply Quote 0
        • ivoI
          ivo Administrator @johnckealy
          last edited by

          @johnckealy Happy to see another plugin dev. Will check the codes

          Gkikas LGPZG 1 Reply Last reply Reply Quote 1
          • Gkikas LGPZG
            Gkikas LGPZ Moderator @ivo
            last edited by

            @ivo
            ... any progress ?

            1 Reply Last reply Reply Quote 0
            • ivoI
              ivo Administrator
              last edited by

              Wow @johnckealy your plugin is monster. Found the bug and fixed. Will be deployed next week. Will create some data loader so plugins will have access to our backend API

              1 Reply Last reply Reply Quote 2
              • johnckealyJ
                johnckealy
                last edited by

                Great to hear, thanks @ivo! Sorry if the code is a little rough -- I'm a meteorologist learning programming, rather than the other way around... But would relish seeing it deployed with current data! :)

                1 Reply Last reply Reply Quote 2
                • ivoI
                  ivo Administrator
                  last edited by

                  Now is fixed and your plugin is working. As I suggest now I should have make soma data loader

                  1 Reply Last reply Reply Quote 1
                  • johnckealyJ
                    johnckealy
                    last edited by

                    @ivo - Brilliant! I'm chuffed to see it working on the site :) Let me know if you need any help understanding the code. You just need to load the variables Tascent, Pascent, Tdascent, U, and V with spot data at each level. The comments should hopefully explain this.

                    1 Reply Last reply Reply Quote 0
                    • ivoI
                      ivo Administrator
                      last edited by

                      Basically we can deliver the data we have. We download only part of ECMWF data to save the money. Can you check official ECMWF's domunetation and find their official name of these layers.

                      1 Reply Last reply Reply Quote 0
                      • johnckealyJ
                        johnckealy
                        last edited by

                        @ivo Windy appears to use pressure levels from ECMWF, with temperature, humidity, and wind at each of these levels already available on the site. So what needs to be done on your backend is to have a function that takes a lat/lon picker point as input, finds the nearest grid point on the model, and then finds the data at each of these pressure levels. You might be able to adapt this from my closest_latlon() function in plugin.html. The variable Pascent (the ascent data for P) will always be:

                        Pascent = [ 1000, 950, 925, 900, 850, 800, 700, 600, 500, 400, 300, 250, 200, 150 ]

                        Though I see you also use "surface" and "100m" instead of 1000hPa, so by all means use that if you also have temperature and relative humidity at those levels.

                        Then Tascent is the temperature (shortname is "T" in the ECMWF docs), U is the U-velocity (shortname "U"), V is the V-velocity (shortname "V").

                        One thing I'm now realising is that I used an equation to convert the humidity into the dewpoint while generating the sample data, so you'll need to add this into plugin.html. To get Tdascent (the dewpoint temperature ascent), relative humidity (shortname is "R" at ECMWF, and the Windy is named "Humidity") must be converted to dew point using this formula:

                        for (var p = 0; p < Pascent.length; p++) {
                        Tdascent[p] = 243.04*(Math.log(R[p]/100)+((17.625Tascent[p])/(243.04+Tascent[p])))/(17.625-Math.log(R[p]/100)-((17.625T)/(243.04+T)))
                        }

                        rittelsR 1 Reply Last reply Reply Quote 1
                        • rittelsR
                          rittels Code contributor @johnckealy | Premium
                          last edited by

                          @johnckealy
                          cool plugin, you could use the interpolator in the meantime?

                          johnckealyJ 1 Reply Last reply Reply Quote 0
                          • johnckealyJ
                            johnckealy @rittels
                            last edited by

                            @rittels Sure, though I'd say nearest neighbour is plenty for now! Vertically there is some interpolation going on in the js, and horizontally, ECMWF's 9km is loads of detail :) Would definitely be a nice addition for later.

                            1 Reply Last reply Reply Quote 0
                            • rittelsR
                              rittels Code contributor | Premium
                              last edited by

                              Hi John
                              Nearest neighbor is indeed plenty!!
                              However, you can use the W.interpolator to read data at the different levels. It is slow and cumbersome, but somewhat cute.
                              I gave it a go myself: windy-plugin-readlevels.

                              1 Reply Last reply Reply Quote 0
                              • ivoI
                                ivo Administrator
                                last edited by

                                @rittels said in Help running a new plugin - error on the Windy plugin page:

                                windy-plugin-readlevels

                                Do not worry I will make dataLoader, so far I am finishing one big thing on Windy

                                rittelsR 1 Reply Last reply Reply Quote 2
                                • rittelsR
                                  rittels Code contributor @ivo | Premium
                                  last edited by

                                  @ivo Thx!!

                                  1 Reply Last reply Reply Quote 1
                                  • johnckealyJ
                                    johnckealy
                                    last edited by

                                    @ivo great to see the plugin loader is ready for model data. I'll look into updating the skewt plugin when I get a chance (bit busy at the moment though).

                                    There was a bug in my plugin that showed the error "TypeError: Plugin.instance is not a function" and you fixed this. Can you remember what the bug was? I'll need to patch in the fix to my original version.

                                    ivoI 1 Reply Last reply Reply Quote 1
                                    • ivoI
                                      ivo Administrator @johnckealy
                                      last edited by

                                      @johnckealy It was bug on our side

                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        shashighedia @ivo | Premium
                                        last edited by

                                        @ivo hi can some one explain what the red line on the temperature is?- thanks
                                        f9850477-ca82-49b2-a6ee-f9c6aa4e31a8-image.png

                                        KorinaK johnckealyJ 2 Replies Last reply Reply Quote 0
                                        • KorinaK
                                          Korina @shashighedia
                                          last edited by

                                          @shashighedia @johnckealy

                                          Korina

                                          1 Reply Last reply Reply Quote 1
                                          • johnckealyJ
                                            johnckealy @shashighedia
                                            last edited by

                                            @shashighedia

                                            The red line is a parcel ascent. Drag the purple slider to the right, and this will change. The concept is that as the surface temperature increases, the energy of a rising parcel of also increases (known as CAPE). By comparing the red curve with the existing temperature profile, you can diagnose the instability (likelihood of showers, thunderstorms etc) of the atmosphere. In theory, you can even use this to predict the exact onset times of convective clouds, or even afternoon thunderstorms. Just google "radiosonde parcel ascent", "convective available potential energy", or "lifted index" to get started.

                                            S 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
                                            NodeBB & contributors, OSM & contributors, HERE maps
                                            Terms of Use     Privacy Policy