Rain measuring radar NC file area rainfall statistical method and system
By constructing a mapping index table between the center point of the radar grid and the geographic area, the problem of low statistical efficiency of traditional rain measurement radar data is solved, realizing efficient and automated regional rainfall calculation, improving calculation efficiency and supporting the integration of automated business systems.
Patent Information
- Application Number
- CN202511522529.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2026-01-30
AI Technical Summary
Traditional methods for statistical analysis of rain-measuring radar data are computationally inefficient, lack preprocessing mechanisms, have insufficient automation, and fail to utilize the structural characteristics of radar data grids, resulting in resource waste and huge computational overhead.
By constructing a mapping index table between geographic regions and radar grid center points, and utilizing row numbers, column numbers, and unique region identifiers, efficient regional rainfall statistics can be achieved, including reading rain-measuring radar NC files, constructing geographic regions, mapping data points, and calculating average rainfall.
It has achieved efficient and automated regional rainfall statistics, improved computing efficiency by dozens of times, reduced resource waste, and supported the integration of automated business systems.
Smart Images

Figure CN121432437A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of rainfall statistics, and in particular to a method and system for calculating regional rainfall from a rain measurement radar NC file. BACKGROUND
[0002] In the field of meteorology and hydrology, regional rainfall is an important indicator for assessing water resources, predicting flood disasters, and guiding agricultural production. Traditional regional rainfall statistics mainly rely on ground rain gauge observation data, which has problems such as sparse sites and poor spatial representativeness. In recent years, rain measurement radars have become an important means of obtaining areal rainfall due to their high temporal and spatial resolution and wide coverage. Rain measurement radar data is usually stored in the NetCDF (Network Common Data Form, NC for short) format, which contains multidimensional arrays (such as time, latitude, and longitude), coordinate information, and metadata, and has a clear structure that is convenient for scientific calculations.
[0003] In the traditional scheme, although there have been attempts to combine radar data with GIS for spatial analysis, there are generally the following problems: (1) low computational efficiency: when calculating the average rainfall of a certain administrative area or watershed, it is usually necessary to determine in real time whether each radar grid center point falls within the target area, which involves a large number of repeated spatial inclusion judgments (Point-in-Polygon), especially under large-scale, high-resolution data, the computational overhead is huge. (2) Lack of preprocessing mechanism: no persistent mapping relationship between radar grid and geographic area is established, and the coordinate and spatial relationship needs to be analyzed repeatedly every time, causing waste of resources. (3) Insufficient automation: most methods rely on manual intervention or scripting, and are difficult to integrate into an automated business system. (4) Not using the structural characteristics of the regular grid of radar data, the row and column numbers have natural indexing properties.
[0004] Therefore, there is an urgent need for an efficient and automated method to quickly aggregate radar data and calculate the average rainfall of a geographic area. SUMMARY
[0005] The present application aims to solve at least one of the technical problems in the background art, and provides a method and system for calculating regional rainfall from a rain measurement radar NC file.
[0006] To achieve the above-mentioned purpose, the present application provides a method for calculating regional rainfall from a rain measurement radar NC file, comprising: reading the NC file generated by the rain measurement radar, and extracting the geographic coordinates of each data point in the rainfall data in the NC file; constructing a geographic area, mapping the geographic coordinates of each data point in the NC file to the geographic area, and determining the geographic area to which each data point belongs; Based on the mapping relationship between each data point and the geographic area, the rainfall data of the NC file is read, and the rainfall of the geographic area is calculated based on the mapping relationship and the rainfall data, and the calculation results are output.
[0007] According to one aspect of the present invention, the step of reading the NC file generated by the rain-measuring radar and extracting the geographic coordinates of each data point in the rainfall data therein includes: Read the NC file generated by the rain-measuring radar, parse the rainfall data matrix in it, and then extract the geographic coordinates corresponding to each data point in the rainfall data matrix; Record the row and column number of each data point in the two-dimensional matrix to form the coordinate pairs of each data point.
[0008] According to one aspect of the present invention, the construction of a geographic region includes: Pre-define one or more geographic regions and store them in vector format; Set a unique identifier for each geographic region.
[0009] According to one aspect of the present invention, mapping the geographic coordinates of each data point in the NC file to a geographic region includes: Construct an index table, whose fields include: row number, column number, and unique geographic area identifier; The index table records the geographic area to which the center point of each radar grid belongs.
[0010] According to one aspect of the present invention, the step of reading rainfall data from NC files based on the mapping relationship between each data point and a geographic area, and calculating the geographic area rainfall based on the mapping relationship and the rainfall data, includes: For each geographic region with a unique identifier, filter out all corresponding radar grid center points; Calculate the sum of rainfall data for all points within each geographic region; Count the number of valid data points within each geographic region; Calculate the arithmetic mean rainfall for each geographic area = total rainfall data / number of valid data points.
[0011] According to one aspect of the present invention, the output calculation result is: Output the average rainfall results for each geographic area, and generate statistical reports, time series plots, or visualization renderings on maps.
[0012] To achieve the above objectives, the present invention also provides a rainfall statistics system for a rainfall measurement radar NC file area, comprising: The coordinate extraction module reads the NC file generated by the rain-measuring radar and extracts the geographic coordinates of each data point in the rainfall data. The geographic region determination module constructs geographic regions, maps the geographic coordinates of each data point in the NC file to the geographic region, and determines the geographic region to which each data point belongs. The regional rainfall calculation module reads rainfall data from NC files based on the mapping relationship between each data point and the geographic area, calculates the rainfall of the geographic area based on the mapping relationship and the rainfall data, and outputs the calculation results.
[0013] To achieve the above objectives, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the rainfall statistics method for NC file regions of rain-measuring radar as described above.
[0014] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the rainfall statistics method for a rain-measuring radar NC file area as described above.
[0015] According to the present invention, the present invention utilizes the NetCDF (NC) format file of the rain measurement radar to construct a mapping index between grid points and geographic areas, thereby achieving efficient regional rainfall statistics, which is applicable to meteorological monitoring, hydrological forecasting, disaster early warning and other application scenarios. Attached Figure Description
[0016] Figure 1 A flowchart illustrating a rainfall measurement radar NC file area statistical method according to an embodiment of the present invention is shown in the schematic diagram. Figure 2 The diagram illustrates a geographic region construction map according to Embodiment 1 of the present invention. Detailed Implementation
[0017] The invention will now be discussed with reference to exemplary embodiments. It should be understood that the described embodiments are merely intended to enable those skilled in the art to better understand and thus implement the invention, and are not intended to imply any limitation on the scope of the invention.
[0018] As used herein, the term "comprising" and its variations are to be interpreted as open-ended terms meaning "including but not limited to". The term "based on" is to be interpreted as "at least partially based on". The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment".
[0019] Figure 1 This diagram schematically illustrates a method for statistically analyzing rainfall in a region using a rain-measuring radar NC file, according to an embodiment of the present invention. Figure 1As shown, in this embodiment, the method for calculating rainfall in a rain-measuring radar NC file area includes: Read the NC file generated by the rain-measuring radar and extract the geographic coordinates of each data point in the rainfall data. Construct geographic regions by mapping the geographic coordinates of each data point in the NC file to the geographic regions, and determine the geographic region to which each data point belongs. Based on the mapping relationship between each data point and the geographic area, the rainfall data of the NC file is read, and the rainfall of the geographic area is calculated based on the mapping relationship and the rainfall data, and the calculation results are output.
[0020] Furthermore, according to one embodiment of the present invention, reading the NC file generated by the rain-measuring radar and extracting the geographic coordinates of each data point in the rainfall data includes: Read the NC file generated by the rain-measuring radar, parse the rainfall data matrix in it, and then extract the geographic coordinates corresponding to each data point in the rainfall data matrix; Record the row and column number of each data point in the two-dimensional matrix to form the coordinate pairs of each data point.
[0021] Furthermore, according to one embodiment of the present invention, constructing a geographic region includes: Pre-define one or more geographic regions and store them in vector format; Set a unique identifier for each geographic region.
[0022] Furthermore, according to one embodiment of the present invention, mapping the geographic coordinates of each data point in the NC file to a geographic region includes: Construct an index table, whose fields include: row number, column number, and unique geographic area identifier; The index table records the geographic area to which the center point (representing a data point) of each radar grid belongs.
[0023] Furthermore, according to one embodiment of the present invention, based on the mapping relationship between each data point and a geographic area, rainfall data from the NC file is read respectively, and the rainfall amount of the geographic area is calculated based on the mapping relationship and the rainfall data, including: For each geographic region with a unique identifier, filter out all corresponding radar grid center points; Calculate the sum of rainfall data at the center points of all radar grids within each geographic region; Count the number of valid data points within each geographic region (using methods such as value range and discrete points); Calculate the arithmetic mean rainfall for each geographic area = total rainfall data / number of valid data points.
[0024] Furthermore, according to one embodiment of the present invention, the output calculation result is: Output the average rainfall results for each geographic area, and generate statistical reports, time series plots, or visualization renderings on maps.
[0025] According to the above-described scheme of the present invention, the present invention utilizes the NetCDF (NC) format file of the rain measurement radar to construct a mapping index between grid points and geographic areas, thereby achieving efficient regional rainfall statistics, which is applicable to application scenarios such as meteorological monitoring, hydrological forecasting, and disaster early warning.
[0026] Furthermore, to achieve the above objectives, the present invention also provides a rainfall statistics system for a rainfall measurement radar NC file area, comprising: The coordinate extraction module reads the NC file generated by the rain-measuring radar and extracts the geographic coordinates of each data point in the rainfall data. The geographic region determination module constructs geographic regions, maps the geographic coordinates of each data point in the NC file to the geographic region, and determines the geographic region to which each data point belongs. The regional rainfall calculation module reads rainfall data from NC files based on the mapping relationship between each data point and the geographic area, calculates the rainfall of the geographic area based on the mapping relationship and the rainfall data, and outputs the calculation results.
[0027] Furthermore, according to one embodiment of the present invention, reading the NC file generated by the rain-measuring radar and extracting the geographic coordinates of each data point in the rainfall data includes: Read the NC file generated by the rain-measuring radar, parse the rainfall data matrix in it, and then extract the geographic coordinates corresponding to each data point in the rainfall data matrix; Record the row and column number of each data point in the two-dimensional matrix to form the coordinate pairs of each data point.
[0028] Furthermore, according to one embodiment of the present invention, constructing a geographic region includes: Pre-define one or more geographic regions and store them in vector format; Set a unique identifier for each geographic region.
[0029] Furthermore, according to one embodiment of the present invention, mapping the geographic coordinates of each data point in the NC file to a geographic region includes: Construct an index table, whose fields include: row number, column number, and unique geographic area identifier; The index table records the geographic area to which the center point of each radar grid belongs.
[0030] Furthermore, according to one embodiment of the present invention, based on the mapping relationship between each data point and a geographic area, rainfall data from the NC file is read respectively, and the rainfall amount of the geographic area is calculated based on the mapping relationship and the rainfall data, including: For each geographic region with a unique identifier, filter out all corresponding radar grid center points; Calculate the sum of rainfall data for all points within each geographic region; Count the number of valid data points within each geographic region; Calculate the arithmetic mean rainfall for each geographic area = total rainfall data / number of valid data points.
[0031] Furthermore, according to one embodiment of the present invention, the output calculation result is: Output the average rainfall results for each geographic area, and generate statistical reports, time series plots, or visualization renderings on maps.
[0032] According to the above-described scheme of the present invention, the present invention utilizes the NetCDF (NC) format file of the rain measurement radar to construct a mapping index between grid points and geographic areas, thereby achieving efficient regional rainfall statistics, which is applicable to application scenarios such as meteorological monitoring, hydrological forecasting, and disaster early warning.
[0033] Furthermore, to achieve the above objectives, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the rainfall statistics method for the NC file area of the rain-measuring radar as described above.
[0034] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the rainfall statistics method for a rain-measuring radar NC file area as described above.
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely one preferred embodiment of the invention and are only used to explain the invention. They do not limit the scope of protection of the invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0036] Example 1 This embodiment proposes a regional rainfall statistics method based on rain-measuring radar NC files. Its core lies in: establishing a "row number-column number-area ID" index table through preprocessing to achieve rapid mapping between radar data points and geographic areas, thereby efficiently completing the aggregation and average calculation of regional rainfall. Specifically, it includes the following steps: Step 1: NC file parsing and coordinate extraction; Read the NC file generated by the rain-measuring radar, parse the rainfall data matrix (such as the precipitation variable), and extract the geographic coordinates (longitude and latitude) corresponding to each data point. At the same time, record the row number (i) and column number (j) of each data point in the two-dimensional matrix to form an (i, j) coordinate pair.
[0037] Step 2: Define the geographic region; like Figure 2 As shown, multiple geographic regions (such as administrative divisions, watershed boundaries, custom grids, etc.) are defined. Each colored block represents a geographic region and is stored in a vector format (such as Shapefile, GeoJSON). Each geographic region has a unique identifier (i.e., region ID). The region ID attribute can be of any type, but it is recommended to use an integer type for easy storage and retrieval.
[0038] Step 3: Coordinate mapping and index table construction; Map the geographic coordinates of each data point in the NC file to the aforementioned geographic region and determine the region to which it belongs.
[0039] In this embodiment, an index table is constructed, whose fields include: row number (i), column number (j), and area ID (id). This index table records the geographical region to which each radar grid center point (uniquely determined by i and j) belongs.
[0040] Table 1 Example index table structure: In this embodiment, the process of constructing the "row number-column number-region ID" index table includes: Parse the latitude and longitude data in the NC file; Obtain the row and column numbers of different latitudes and longitudes in the grid (the two-dimensional grid formed by the radar image); By performing spatial overlay operations, only the center points of the radar grid in the area that needs to be calculated are retained; The retained radar grid center points are added to the grid point layer generated by QGIS via a CSV file. The ID (i.e., area ID) of the spatial region described by each radar grid center point is associated with the spatial location attribute. Generate a CSV file, including row numbers, column numbers, and region IDs.
[0041] Step 4: Regional rainfall statistics; Based on the constructed index table, the rainfall data from the NC file is read hierarchically and converted into an array, and the following statistical operations are performed: (1) For each area ID, filter out all corresponding radar grid center points; (2) Calculate the sum of rainfall data (Sum) for all points within the region; (3) Count the number of valid data points within the region; (4) Calculate the arithmetic mean rainfall of the area = total rainfall data (Sum) / number of valid data points (Count).
[0042] Step 5: Output the results; The output shows the average rainfall for each region, which can be further used to generate statistical reports, time series plots, or for visualization rendering on a map.
[0043] Calculations show that reading and processing a 240*440 NC file containing 73 time periods takes approximately 300ms, while generating a TIFF file and then spatially calculating areal rainfall takes more than 10 seconds, resulting in a tenfold improvement in efficiency. Furthermore, this solution eliminates the need for storing and managing intermediate format files, facilitating interface development.
[0044] According to the scheme of this embodiment, this embodiment utilizes the self-describing characteristics of NC files to parse its dimensional structure (such as lat, lon, time) and data variables (such as pre_h1); clearly establishes the physical location of each value (data point) in the data matrix, that is, uniquely determines a radar grid center point through row number (i) and column number (j); extracts the geographical coordinates (longitude, latitude) of the point, and forms a mapping relationship of (i, j)→(lon, lat).
[0045] This embodiment spatially matches the geographic coordinates (lon, lat) of the center point of the radar grid with preset geographic regions (such as administrative regions, watersheds); this embodiment uses a point-in-polygon algorithm to determine the geographic region to which each (i, j) point belongs; it supports multiple region types (vector polygons, custom grids, administrative regions, watersheds, etc.).
[0046] This embodiment constructs a "row number-column number-area ID" index table. A structured index table is constructed, with fields including row number (i), column number (j), and area ID (id). This table records the relationship between the center point of each radar grid and the geographic region. The index table is a persistent and reusable data structure, avoiding redundant spatial calculations.
[0047] An efficient regional statistical mechanism based on an index table. The index table is used for grouping and aggregation (Group By) operations. For each region ID, all (i, j) points corresponding to it are extracted, and the areal rainfall of that region is calculated.
[0048] In this embodiment, the index table is a preprocessing product. It can be built once and reused multiple times for NC files at different times. It supports automatic calling in business systems to realize full-process automation of "NC file input → automatic statistics → result output". It can be integrated into meteorological service platforms and hydrological early warning systems.
[0049] Those skilled in the art will recognize that the modules and algorithm steps described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0050] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and equipment can be referred to the corresponding process in the foregoing method implementation, and will not be repeated here.
[0051] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0052] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the objectives of the embodiments of the present invention, depending on actual needs.
[0053] In addition, the functional modules in the embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0054] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the sending / receiving methods of various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0055] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in this application.
[0056] It should be understood that the sequence number of each step in the invention and its embodiments does not absolutely imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
Claims
1. A method for statistical area precipitation from a weather radar NC file, characterized in that, The method comprises the following steps: reading an NC file generated by a rain measuring radar, and extracting geographical coordinates of each data point in rainfall data in the NC file; constructing a geographical area, and mapping the geographical coordinates of each data point in the NC file to the geographical area, and judging the geographical area to which each data point belongs; based on the mapping relationship between each data point and the geographical area, reading rainfall data of the NC file respectively, and calculating rainfall of the geographical area based on the mapping relationship and the rainfall data, and outputting the calculation result.
2. The rain radar NC file area rainfall amount statistical method according to claim 1, characterized by, The reading of the NC file generated by the rain measuring radar and the extraction of the geographical coordinates of each data point in the rainfall data in the NC file comprises the following steps: reading the NC file generated by the rain measuring radar, parsing the rainfall data matrix in the NC file, and then extracting the geographical coordinates corresponding to each data point in the rainfall data matrix; recording the row number and column number of each data point in the two-dimensional matrix to form a coordinate pair of each data point.
3. The rain radar NC file area rainfall amount statistical method according to claim 1, characterized by, The construction of the geographical area comprises the following steps: presetting one or more geographical areas, and storing the geographical areas in a vector format; setting a unique identifier for each geographical area.
4. The method for statistical analysis of regional rainfall in a rain-measuring radar NC file according to claim 1, characterized in that, The mapping of the geographical coordinates of each data point in the NC file to the geographical area comprises the following steps: constructing an index table, and the fields in the index table comprise a row number, a column number and a unique identifier of a geographical area; the index table records the geographical area to which each radar grid center point belongs.
5. The method of claim 4, wherein the NC file area rainfall statistics of the weather radar are calculated by using the following equation: ###0001### where, R is the NC file area rainfall statistics, R is the radar reflectivity, and A is the area of the NC file. The reading of the rainfall data of the NC file based on the mapping relationship between each data point and the geographical area, and the calculation of the rainfall of the geographical area based on the mapping relationship and the rainfall data comprise the following steps: screening all corresponding radar grid center points for each geographical area with a unique identifier; calculating the total rainfall data of all radar grid center points in each geographical area; counting the number of valid data points in each geographical area; calculating the arithmetic mean rainfall of each geographical area = total rainfall data / number of valid data points.
6. The method for statistical analysis of regional rainfall in a rain-measuring radar NC file according to claim 5, characterized in that, The output of the calculation result is: outputting the average rainfall result of each geographical area, generating a statistical report, a time series graph or visual rendering on a map.
7. A rain radar NC file area rainfall statistics system, characterized by, The method comprises the following steps: a coordinate extraction module reads an NC file generated by a rain measuring radar, and extracts geographical coordinates of each data point in rainfall data in the NC file; a geographical area judgment module constructs a geographical area, and maps the geographical coordinates of each data point in the NC file to the geographical area, and judges the geographical area to which each data point belongs; a regional rainfall calculation module reads rainfall data of the NC file based on the mapping relationship between each data point and the geographical area, and calculates rainfall of the geographical area based on the mapping relationship and the rainfall data, and outputs the calculation result.
8. An electronic device, characterized by The computer program stored on the computer readable storage medium is executed by the processor to realize the rain measuring radar NC file regional rainfall statistical method according to any one of claims 1-6.
9. A computer readable storage medium, characterized in that, The computer program stored on the computer readable storage medium is executed by the processor to realize the rain measuring radar NC file regional rainfall statistical method according to any one of claims 1-6.