Python: advice on taming a slow loop required for viewing large GIS data sets

enter the image description here

I am working to plot a large GIS dataset that I have shown a previous sample of about 1/6 of the data. I am happy with how fast the data loads and bokeh renders html almost instantly. However, I have come across a fairly active loop in my code that is not scaling well as I increase the 1) number of rows and 2) the resolution of the polygons. I just got killed in the #count points loop and I wonder if there isn't a better way to do this?

I found the suggestion for a loop from a GIS readthedoc.io and was happy with its performance for a few thousand points a couple of months ago. But now the project needs to process a GeoDataFrame with> 730000 rows. Am I supposed to use a better method to count the number of points in each polygon? I'm at a modern desk to do the calculation, but the project has access to Azure resources, maybe that's the majority of people who do this type of calculation professionally? I'd rather do the calculation locally, but it means my desktop might have to wait for maximum CPU cycles overnight or longer, which is not an exciting prospect. I am using Python 3.8.2 and Conda 4.3.2.

from shapely.geometry import Polygon
import pysal.viz.mapclassify as mc
import geopandas as gpd

def count_points(main_df, geo_grid, levels=5):
    """
    outputs a gdf of polygons with a columns of classifiers to be used for color mapping
    """
    pts = gpd.GeoDataFrame(main_df("geometry")).copy()

    #counts points
    pts_in_polys = ()
    for i, poly in geo_grid.iterrows():
        pts_in_this_poly = ()
        for j, pt in pts.iterrows():
            if poly.geometry.contains(pt.geometry):
                pts_in_this_poly.append(pt.geometry)
                pts = pts.drop((j))
        nums = len(pts_in_this_poly)
        pts_in_polys.append(nums)
    geo_grid('number of points') = gpd.GeoSeries(pts_in_polys) #Adds number of points in each polygon

    # Adds Quantiles column
    classifier = mc.Quantiles.make(k=levels)
    geo_grid("class") = geo_grid(("number of points")).apply(classifier)


    # Adds Polygon grid points to new geodataframe
    geo_grid("x") = geo_grid.apply(getPolyCoords, geom="geometry", coord_type="x", axis=1)
    geo_grid("y") = geo_grid.apply(getPolyCoords, geom="geometry", coord_type="y", axis=1)
    polygons = geo_grid.drop("geometry", axis=1).copy()

    return polygons

button – Welcome message from Facebook Messenger bot: 100 Parameter_type is required

Following the documentation, I'm trying to set up a welcome message for a Facebook Messenger bot using the code provided in the documentation – with my own page ID and page access token:

enter the image description here

But it returns me:

{
    "error": {
        "message": "(#100) Requires one of the params: get_started,persistent_menu,target_audience,whitelisted_domains,greeting,account_linking_url,payment_settings,home_url,ice_breakers",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "AcX40py3Er1_YoPYdL5G901"
    }
}

entities – "EntityMetadataWrapperException: Invalid data value given. Make sure it matches the data type and format required for the date field"

I am working on creating an event calendar and therefore I created a custom module to save events in custom content type. I installed the Entity and Date modules, and created a date field (partner_event_date) that accepts values ​​from and to date.

In my custom module, I am using the following code.

$wrapper->field_partner_event_date->set(array(
  'value' => date('Y-m-d H:i:s',$dateFrom),
  'value2' => date('Y-m-d H:i:s', $dateTo),
));

The following output is displayed at the top of the screen.

array(
  'value' => '2022-02-05 00:00:00',
  'value2' => '2024-07-03 00:00:00',
)

The error I get is the following.

EntityMetadataWrapperException: Invalid data value given. Make sure it matches the required data type and format. Value in node () -> field_partner_event_date :. in EntityMetadataWrapper-> set () (line 122 of /sites/all/modules/entity/includes/entity.wrapper.inc).

I installed my module in a new Drupal installation. It works fine, while on the client site (which is already built), when I installed and configured it, I see that error message. Can anyone help with this?

entities – EntityMetadataWrapperException: invalid data value given. Make sure it matches the required data type and format for the date field in Drupal 7

I am working on creating an event calendar and therefore I created a custom module to save events in custom content type. I have already installed the entity module and the date module.
I have created a date field & # 39; partner_event_date & # 39; that accepts values ​​from and to date.

In my custom module, I am adjusting the values ​​of the date field as shown below:

$ wrapper-> field_partner_event_date-> set (array (
& # 39; value & # 39; => date (& # 39; Y-m-d H: i: s & # 39 ;, $ dateFrom),
& # 39; value2 & # 39; => date (& # 39; Y-m-d H: i: s & # 39 ;, $ dateTo),
));

And an output is displayed at the top of the screen:
array (& # 39; value & # 39; => & # 39; 2022-02-05 00: 00: 00 & # 39 ;, & # 39; value2 & # 39; => & # 39; 2024-07-03 00 : 00: 00 & # 39 ;,)

The error I get is:
EntityMetadataWrapperException: Invalid data value given. Make sure it matches the required data type and format. Value in node () -> field_partner_event_date :. in EntityMetadataWrapper-> set () (line 122 of /sites/all/modules/entity/includes/entity.wrapper.inc).

I installed my module in a new drupal installation, there it is working absolutely fine, but on the client site (which is already built) when I installed and configured it, then these errors are popping up. Can anyone help with this.

Transactional Email Service Suggestion Required for WHMCS

Hi there,

We are looking for the best SMTP transactional email services for our WHMCS facility. Kindly Hint What Transactional Em … | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1803288&goto=newpost

Is a Japan transit visa required for a 19 hour stopover in Haneda?

According to Michael Hampton's response, he can transit the Haneda air zone for up to 72 hours without a visa.

Also, the current Covid-19 entry restrictions only affect entry, not transit.

As such, if your trip is on a single reservation, that's fine.

From TIMATIC:

Visa is required, except for Passengers transiting Tokyo (HND) or Osaka (KIX) with a confirmed ticket for a flight to a third country within 72 hours. They must remain in the international transit area of ​​the airport and have the documents required for the next destination.

Y

Passengers who have been to Andorra, Austria, Belgium,
Denmark, Estonia, France, Germany, Iceland, Iran, Ireland
(Rep.), Italy, Liechtenstein, Luxembourg, Malta, Monaco,
Netherlands, Norway, Portugal, San Marino, Slovenia, Spain,
Sweden, Switzerland or Vatican City (Holy See) in the past
14 days are not allowed for get in Japan.

(They haven't added to the US yet.)

agnostic system: is it possible to emulate all the dice rolls required for a D&D5e game using only one d6, and if so how?

This is a question I have asked myself several times, but I have never obtained a really satisfactory result.

The problem is this: Suppose we only have one or more d6 dice (possibly the most common type of dice outside of the pen and paper), but we still want to play D&D 5e or another RPG. The game doesn't really matter here, we just have to be able to emulate different types of dice, like d4, d8, d10, d12 or d20. I suppose that if it is possible to calculate these dice from the rolls of a d6, any other potentially necessary dice rolls can also be calculated in a similar way.

So: How can you emulate the probability results of a d4, d6, d8, d10, d12, and d20 rolling only with a d6?

Is www required in front of a domain name, in Google Analytics?

I have a website (let's call it example.com) Can be accessed as example.com and also as www.example.com. I just added example.com in Google Search Console as property (appears as example.com, without www)

Question: Should I also include the www.example.com as property?

cli – Magento 2 Missing required argument $ areaCode of Magento Framework App Area

I am using CLI to run a custom module, which generates a custom sales report.

It has been working fine, but suddenly failed with the error Missing required argument $areaCode of MagentoFrameworkAppArea for those orders that have the & # 39; closed & # 39; status.

How can I fix this error?

I am using Magento2.2.7

Failed opening required & # 39; ./ sites / all / modules / ctools / includes / utility.inc & # 39; Drupal 6

Failed opening required './sites/all/modules/ctools/includes/utility.inc' 

enter the image description here

But I find that the utility.inc file already exists in /sites/all/modules/ctools/includes/utility.inc

This error always appears when the field is automatically populated.