├── LICENSE
├── MEIC 污染源清单向WRF-Chem 模式网格插值分配工具操作手册.pdf
├── README.md
├── int_dis.py
├── meic2wrf_GUI.py
├── meic2wrf_noGUI.py
├── namelist.input
└── wrfinput_d01
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/MEIC 污染源清单向WRF-Chem 模式网格插值分配工具操作手册.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jinfan0931/meic2wrf/edeaa7f75667bc22bdc0694e32cbcbb6d6972c2f/MEIC 污染源清单向WRF-Chem 模式网格插值分配工具操作手册.pdf
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # meic2wrf
2 | Interpolating & distributing MEIC 0.25*0.25 emission inventory onto WRF-Chem grids
3 | Origin: https://github.com/jinfan0931/meic2wrf
4 |
5 | # Additional function:
6 | * A no-GUI script for command line user
7 | * Add `ll_area_new` for more accurent meic grid area(using [geojson-area](https://github.com/scisco/area)) and `meic2wrf_interp` for linear interpolation instead of nearest interpolation, especially for wrf with a high spatial resolution
8 | * Example namelist and corresponding wrfinput file
9 |
10 |
11 | # update 20210324
12 | * Delete repeated codes in GUI version
13 | * Add support for new meic data(as meic file names have changed recently)
--------------------------------------------------------------------------------
/int_dis.py:
--------------------------------------------------------------------------------
1 | ############################################### meic2wrf ########################################################
2 | # Authors: Fan Jin; Zhou Yong-long; Zhang Lei; Xu Xuan-ye; Jiang Pei-ya; Li Zhuo #
3 | # Institution: Chengdu AeriDice Environment Technology Co., Ltd.; Chengdu University of Information & Technology; #
4 | # Chinese Academy of Meteorological Sciences #
5 | # E-mail: jin.fan@outlook.com #
6 | # Environment: Python 3.7.7; pynio 1.5.5 #
7 | ###################################################################################################################
8 | # June 8, 2020, added ll_area_new(more accurent meic grid area), meic2wrf_interp(linear interpolation instead of
9 | # nearest) (by Hao Lyu)
10 |
11 | ######################################
12 | # 1. area of lat_lon grids #
13 | ######################################
14 | import numpy as np
15 |
16 | def ll_area(lat,res): #input : lat : np.array((200, 320))
17 | Re=6371.392
18 | X=Re*np.cos(lat*(np.pi/180))*(np.pi/180)*res #np.array((200, 320))
19 | Y=Re*(np.pi/180)*res #float
20 | return X*Y
21 |
22 | def ll_area_new(lat,res):
23 | from area import area
24 | startlon=0
25 | return_area = np.zeros_like(lat)
26 | isize,jsize = return_area.shape
27 | for i in range(isize):
28 | for j in range(jsize):
29 | obj = {'type':'Polygon','coordinates':[[[startlon,lat[i,j]-0.125],[startlon,lat[i,j]+0.125],[startlon+0.25,lat[i,j]+0.125],[startlon+0.25,lat[i,j]-0.125]]]}
30 | return_area[i,j] = area(obj)/1000.0/1000.0
31 | return return_area
32 | ###################################
33 | # 2. 2D interpolation func. #
34 | # ----dx----|--cdx--- #
35 | # --------1---------- #
36 | ###################################
37 |
38 | def meic2wrf(lon_inp,lat_inp,lon,lat,emis,):#lon/lat_inp: model; lon/lat: meic; emis: meic emis
39 |
40 | #coordinations of meic grids origin
41 | ox=lat[0,0]
42 | oy=lon[0,0]
43 |
44 | def inp(ix, iy, dx, dy, cdx, cdy): #put small function under meic2wrf function, or variables in small functions are global.
45 | #area_ratio
46 | return emis[ix,iy]*cdx*cdy+emis[ix,iy+1]*cdx*dy+emis[ix+1,iy+1]*dx*dy+emis[ix+1,iy]*dx*cdy
47 |
48 | def std_p(p,o): #standardize point p
49 | p = (p-o)*4
50 | dp = p - int(p)
51 | cdp = 1 - dp
52 | ip = int(p) #get index of the nearest big grid relates to the p point
53 | return dp, cdp, ip
54 |
55 | def inp_p(px, py):
56 | dx, cdx, ix = std_p(px,ox)
57 | dy, cdy, iy = std_p(py,oy)
58 | return inp(ix, iy, dx, dy, cdx, cdy)
59 |
60 | emis_inp=np.zeros(lon_inp.shape, dtype='float32')
61 | y_cnt =0
62 | for (row_lat, row_lon) in zip(lat_inp, lon_inp): #2D meic coordinates to 1D
63 | x_cnt=0
64 | for (pnt_lat, pnt_lon) in zip(row_lat, row_lon): #1D to point
65 | emis_inp[y_cnt,x_cnt] = inp_p(pnt_lat, pnt_lon) #assign meic emission
66 | x_cnt += 1
67 | y_cnt +=1
68 | return emis_inp
69 |
70 | def meic2wrf_interp(lon_inp,lat_inp,lon,lat,emis,interp_method = 'bilinear'):#lon/lat_inp: model; lon/lat: meic; emis: meic emis
71 | import xesmf as xe
72 | grid_out = {'lon': lon_inp,'lat': lat_inp}
73 | grid_in = {'lon': lon,'lat': lat}
74 | regridder = xe.Regridder(grid_in, grid_out, interp_method,reuse_weights=True)
75 | emis_inp = regridder(emis)
76 | return emis_inp
77 | ###########################################
78 | # 3. vertical & time distribution func. #
79 | ###########################################
80 |
81 | def sec2zt(sec,zfac,tfac):
82 | c=[sec*i*j for i in tfac for j in zfac]
83 | d=[np.array(c[i:i+len(zfac)]) for i in np.arange(0,len(c),len(zfac))]
84 | return np.array(d)
85 |
86 | ###################################
--------------------------------------------------------------------------------
/meic2wrf_GUI.py:
--------------------------------------------------------------------------------
1 | ############################################### meic2wrf ########################################################
2 | # Authors: Fan Jin; Zhou Yong-long; Zhang Lei; Xu Xuan-ye; Jiang Pei-ya; Li Zhuo #
3 | # Institution: Chengdu AeriDice Environment Technology Co., Ltd.; Chengdu University of Information & Technology; #
4 | # Chinese Academy of Meteorological Sciences #
5 | # E-mail: jin.fan@outlook.com #
6 | # Environment: Python 3.7.7; pynio 1.5.5 #
7 | ###################################################################################################################
8 |
9 | import fnmatch
10 | import glob
11 | import os
12 | import shutil
13 | import tkinter as tk
14 | from tkinter import filedialog, messagebox
15 |
16 | import Nio
17 | import numpy as np
18 |
19 | from int_dis import *
20 |
21 | root=tk.Tk()
22 | root.title('MEIC污染源清单向WRF-Chem模式网格插值分配程序')
23 |
24 | lbl=tk.Label(root, text='1. 整合MEIC清单中各污染物不同部门的排放数据')
25 | lbl.grid(row=0,column=0,sticky=tk.W)
26 |
27 | lbl=tk.Label(root, text='MEIC清单数据所在文件夹路径:')
28 | lbl.grid(row=1,column=0,sticky=tk.E)
29 |
30 | ent_dir = tk.Entry(root, width=65)
31 | ent_dir.grid(row=1,column=1)
32 |
33 | def bws_meic():
34 | dirname = filedialog.askdirectory()
35 | ent_dir.delete(0,tk.END)
36 | ent_dir.insert(0, dirname)
37 |
38 | def merge_meic_dept():
39 | if os.path.exists(ent_dir.get()+'/merged/'):
40 | shutil.rmtree(ent_dir.get()+'/merged/')
41 | os.makedirs(ent_dir.get()+'/merged/')
42 | print("++++++ent_dir++++++",ent_dir.get())
43 | for i,j in zip(['*BC*','*CO[!2]*','*CO2*','*NH3*','*NOx*','*[!V]OC*','*PM2.5*','*PMcoarse*','*ALD*',\
44 | '*CSL*','*ETH*','*GLY*','*HC3*','*HC5*','*HC8*','*HCHO*',\
45 | '*ISO*','*KET*','*MACR*','*MGLY*','*MVK*','*NR*','*NVOL*',\
46 | '*OL2*','*OLI*','*OLT*','*ORA1*','*ORA2*','*TOL*','*XYL*','*SO2*','*VOC*',], ['BC','CO','CO2','NH3','NOx','OC','PM2.5','PMcoarse','ALD',\
47 | 'CSL','ETH','GLY','HC3','HC5','HC8','HCHO',\
48 | 'ISO','KET','MACR','MGLY','MVK','NR','NVOL',\
49 | 'OL2','OLI','OLT','ORA1','ORA2','TOL','XYL','SO2','VOC',]):
50 |
51 | # new:2016_1_agriculture_BC.nc
52 | # old:2016_01__agriculture__BC.nc
53 |
54 | try:
55 | fn_act = glob.glob(ent_dir.get()+'/*_agr*_' +j+".nc" )[0]
56 | fn_idt = glob.glob(ent_dir.get()+'/*_ind*_' +j+".nc" )[0]
57 | fn_pwr = glob.glob(ent_dir.get()+'/*_pow*_' +j+".nc" )[0]
58 | fn_rdt = glob.glob(ent_dir.get()+'/*_res*_' +j+".nc" )[0]
59 | fn_tpt = glob.glob(ent_dir.get()+'/*_tra*_' +j+".nc" )[0]
60 | except:
61 | fn_act = glob.glob(ent_dir.get()+"/*_agr*_PM25.nc" )[0] # 新旧文件一个是pm2.5一个是pm25
62 | fn_idt = glob.glob(ent_dir.get()+"/*_ind*_PM25.nc" )[0]
63 | fn_pwr = glob.glob(ent_dir.get()+"/*_pow*_PM25.nc" )[0]
64 | fn_rdt = glob.glob(ent_dir.get()+"/*_res*_PM25.nc" )[0]
65 | fn_tpt = glob.glob(ent_dir.get()+"/*_tra*_PM25.nc" )[0]
66 |
67 |
68 | f_act=Nio.open_file(fn_act)
69 | f_idt=Nio.open_file(fn_idt)
70 | f_pwr=Nio.open_file(fn_pwr)
71 | f_rdt=Nio.open_file(fn_rdt)
72 | f_tpt=Nio.open_file(fn_tpt)
73 |
74 | act=f_act.variables['z'][:].reshape((200, 320),)[::-1]
75 | act=np.where(act>0.0,act*1,0.0)
76 | idt=f_idt.variables['z'][:].reshape((200, 320),)[::-1]
77 | idt=np.where(idt>0.0,idt*1,0.0)
78 | pwr=f_pwr.variables['z'][:].reshape((200, 320),)[::-1]
79 | pwr=np.where(pwr>0.0,pwr*1,0.0)
80 | rdt=f_rdt.variables['z'][:].reshape((200, 320),)[::-1]
81 | rdt=np.where(rdt>0.0,rdt*1,0.0)
82 | tpt=f_tpt.variables['z'][:].reshape((200, 320),)[::-1]
83 | tpt=np.where(tpt>0.0,tpt*1,0.0)
84 |
85 | lon=np.arange(70.125,150,0.25,dtype=np.float32)
86 | lat=np.arange(10.125,60,0.25,dtype=np.float32)
87 | lon,lat=np.meshgrid(lon,lat)
88 |
89 | f=Nio.open_file(ent_dir.get()+'/merged/'+j+'.nc','c')
90 | f.create_dimension('lon',320)
91 | f.create_dimension('lat',200)
92 |
93 | for var,val in zip(['act','idt','pwr','rdt','tpt','lon','lat'],[act,idt,pwr,rdt,tpt,lon,lat]):
94 | f.create_variable(var,'f',('lat','lon',))
95 | f.variables[var][:] = val
96 |
97 | f.close()
98 |
99 |
100 | b_btn = tk.Button(root, text='浏览', command=bws_meic, width=15)
101 | b_btn.grid(row=1,column=2)
102 |
103 | r_btn = tk.Button(root, text='运行', command=merge_meic_dept, width=15)
104 | r_btn.grid(row=1,column=3)
105 |
106 |
107 | lbl=tk.Label(root, text='2. 向WRF-Chem模式网格插值分配')
108 | lbl.grid(row=2,column=0,sticky=tk.W)
109 |
110 | lbl=tk.Label(root, text='wrfinput文件路径:')
111 | lbl.grid(row=3,column=0,sticky=tk.E)
112 |
113 | ent_inp = tk.Entry(root, width=65)
114 | ent_inp.grid(row=3,column=1)
115 |
116 | def bws_wrfipt():
117 | wrfiptname = filedialog.askopenfilename()
118 | ent_inp.delete(0,tk.END)
119 | ent_inp.insert(0, wrfiptname)
120 |
121 | b_btn = tk.Button(root, text='浏览', command=bws_wrfipt, width=15)
122 | b_btn.grid(row=3,column=2)#padx=10,pady=10
123 |
124 | agr_z_d=[1.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000]
125 | ind_z_d=[0.602,0.346,0.052,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000]
126 | pow_z_d=[0.034,0.140,0.349,0.227,0.167,0.059,0.024,0.000,0.000,0.000,0.000]
127 | res_z_d=[0.900,0.100,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000]
128 | tra_z_d=[0.950,0.050,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000]
129 |
130 | sec_z_d=[agr_z_d,ind_z_d,pow_z_d,res_z_d,tra_z_d,]
131 |
132 | agr_t_d=[1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000,
133 | 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000]
134 | ind_t_d=[1.080, 1.632, 1.632, 1.632, 1.632, 1.632, 1.632, 1.632, 1.632, 1.080, 0.936, 0.792, 0.648, 0.504,
135 | 0.504, 0.504, 0.504, 0.504, 0.504, 0.504, 0.504, 0.648, 0.792, 0.936]
136 | pow_t_d=[1.104, 1.200, 1.212, 1.200, 1.224, 1.236, 1.236, 1.224, 1.176, 1.104, 1.116, 1.128, 1.080, 1.008,
137 | 0.948, 0.720, 0.840, 0.708, 0.576, 0.600, 0.732, 0.804, 0.852, 0.972]
138 | res_t_d=[1.224, 1.584, 2.736, 2.520, 0.984, 0.696, 0.552, 0.984, 1.680, 2.328, 1.488, 0.840, 0.264, 0.360,
139 | 0.336, 0.240, 0.336, 0.312, 0.408, 0.216, 0.408, 1.080, 1.176, 1.248]
140 | tra_t_d=[1.536, 1.440, 1.392, 1.272, 1.212, 1.368, 1.380, 1.416, 1.428, 1.524, 1.380, 1.128, 1.068, 1.008,
141 | 0.864, 0.648, 0.480, 0.348, 0.252, 0.216, 0.192, 0.312, 0.720, 1.416]
142 |
143 | sec_t_d=[agr_t_d,ind_t_d,pow_t_d,res_t_d,tra_t_d,]
144 |
145 | state=tk.StringVar()
146 | state.set('disable')
147 |
148 | def disable():
149 | ent_agr_z.config(state=state.get())
150 | ent_ind_z.config(state=state.get())
151 | ent_pow_z.config(state=state.get())
152 | ent_res_z.config(state=state.get())
153 | ent_tra_z.config(state=state.get())
154 | ent_agr_t.config(state=state.get())
155 | ent_ind_t.config(state=state.get())
156 | ent_pow_t.config(state=state.get())
157 | ent_res_t.config(state=state.get())
158 | ent_tra_t.config(state=state.get())
159 |
160 | def activate():
161 | ent_agr_z.config(state=state.get())
162 | ent_ind_z.config(state=state.get())
163 | ent_pow_z.config(state=state.get())
164 | ent_res_z.config(state=state.get())
165 | ent_tra_z.config(state=state.get())
166 | ent_agr_t.config(state=state.get())
167 | ent_ind_t.config(state=state.get())
168 | ent_pow_t.config(state=state.get())
169 | ent_res_t.config(state=state.get())
170 | ent_tra_t.config(state=state.get())
171 |
172 | rdb_default = tk.Radiobutton(root, text='使用默认分配因子', variable=state, value='disable', command=disable)
173 | rdb_default.grid(row=4,column=1,sticky=tk.W)
174 | rdb_custom = tk.Radiobutton(root, text='自定义分配因子', variable=state, value='normal', command=activate)
175 | rdb_custom.grid(row=4,column=1,sticky=tk.E)
176 |
177 | lbl=tk.Label(root, text='农业垂直排放因子:')
178 | lbl.grid(row=5,column=0,sticky=tk.E)
179 |
180 | ent_agr_z=tk.Entry(root, state='disable',width=65)
181 | ent_agr_z.grid(row=5,column=1,)
182 |
183 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
184 | lbl.grid(row=5,column=2)
185 |
186 | lbl=tk.Label(root, text='工业垂直排放因子:')
187 | lbl.grid(row=6,column=0,sticky=tk.E)
188 |
189 | ent_ind_z=tk.Entry(root, state='disable',width=65)
190 | ent_ind_z.grid(row=6,column=1,)
191 |
192 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
193 | lbl.grid(row=6,column=2)
194 |
195 | lbl=tk.Label(root, text='电力垂直排放因子:')
196 | lbl.grid(row=7,column=0,sticky=tk.E)
197 |
198 | ent_pow_z=tk.Entry(root, state='disable',width=65)
199 | ent_pow_z.grid(row=7,column=1,)
200 |
201 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
202 | lbl.grid(row=7,column=2)
203 |
204 | lbl=tk.Label(root, text='民用垂直排放因子:')
205 | lbl.grid(row=8,column=0,sticky=tk.E)
206 |
207 | ent_res_z=tk.Entry(root, state='disable',width=65)
208 | ent_res_z.grid(row=8,column=1,)
209 |
210 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
211 | lbl.grid(row=8,column=2)
212 |
213 | lbl=tk.Label(root, text='交通垂直排放因子:')
214 | lbl.grid(row=9,column=0,sticky=tk.E)
215 |
216 | ent_tra_z=tk.Entry(root, state='disable',width=65)
217 | ent_tra_z.grid(row=9,column=1,)
218 |
219 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
220 | lbl.grid(row=9,column=2)
221 |
222 | lbl=tk.Label(root, text='农业逐小时排放因子:')
223 | lbl.grid(row=10,column=0,sticky=tk.E)
224 |
225 | ent_agr_t=tk.Entry(root, state='disable',width=65)
226 | ent_agr_t.grid(row=10,column=1,)
227 |
228 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
229 | lbl.grid(row=10,column=2)
230 |
231 | lbl=tk.Label(root, text='工业逐小时排放因子:')
232 | lbl.grid(row=11,column=0,sticky=tk.E)
233 |
234 | ent_ind_t=tk.Entry(root, state='disable',width=65)
235 | ent_ind_t.grid(row=11,column=1,)
236 |
237 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
238 | lbl.grid(row=11,column=2)
239 |
240 | lbl=tk.Label(root, text='电力逐小时排放因子:')
241 | lbl.grid(row=12,column=0,sticky=tk.E)
242 |
243 | ent_pow_t=tk.Entry(root, state='disable',width=65)
244 | ent_pow_t.grid(row=12,column=1)
245 |
246 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
247 | lbl.grid(row=12,column=2)
248 |
249 | lbl=tk.Label(root, text='民用逐小时排放因子:')
250 | lbl.grid(row=13,column=0,sticky=tk.E)
251 |
252 | ent_res_t=tk.Entry(root, state='disable',width=65)
253 | ent_res_t.grid(row=13,column=1)
254 |
255 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
256 | lbl.grid(row=13,column=2)
257 |
258 | lbl=tk.Label(root, text='交通逐小时排放因子:')
259 | lbl.grid(row=14,column=0,sticky=tk.E)
260 |
261 | ent_tra_t=tk.Entry(root, state='disable',width=65)
262 | ent_tra_t.grid(row=14,column=1)
263 |
264 | lbl=tk.Label(root, text='输入格式: 0.34 0.56 ... ')
265 | lbl.grid(row=14,column=2)
266 |
267 | def itp_dis():
268 | if state.get() == 'normal':
269 | if fnmatch.fnmatch(ent_agr_z.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_ind_z.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_pow_z.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_res_z.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_tra_z.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_agr_t.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_ind_t.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_pow_t.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_res_t.get().replace(' ', '').replace('.',''), '*[!0-9]*') or fnmatch.fnmatch(ent_tra_t.get().replace(' ', '').replace('.',''), '*[!0-9]*'):
270 | tk.messagebox.showerror(title='error',message='input format must be 0.23 0.34 ...')
271 | elif not len(ent_agr_z.get().strip().split(' '))==len(ent_ind_z.get().strip().split(' '))==len(ent_pow_z.get().strip().split(' '))==len(ent_res_z.get().strip().split(' '))==len(ent_tra_z.get().strip().split(' ')):
272 | tk.messagebox.showerror(title='error',message='number of z factor must be equal')
273 | elif not len(ent_agr_t.get().strip().split(' '))==len(ent_ind_t.get().strip().split(' '))==len(ent_pow_t.get().strip().split(' '))==len(ent_res_t.get().strip().split(' '))==len(ent_tra_t.get().strip().split(' '))==24:
274 | tk.messagebox.showerror(title='error',message='number of t factor must be 24')
275 | else:
276 | agr_z=[float(i) for i in ent_agr_z.get().strip().split(' ')]
277 | ind_z=[float(i) for i in ent_ind_z.get().strip().split(' ')]
278 | pow_z=[float(i) for i in ent_pow_z.get().strip().split(' ')]
279 | res_z=[float(i) for i in ent_res_z.get().strip().split(' ')]
280 | tra_z=[float(i) for i in ent_tra_z.get().strip().split(' ')]
281 | sec_z=[agr_z,ind_z,pow_z,res_z,tra_z,]
282 | agr_t=[float(i) for i in ent_agr_t.get().strip().split(' ')]
283 | ind_t=[float(i) for i in ent_ind_t.get().strip().split(' ')]
284 | pow_t=[float(i) for i in ent_pow_t.get().strip().split(' ')]
285 | res_t=[float(i) for i in ent_res_t.get().strip().split(' ')]
286 | tra_t=[float(i) for i in ent_tra_t.get().strip().split(' ')]
287 | sec_t=[agr_t,ind_t,pow_t,res_t,tra_t,]
288 |
289 | f_inp=Nio.open_file(ent_inp.get(),format='nc')
290 | lon_inp=f_inp.variables['XLONG'][0,:]
291 | lat_inp=f_inp.variables['XLAT'][0,:]
292 | time_inp=f_inp.variables['Times'][:][0]
293 | time_inp=''.join([i.decode('utf-8') for i in time_inp]).split('_')[0]
294 | f_inp.close()
295 |
296 | #put all the distributed meic species into meic_spec_emis:
297 |
298 | meic_spec_emis=[]
299 | #inorganic gas: ton/(grid.month) to mole/(km2.h)
300 | for spec,M in zip(['CO','CO2','NH3','NOx','SO2',],[28,44,17,46,64]):
301 | f_post=Nio.open_file(ent_dir.get()+'/merged/'+spec+'.nc')
302 | lon=f_post.variables['lon'][:]
303 | lat=f_post.variables['lat'][:]
304 | section=[(f_post.variables[sec][:,:]*1e6)/(ll_area(lat,0.25)*30*24*M) for sec in ['act','idt','pwr','rdt','tpt',]]
305 | f_post.close()
306 | sections=[meic2wrf(lon_inp,lat_inp,lon,lat,emis,) for emis in section]
307 | c=[sec2zt(i,j,k) for i,j,k in zip(sections,sec_z,sec_t)]
308 | c=sum(c)
309 | meic_spec_emis.append(c)
310 | #organic gas: million_mole/(grid.month) to mole/(km2.h)
311 | for spec in ['ALD','CSL','ETH','GLY','HC3','HC5','HC8','HCHO','ISO','KET','MACR','MGLY','MVK','NR','NVOL',
312 | 'OL2','OLI','OLT','ORA1','ORA2','TOL','XYL',]:
313 | f_post=Nio.open_file(ent_dir.get()+'/merged/'+spec+'.nc')
314 | #lon=f_post.variables['lon'][:]
315 | #lat=f_post.variables['lat'][:]
316 | section=[(f_post.variables[sec][:,:]*1e6)/(ll_area(lat,0.25)*30*24) for sec in ['act','idt','pwr','rdt','tpt',]]
317 | f_post.close()
318 | sections=[meic2wrf(lon_inp,lat_inp,lon,lat,emis,) for emis in section]
319 | c=[sec2zt(i,j,k) for i,j,k in zip(sections,sec_z,sec_t)]
320 | c=sum(c)
321 | meic_spec_emis.append(c)
322 | #aerosol: ton/(grid.month) to ug/(m2.s)
323 | for spec in ['BC','OC','PM2.5','PMcoarse',]:
324 | f_post=Nio.open_file(ent_dir.get()+'/merged/'+spec+'.nc')
325 | #lon=f_post.variables['lon'][:]
326 | #lat=f_post.variables['lat'][:]
327 | section=[(f_post.variables[sec][:,:]*1e6)/(ll_area(lat,0.25)*30*24*3600) for sec in ['act','idt','pwr','rdt','tpt',]]
328 | f_post.close()
329 | sections=[meic2wrf(lon_inp,lat_inp,lon,lat,emis,) for emis in section]
330 | c=[sec2zt(i,j,k) for i,j,k in zip(sections,sec_z,sec_t)]
331 | c=sum(c)
332 | meic_spec_emis.append(c)
333 |
334 | #meic emission to RADM2 chemistry scheme:
335 |
336 | wrf_spec_emis=[np.zeros(meic_spec_emis[0][:].shape, dtype='float32')]*31
337 |
338 | wrf_spec_emis[0]=meic_spec_emis[0] #wrf: CO
339 | wrf_spec_emis[1]=meic_spec_emis[2] #wrf: NH3
340 | wrf_spec_emis[2]=meic_spec_emis[3]*0.9 #wrf: NO
341 | wrf_spec_emis[3]=meic_spec_emis[3]*0.1 #wrf: NO2
342 | wrf_spec_emis[4]=meic_spec_emis[4]*0.9 #wrf: SO2
343 | wrf_spec_emis[5]=meic_spec_emis[5] #wrf: ALD
344 | wrf_spec_emis[6]=meic_spec_emis[6] #wrf: CSL
345 | wrf_spec_emis[7]=meic_spec_emis[7] #wrf: ETH
346 | wrf_spec_emis[8]=meic_spec_emis[9] #wrf: HC3
347 | wrf_spec_emis[9]=meic_spec_emis[10] #wrf: HC5
348 | wrf_spec_emis[10]=meic_spec_emis[11] #wrf: HC8
349 | wrf_spec_emis[11]=meic_spec_emis[12] #wrf: HCHO
350 | wrf_spec_emis[12]=meic_spec_emis[13] #wrf: ISO
351 | wrf_spec_emis[13]=meic_spec_emis[14] #wrf: KET
352 | wrf_spec_emis[14]=meic_spec_emis[20]*1.1 #wrf: OL2
353 | wrf_spec_emis[15]=meic_spec_emis[21]*1.1 #wrf: OLI
354 | wrf_spec_emis[16]=meic_spec_emis[22]*1.1 #wrf: OLT
355 | wrf_spec_emis[17]=meic_spec_emis[24] #wrf: ORA2
356 | wrf_spec_emis[18]=meic_spec_emis[25]*1.1 #wrf: TOL
357 | wrf_spec_emis[19]=meic_spec_emis[26]*1.1 #wrf: XYL
358 | wrf_spec_emis[20]=meic_spec_emis[27]*0.2 #wrf: ECi
359 | wrf_spec_emis[21]=meic_spec_emis[27]*0.8 #wrf: ECj
360 | wrf_spec_emis[22]=meic_spec_emis[28]*0.2 #wrf: ORGi
361 | wrf_spec_emis[23]=meic_spec_emis[28]*0.8 #wrf: ORGj
362 | wrf_spec_emis[24]=meic_spec_emis[29]-meic_spec_emis[28]-meic_spec_emis[27]*0.2 #wrf: PM25i
363 | wrf_spec_emis[25]=meic_spec_emis[29]-meic_spec_emis[28]-meic_spec_emis[27]*0.8 #wrf: PM25j
364 | wrf_spec_emis[26]=meic_spec_emis[30]*0.8 #wrf: PM10
365 | wrf_spec_emis[27]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: SO4i
366 | wrf_spec_emis[28]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: SO4j
367 | wrf_spec_emis[29]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: NO3i
368 | wrf_spec_emis[30]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: NO3j
369 |
370 | #generate wrfchemi_00z_d01 anthropogenic emission data for wrf-chem model run:
371 | if os.path.exists(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1]):
372 | os.remove(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1])
373 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1],'c',format='nc')
374 |
375 | f_chem.create_dimension('Time',None)
376 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
377 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
378 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
379 | f_chem.create_dimension('DateStrLen',19)
380 |
381 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
382 | for i,time in enumerate([time_inp+'_00:00:00',time_inp+'_01:00:00',time_inp+'_02:00:00',time_inp+'_03:00:00',time_inp+'_04:00:00',
383 | time_inp+'_05:00:00',time_inp+'_06:00:00',time_inp+'_07:00:00',time_inp+'_08:00:00',time_inp+'_09:00:00',time_inp+'_10:00:00',
384 | time_inp+'_11:00:00',]):
385 | f_chem.variables['Times'][i]=list(time) #split the string to char
386 |
387 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
388 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
389 | f_chem.variables[LL][:]=ll
390 |
391 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
392 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
393 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
394 |
395 | for gas in radm_gas:
396 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
397 | f_chem.variables[gas].FieldType = np.int16(104)
398 | f_chem.variables[gas].MemoryOrder = 'XYZ'
399 | f_chem.variables[gas].description = 'EMISSIONS'
400 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
401 | f_chem.variables[gas].stagger = 'Z'
402 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
403 | for aerosol in radm_aerosol:
404 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
405 | f_chem.variables[aerosol].FieldType = np.int16(104)
406 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
407 | f_chem.variables[aerosol].description = 'EMISSIONS'
408 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
409 | f_chem.variables[aerosol].stagger = 'Z'
410 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
411 |
412 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
413 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
414 | 'E_SO4J','E_NO3I','E_NO3J',]
415 |
416 | for i,spec in enumerate(radm_spec):
417 | f_chem.variables[spec][:] = wrf_spec_emis[i][0:12,:,:,:] #dimension need to be matched with the variable defination
418 |
419 | f_chem.close()
420 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1])
421 | else:
422 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1],'c',format='nc')
423 | f_chem.create_dimension('Time',None)
424 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
425 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
426 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
427 | f_chem.create_dimension('DateStrLen',19)
428 |
429 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
430 | for i,time in enumerate([time_inp+'_00:00:00',time_inp+'_01:00:00',time_inp+'_02:00:00',time_inp+'_03:00:00',time_inp+'_04:00:00',
431 | time_inp+'_05:00:00',time_inp+'_06:00:00',time_inp+'_07:00:00',time_inp+'_08:00:00',time_inp+'_09:00:00',time_inp+'_10:00:00',
432 | time_inp+'_11:00:00',]):
433 | f_chem.variables['Times'][i]=list(time) #split the string to char
434 |
435 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
436 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
437 | f_chem.variables[LL][:]=ll
438 |
439 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
440 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
441 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
442 |
443 | for gas in radm_gas:
444 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
445 | f_chem.variables[gas].FieldType = np.int16(104)
446 | f_chem.variables[gas].MemoryOrder = 'XYZ'
447 | f_chem.variables[gas].description = 'EMISSIONS'
448 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
449 | f_chem.variables[gas].stagger = 'Z'
450 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
451 | for aerosol in radm_aerosol:
452 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
453 | f_chem.variables[aerosol].FieldType = np.int16(104)
454 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
455 | f_chem.variables[aerosol].description = 'EMISSIONS'
456 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
457 | f_chem.variables[aerosol].stagger = 'Z'
458 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
459 |
460 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
461 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
462 | 'E_SO4J','E_NO3I','E_NO3J',]
463 |
464 | for i,spec in enumerate(radm_spec):
465 | f_chem.variables[spec][:] = wrf_spec_emis[i][0:12,:,:,:] #dimension need to be matched with the variable defination
466 |
467 | f_chem.close()
468 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1])
469 |
470 | #generate wrfchemi_12z_d01 anthropogenic emission data for wrf-chem model run:
471 | if os.path.exists(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1]):
472 | os.remove(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1])
473 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1],'c',format='nc')
474 |
475 | f_chem.create_dimension('Time',None)
476 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
477 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
478 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
479 | f_chem.create_dimension('DateStrLen',19)
480 |
481 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
482 | for i,time in enumerate([time_inp+'_12:00:00',time_inp+'_13:00:00',time_inp+'_14:00:00',time_inp+'_15:00:00',time_inp+'_16:00:00',
483 | time_inp+'_17:00:00',time_inp+'_18:00:00',time_inp+'_19:00:00',time_inp+'_20:00:00',time_inp+'_21:00:00',time_inp+'_22:00:00',
484 | time_inp+'_23:00:00',]):
485 | f_chem.variables['Times'][i]=list(time)
486 |
487 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
488 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
489 | f_chem.variables[LL][:]=ll
490 |
491 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
492 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
493 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
494 |
495 | for gas in radm_gas:
496 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
497 | f_chem.variables[gas].FieldType = np.int16(104)
498 | f_chem.variables[gas].MemoryOrder = 'XYZ'
499 | f_chem.variables[gas].description = 'EMISSIONS'
500 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
501 | f_chem.variables[gas].stagger = 'Z'
502 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
503 | for aerosol in radm_aerosol:
504 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
505 | f_chem.variables[aerosol].FieldType = np.int16(104)
506 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
507 | f_chem.variables[aerosol].description = 'EMISSIONS'
508 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
509 | f_chem.variables[aerosol].stagger = 'Z'
510 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
511 |
512 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
513 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
514 | 'E_SO4J','E_NO3I','E_NO3J',]
515 |
516 | for i,spec in enumerate(radm_spec):
517 | f_chem.variables[spec][:] = wrf_spec_emis[i][12:24,:,:,:] #dimension need to be matched with the variable defination
518 |
519 | f_chem.close()
520 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1])
521 | else:
522 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1],'c',format='nc')
523 | f_chem.create_dimension('Time',None)
524 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
525 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
526 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
527 | f_chem.create_dimension('DateStrLen',19)
528 |
529 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
530 | for i,time in enumerate([time_inp+'_12:00:00',time_inp+'_13:00:00',time_inp+'_14:00:00',time_inp+'_15:00:00',time_inp+'_16:00:00',
531 | time_inp+'_17:00:00',time_inp+'_18:00:00',time_inp+'_19:00:00',time_inp+'_20:00:00',time_inp+'_21:00:00',time_inp+'_22:00:00',
532 | time_inp+'_23:00:00',]):
533 | f_chem.variables['Times'][i]=list(time)
534 |
535 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
536 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
537 | f_chem.variables[LL][:]=ll
538 |
539 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
540 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
541 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
542 |
543 | for gas in radm_gas:
544 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
545 | f_chem.variables[gas].FieldType = np.int16(104)
546 | f_chem.variables[gas].MemoryOrder = 'XYZ'
547 | f_chem.variables[gas].description = 'EMISSIONS'
548 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
549 | f_chem.variables[gas].stagger = 'Z'
550 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
551 | for aerosol in radm_aerosol:
552 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
553 | f_chem.variables[aerosol].FieldType = np.int16(104)
554 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
555 | f_chem.variables[aerosol].description = 'EMISSIONS'
556 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
557 | f_chem.variables[aerosol].stagger = 'Z'
558 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
559 |
560 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
561 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
562 | 'E_SO4J','E_NO3I','E_NO3J',]
563 |
564 | for i,spec in enumerate(radm_spec):
565 | f_chem.variables[spec][:] = wrf_spec_emis[i][12:24,:,:,:] #dimension need to be matched with the variable defination
566 |
567 | f_chem.close()
568 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1])
569 |
570 | elif state.get() =='disable':
571 | f_inp=Nio.open_file(ent_inp.get(),format='nc')
572 | lon_inp=f_inp.variables['XLONG'][0,:]
573 | lat_inp=f_inp.variables['XLAT'][0,:]
574 | time_inp=f_inp.variables['Times'][:][0]
575 | time_inp=''.join([i.decode('utf-8') for i in time_inp]).split('_')[0]
576 | f_inp.close()
577 |
578 | #put all the distributed meic species into meic_spec_emis:
579 | meic_spec_emis=[]
580 | #inorganic gas: ton/(grid.month) to mole/(km2.h)
581 | for spec,M in zip(['CO','CO2','NH3','NOx','SO2',],[28,44,17,46,64]):
582 | f_post=Nio.open_file(ent_dir.get()+'/merged/'+spec+'.nc')
583 | lon=f_post.variables['lon'][:]
584 | lat=f_post.variables['lat'][:]
585 | section=[(f_post.variables[sec][:,:]*1e6)/(ll_area(lat,0.25)*30*24*M) for sec in ['act','idt','pwr','rdt','tpt',]]
586 | f_post.close()
587 | sections=[meic2wrf(lon_inp,lat_inp,lon,lat,emis,) for emis in section]
588 | c=[sec2zt(i,j,k) for i,j,k in zip(sections,sec_z_d,sec_t_d)]
589 | c=sum(c)
590 | meic_spec_emis.append(c)
591 | #organic gas: million_mole/(grid.month) to mole/(km2.h)
592 | for spec in ['ALD','CSL','ETH','GLY','HC3','HC5','HC8','HCHO','ISO','KET','MACR','MGLY','MVK','NR','NVOL',
593 | 'OL2','OLI','OLT','ORA1','ORA2','TOL','XYL',]:
594 | f_post=Nio.open_file(ent_dir.get()+'/merged/'+spec+'.nc')
595 | #lon=f_post.variables['lon'][:]
596 | #lat=f_post.variables['lat'][:]
597 | section=[(f_post.variables[sec][:,:]*1e6)/(ll_area(lat,0.25)*30*24) for sec in ['act','idt','pwr','rdt','tpt',]]
598 | f_post.close()
599 | sections=[meic2wrf(lon_inp,lat_inp,lon,lat,emis,) for emis in section]
600 | c=[sec2zt(i,j,k) for i,j,k in zip(sections,sec_z_d,sec_t_d)]
601 | c=sum(c)
602 | meic_spec_emis.append(c)
603 | #aerosol: ton/(grid.month) to ug/(m2.s)
604 | for spec in ['BC','OC','PM2.5','PMcoarse',]:
605 | f_post=Nio.open_file(ent_dir.get()+'/merged/'+spec+'.nc')
606 | #lon=f_post.variables['lon'][:]
607 | #lat=f_post.variables['lat'][:]
608 | section=[(f_post.variables[sec][:,:]*1e6)/(ll_area(lat,0.25)*30*24*3600) for sec in ['act','idt','pwr','rdt','tpt',]]
609 | f_post.close()
610 | sections=[meic2wrf(lon_inp,lat_inp,lon,lat,emis,) for emis in section]
611 | c=[sec2zt(i,j,k) for i,j,k in zip(sections,sec_z_d,sec_t_d)]
612 | c=sum(c)
613 | meic_spec_emis.append(c)
614 |
615 | #meic emission to RADM2 chemistry scheme:
616 |
617 | wrf_spec_emis=[np.zeros(meic_spec_emis[0][:].shape, dtype='float32')]*31
618 |
619 | wrf_spec_emis[0]=meic_spec_emis[0] #wrf: CO
620 | wrf_spec_emis[1]=meic_spec_emis[2] #wrf: NH3
621 | wrf_spec_emis[2]=meic_spec_emis[3]*0.9 #wrf: NO
622 | wrf_spec_emis[3]=meic_spec_emis[3]*0.1 #wrf: NO2
623 | wrf_spec_emis[4]=meic_spec_emis[4]*0.9 #wrf: SO2
624 | wrf_spec_emis[5]=meic_spec_emis[5] #wrf: ALD
625 | wrf_spec_emis[6]=meic_spec_emis[6] #wrf: CSL
626 | wrf_spec_emis[7]=meic_spec_emis[7] #wrf: ETH
627 | wrf_spec_emis[8]=meic_spec_emis[9] #wrf: HC3
628 | wrf_spec_emis[9]=meic_spec_emis[10] #wrf: HC5
629 | wrf_spec_emis[10]=meic_spec_emis[11] #wrf: HC8
630 | wrf_spec_emis[11]=meic_spec_emis[12] #wrf: HCHO
631 | wrf_spec_emis[12]=meic_spec_emis[13] #wrf: ISO
632 | wrf_spec_emis[13]=meic_spec_emis[14] #wrf: KET
633 | wrf_spec_emis[14]=meic_spec_emis[20]*1.1 #wrf: OL2
634 | wrf_spec_emis[15]=meic_spec_emis[21]*1.1 #wrf: OLI
635 | wrf_spec_emis[16]=meic_spec_emis[22]*1.1 #wrf: OLT
636 | wrf_spec_emis[17]=meic_spec_emis[24] #wrf: ORA2
637 | wrf_spec_emis[18]=meic_spec_emis[25]*1.1 #wrf: TOL
638 | wrf_spec_emis[19]=meic_spec_emis[26]*1.1 #wrf: XYL
639 | wrf_spec_emis[20]=meic_spec_emis[27]*0.2 #wrf: ECi
640 | wrf_spec_emis[21]=meic_spec_emis[27]*0.8 #wrf: ECj
641 | wrf_spec_emis[22]=meic_spec_emis[28]*0.2 #wrf: ORGi
642 | wrf_spec_emis[23]=meic_spec_emis[28]*0.8 #wrf: ORGj
643 | wrf_spec_emis[24]=meic_spec_emis[29]-meic_spec_emis[28]-meic_spec_emis[27]*0.2 #wrf: PM25i
644 | wrf_spec_emis[25]=meic_spec_emis[29]-meic_spec_emis[28]-meic_spec_emis[27]*0.8 #wrf: PM25j
645 | wrf_spec_emis[26]=meic_spec_emis[30]*0.8 #wrf: PM10
646 | wrf_spec_emis[27]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: SO4i
647 | wrf_spec_emis[28]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: SO4j
648 | wrf_spec_emis[29]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: NO3i
649 | wrf_spec_emis[30]=np.zeros(meic_spec_emis[0][:].shape, dtype='float32') #wrf: NO3j
650 |
651 | #generate wrfchemi_00z_d01 anthropogenic emission data for wrf-chem model run:
652 | if os.path.exists(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1]):
653 | os.remove(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1])
654 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1],'c',format='nc')
655 |
656 | f_chem.create_dimension('Time',None)
657 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
658 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
659 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
660 | f_chem.create_dimension('DateStrLen',19)
661 |
662 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
663 | for i,time in enumerate([time_inp+'_00:00:00',time_inp+'_01:00:00',time_inp+'_02:00:00',time_inp+'_03:00:00',time_inp+'_04:00:00',
664 | time_inp+'_05:00:00',time_inp+'_06:00:00',time_inp+'_07:00:00',time_inp+'_08:00:00',time_inp+'_09:00:00',time_inp+'_10:00:00',
665 | time_inp+'_11:00:00',]):
666 | f_chem.variables['Times'][i]=list(time) #split the string to char
667 |
668 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
669 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
670 | f_chem.variables[LL][:]=ll
671 |
672 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
673 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
674 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
675 |
676 | for gas in radm_gas:
677 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
678 | f_chem.variables[gas].FieldType = np.int16(104)
679 | f_chem.variables[gas].MemoryOrder = 'XYZ'
680 | f_chem.variables[gas].description = 'EMISSIONS'
681 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
682 | f_chem.variables[gas].stagger = 'Z'
683 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
684 | for aerosol in radm_aerosol:
685 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
686 | f_chem.variables[aerosol].FieldType = np.int16(104)
687 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
688 | f_chem.variables[aerosol].description = 'EMISSIONS'
689 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
690 | f_chem.variables[aerosol].stagger = 'Z'
691 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
692 |
693 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
694 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
695 | 'E_SO4J','E_NO3I','E_NO3J',]
696 |
697 | for i,spec in enumerate(radm_spec):
698 | f_chem.variables[spec][:] = wrf_spec_emis[i][0:12,:,:,:] #dimension need to be matched with the variable defination
699 |
700 | f_chem.close()
701 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1])
702 | else:
703 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1],'c',format='nc')
704 | f_chem.create_dimension('Time',None)
705 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
706 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
707 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
708 | f_chem.create_dimension('DateStrLen',19)
709 |
710 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
711 | for i,time in enumerate([time_inp+'_00:00:00',time_inp+'_01:00:00',time_inp+'_02:00:00',time_inp+'_03:00:00',time_inp+'_04:00:00',
712 | time_inp+'_05:00:00',time_inp+'_06:00:00',time_inp+'_07:00:00',time_inp+'_08:00:00',time_inp+'_09:00:00',time_inp+'_10:00:00',
713 | time_inp+'_11:00:00',]):
714 | f_chem.variables['Times'][i]=list(time) #split the string to char
715 |
716 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
717 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
718 | f_chem.variables[LL][:]=ll
719 |
720 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
721 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
722 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
723 |
724 | for gas in radm_gas:
725 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
726 | f_chem.variables[gas].FieldType = np.int16(104)
727 | f_chem.variables[gas].MemoryOrder = 'XYZ'
728 | f_chem.variables[gas].description = 'EMISSIONS'
729 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
730 | f_chem.variables[gas].stagger = 'Z'
731 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
732 | for aerosol in radm_aerosol:
733 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
734 | f_chem.variables[aerosol].FieldType = np.int16(104)
735 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
736 | f_chem.variables[aerosol].description = 'EMISSIONS'
737 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
738 | f_chem.variables[aerosol].stagger = 'Z'
739 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
740 |
741 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
742 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
743 | 'E_SO4J','E_NO3I','E_NO3J',]
744 |
745 | for i,spec in enumerate(radm_spec):
746 | f_chem.variables[spec][:] = wrf_spec_emis[i][0:12,:,:,:] #dimension need to be matched with the variable defination
747 |
748 | f_chem.close()
749 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_00z_'+ent_inp.get().split('_')[-1])
750 |
751 | #generate wrfchemi_12z_d01 anthropogenic emission data for wrf-chem model run:
752 | if os.path.exists(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1]):
753 | os.remove(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1])
754 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1],'c',format='nc')
755 | f_chem.create_dimension('Time',None)
756 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
757 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
758 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
759 | f_chem.create_dimension('DateStrLen',19)
760 |
761 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
762 | for i,time in enumerate([time_inp+'_12:00:00',time_inp+'_13:00:00',time_inp+'_14:00:00',time_inp+'_15:00:00',time_inp+'_16:00:00',
763 | time_inp+'_17:00:00',time_inp+'_18:00:00',time_inp+'_19:00:00',time_inp+'_20:00:00',time_inp+'_21:00:00',time_inp+'_22:00:00',
764 | time_inp+'_23:00:00',]):
765 | f_chem.variables['Times'][i]=list(time)
766 |
767 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
768 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
769 | f_chem.variables[LL][:]=ll
770 |
771 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
772 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
773 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
774 |
775 | for gas in radm_gas:
776 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
777 | f_chem.variables[gas].FieldType = np.int16(104)
778 | f_chem.variables[gas].MemoryOrder = 'XYZ'
779 | f_chem.variables[gas].description = 'EMISSIONS'
780 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
781 | f_chem.variables[gas].stagger = 'Z'
782 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
783 | for aerosol in radm_aerosol:
784 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
785 | f_chem.variables[aerosol].FieldType = np.int16(104)
786 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
787 | f_chem.variables[aerosol].description = 'EMISSIONS'
788 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
789 | f_chem.variables[aerosol].stagger = 'Z'
790 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
791 |
792 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
793 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
794 | 'E_SO4J','E_NO3I','E_NO3J',]
795 |
796 | for i,spec in enumerate(radm_spec):
797 | f_chem.variables[spec][:] = wrf_spec_emis[i][12:24,:,:,:] #dimension need to be matched with the variable defination
798 |
799 | f_chem.close()
800 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1])
801 | else:
802 | f_chem=Nio.open_file(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1],'c',format='nc')
803 |
804 | f_chem.create_dimension('Time',None)
805 | f_chem.create_dimension('emissions_zdim',wrf_spec_emis[0].shape[1])
806 | f_chem.create_dimension('south_north',wrf_spec_emis[0].shape[2])
807 | f_chem.create_dimension('west_east',wrf_spec_emis[0].shape[3])
808 | f_chem.create_dimension('DateStrLen',19)
809 |
810 | f_chem.create_variable('Times','S1',('Time','DateStrLen'),)
811 | for i,time in enumerate([time_inp+'_12:00:00',time_inp+'_13:00:00',time_inp+'_14:00:00',time_inp+'_15:00:00',time_inp+'_16:00:00',
812 | time_inp+'_17:00:00',time_inp+'_18:00:00',time_inp+'_19:00:00',time_inp+'_20:00:00',time_inp+'_21:00:00',time_inp+'_22:00:00',
813 | time_inp+'_23:00:00',]):
814 | f_chem.variables['Times'][i]=list(time)
815 |
816 | for ll, LL in zip([lon_inp, lat_inp],['XLONG', 'XLAT']):
817 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
818 | f_chem.variables[LL][:]=ll
819 |
820 | radm_gas=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
821 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL',]
822 | radm_aerosol=['E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I','E_SO4J','E_NO3I','E_NO3J',]
823 |
824 | for gas in radm_gas:
825 | f_chem.create_variable(gas,'f',('Time','emissions_zdim','south_north','west_east',))
826 | f_chem.variables[gas].FieldType = np.int16(104)
827 | f_chem.variables[gas].MemoryOrder = 'XYZ'
828 | f_chem.variables[gas].description = 'EMISSIONS'
829 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
830 | f_chem.variables[gas].stagger = 'Z'
831 | #f_chem.variables[gas].ordinates = 'XLONG XLAT'
832 | for aerosol in radm_aerosol:
833 | f_chem.create_variable(aerosol,'f',('Time','emissions_zdim','south_north','west_east',))
834 | f_chem.variables[aerosol].FieldType = np.int16(104)
835 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
836 | f_chem.variables[aerosol].description = 'EMISSIONS'
837 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
838 | f_chem.variables[aerosol].stagger = 'Z'
839 | #f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
840 |
841 | radm_spec=['E_CO','E_NH3','E_NO','E_NO2','E_SO2','E_ALD','E_CSL','E_ETH','E_HC3','E_HC5','E_HC8','E_HCHO','E_ISO','E_KET',
842 | 'E_OL2','E_OLI','E_OLT','E_ORA2','E_TOL','E_XYL','E_ECI','E_ECJ','E_ORGI','E_ORGJ','E_PM25I','E_PM25J','E_PM_10','E_SO4I',
843 | 'E_SO4J','E_NO3I','E_NO3J',]
844 |
845 | for i,spec in enumerate(radm_spec):
846 | f_chem.variables[spec][:] = wrf_spec_emis[i][12:24,:,:,:] #dimension need to be matched with the variable defination
847 |
848 | f_chem.close()
849 | os.rename(ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1]+'.nc', ent_dir.get()+'/merged/'+'wrfchemi_12z_'+ent_inp.get().split('_')[-1])
850 |
851 | btn = tk.Button(root, text='运行', command=itp_dis, width=15)
852 | btn.grid(row=15, column=3)
853 |
854 | tk.mainloop()
855 |
--------------------------------------------------------------------------------
/meic2wrf_noGUI.py:
--------------------------------------------------------------------------------
1 | ############################################### meic2wrf ########################################################
2 | # Authors: Fan Jin; Zhou Yong-long; Zhang Lei; Xu Xuan-ye; Jiang Pei-ya; Li Zhuo #
3 | # Institution: Chengdu AeriDice Environment Technology Co., Ltd.; Chengdu University of Information & Technology; #
4 | # Chinese Academy of Meteorological Sciences #
5 | # E-mail: jin.fan@outlook.com #
6 | # Environment: Python 3.7.7; pynio 1.5.5 #
7 | ###################################################################################################################
8 | # June 8, 2020, added noGUI script (by Hao Lyu)
9 | # Environment added: area(https://github.com/scisco/area)
10 |
11 | import fnmatch
12 | import glob
13 | import os
14 | import shutil
15 |
16 | import Nio
17 | import numpy as np
18 |
19 | from int_dis import *
20 |
21 | meic2wrf = meic2wrf#_interp #用线性插值替代最邻近插值
22 | ll_area = ll_area #更高精度计算每块meic网格面积
23 | # 排放源高度分布
24 | agr_z_d = [1.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
25 | ind_z_d = [0.602, 0.346, 0.052, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
26 | pow_z_d = [0.034, 0.140, 0.349, 0.227, 0.167, 0.059, 0.024, 0.000, 0.000, 0.000, 0.000]
27 | res_z_d = [0.900, 0.100, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
28 | tra_z_d = [0.950, 0.050, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
29 | sec_z_d = [agr_z_d, ind_z_d, pow_z_d, res_z_d, tra_z_d, ]
30 | # 排放源时间分布
31 | agr_t_d=[1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000,
32 | 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000]
33 | ind_t_d=[1.080, 1.632, 1.632, 1.632, 1.632, 1.632, 1.632, 1.632, 1.632, 1.080, 0.936, 0.792, 0.648, 0.504,
34 | 0.504, 0.504, 0.504, 0.504, 0.504, 0.504, 0.504, 0.648, 0.792, 0.936]
35 | pow_t_d=[1.104, 1.200, 1.212, 1.200, 1.224, 1.236, 1.236, 1.224, 1.176, 1.104, 1.116, 1.128, 1.080, 1.008,
36 | 0.948, 0.720, 0.840, 0.708, 0.576, 0.600, 0.732, 0.804, 0.852, 0.972]
37 | res_t_d=[1.224, 1.584, 2.736, 2.520, 0.984, 0.696, 0.552, 0.984, 1.680, 2.328, 1.488, 0.840, 0.264, 0.360,
38 | 0.336, 0.240, 0.336, 0.312, 0.408, 0.216, 0.408, 1.080, 1.176, 1.248]
39 | tra_t_d=[1.536, 1.440, 1.392, 1.272, 1.212, 1.368, 1.380, 1.416, 1.428, 1.524, 1.380, 1.128, 1.068, 1.008,
40 | 0.864, 0.648, 0.480, 0.348, 0.252, 0.216, 0.192, 0.312, 0.720, 1.416]
41 | sec_t_d = [agr_t_d, ind_t_d, pow_t_d, res_t_d, tra_t_d, ]
42 |
43 | def merge_meic_dept(ent_dir): # 生成merge文件夹,预处理排放源文件
44 | if os.path.exists(ent_dir+'/merged/'):
45 | shutil.rmtree(ent_dir+'/merged/')
46 | os.makedirs(ent_dir+'/merged/')
47 | for i, j in zip(['*BC*', '*CO[!2]*', '*CO2*', '*NH3*', '*NOx*', '*[!V]OC*', '*PM2.5*', '*PMcoarse*', '*ALD*',
48 | '*CSL*', '*ETH*', '*GLY*', '*HC3*', '*HC5*', '*HC8*', '*HCHO*',
49 | '*ISO*', '*KET*', '*MACR*', '*MGLY*', '*MVK*', '*NR*', '*NVOL*',
50 | '*OL2*', '*OLI*', '*OLT*', '*ORA1*', '*ORA2*', '*TOL*', '*XYL*', '*SO2*', '*VOC*', ],
51 | ['BC', 'CO', 'CO2', 'NH3', 'NOx', 'OC', 'PM2.5', 'PMcoarse', 'ALD',
52 | 'CSL', 'ETH', 'GLY', 'HC3', 'HC5', 'HC8', 'HCHO',
53 | 'ISO', 'KET', 'MACR', 'MGLY', 'MVK', 'NR','NVOL',
54 | 'OL2', 'OLI', 'OLT', 'ORA1', 'ORA2', 'TOL', 'XYL', 'SO2', 'VOC', ]):
55 | # new:2016_1_agriculture_BC.nc
56 | # old:2016_01__agriculture__BC.nc
57 | try:
58 | fn_act = glob.glob(ent_dir+'/*_agr*_' +j+".nc" )[0]
59 | fn_idt = glob.glob(ent_dir+'/*_ind*_' +j+".nc" )[0]
60 | fn_pwr = glob.glob(ent_dir+'/*_pow*_' +j+".nc" )[0]
61 | fn_rdt = glob.glob(ent_dir+'/*_res*_' +j+".nc" )[0]
62 | fn_tpt = glob.glob(ent_dir+'/*_tra*_' +j+".nc" )[0]
63 | except:
64 | fn_act = glob.glob(ent_dir+"/*_agr*_PM25.nc" )[0] # 新旧文件一个是pm2.5一个是pm25
65 | fn_idt = glob.glob(ent_dir+"/*_ind*_PM25.nc" )[0]
66 | fn_pwr = glob.glob(ent_dir+"/*_pow*_PM25.nc" )[0]
67 | fn_rdt = glob.glob(ent_dir+"/*_res*_PM25.nc" )[0]
68 | fn_tpt = glob.glob(ent_dir+"/*_tra*_PM25.nc" )[0]
69 |
70 | f_act = Nio.open_file(fn_act)
71 | f_idt = Nio.open_file(fn_idt)
72 | f_pwr = Nio.open_file(fn_pwr)
73 | f_rdt = Nio.open_file(fn_rdt)
74 | f_tpt = Nio.open_file(fn_tpt)
75 |
76 | act = f_act.variables['z'][:].reshape((200, 320),)[::-1]
77 | act = np.where(act > 0.0, act*1, 0.0)
78 | idt = f_idt.variables['z'][:].reshape((200, 320),)[::-1]
79 | idt = np.where(idt > 0.0, idt*1, 0.0)
80 | pwr = f_pwr.variables['z'][:].reshape((200, 320),)[::-1]
81 | pwr = np.where(pwr > 0.0, pwr*1, 0.0)
82 | rdt = f_rdt.variables['z'][:].reshape((200, 320),)[::-1]
83 | rdt = np.where(rdt > 0.0, rdt*1, 0.0)
84 | tpt = f_tpt.variables['z'][:].reshape((200, 320),)[::-1]
85 | tpt = np.where(tpt > 0.0, tpt*1, 0.0)
86 |
87 | lon = np.arange(70.125, 150, 0.25, dtype=np.float32)
88 | lat = np.arange(10.125, 60, 0.25, dtype=np.float32)
89 | lon, lat = np.meshgrid(lon, lat)
90 |
91 | f = Nio.open_file(ent_dir+'/merged/'+j+'.nc', 'c')
92 | f.create_dimension('lon', 320)
93 | f.create_dimension('lat', 200)
94 | for var, val in zip(['act', 'idt', 'pwr', 'rdt', 'tpt', 'lon', 'lat'], [act, idt, pwr, rdt, tpt, lon, lat]):
95 | f.create_variable(var, 'f', ('lat', 'lon',))
96 | f.variables[var][:] = val
97 | f.close()
98 |
99 | def itp_dis(ent_inp,ent_dir,save_dir):
100 | f_inp = Nio.open_file(ent_inp, format='nc')
101 | lon_inp = f_inp.variables['XLONG'][0, :]
102 | lat_inp = f_inp.variables['XLAT'][0, :]
103 | time_inp = f_inp.variables['Times'][:][0]
104 | time_inp = ''.join([i.decode('utf-8') for i in time_inp]).split('_')[0]
105 | f_inp.close()
106 | # put all the distributed meic species into meic_spec_emis:
107 | meic_spec_emis = []
108 | # inorganic gas: ton/(grid.month) to mole/(km2.h)
109 | for spec, M in zip(['CO', 'CO2', 'NH3', 'NOx', 'SO2', ], [28, 44, 17, 46, 64]):
110 | f_post = Nio.open_file(ent_dir+'/merged/'+spec+'.nc')
111 | lon = f_post.variables['lon'][:]
112 | lat = f_post.variables['lat'][:]
113 | section = [(f_post.variables[sec][:, :]*1e6)/(ll_area(lat, 0.25)*30*24*M)
114 | for sec in ['act', 'idt', 'pwr', 'rdt', 'tpt', ]]
115 | f_post.close()
116 | sections = [meic2wrf(lon_inp, lat_inp, lon, lat, emis,)
117 | for emis in section]
118 | c = [sec2zt(i, j, k) for i, j, k in zip(sections, sec_z_d, sec_t_d)]
119 | c = sum(c)
120 | meic_spec_emis.append(c)
121 | # organic gas: million_mole/(grid.month) to mole/(km2.h)
122 | for spec in ['ALD', 'CSL', 'ETH', 'GLY', 'HC3', 'HC5', 'HC8', 'HCHO', 'ISO', 'KET', 'MACR', 'MGLY', 'MVK', 'NR', 'NVOL',
123 | 'OL2', 'OLI', 'OLT', 'ORA1', 'ORA2', 'TOL', 'XYL', ]:
124 | f_post = Nio.open_file(ent_dir+'/merged/'+spec+'.nc')
125 | section = [(f_post.variables[sec][:, :]*1e6)/(ll_area(lat, 0.25)*30*24)
126 | for sec in ['act', 'idt', 'pwr', 'rdt', 'tpt', ]]
127 | f_post.close()
128 | sections = [meic2wrf(lon_inp, lat_inp, lon, lat, emis,)
129 | for emis in section]
130 | c = [sec2zt(i, j, k) for i, j, k in zip(sections, sec_z_d, sec_t_d)]
131 | c = sum(c)
132 | meic_spec_emis.append(c)
133 | # aerosol: ton/(grid.month) to ug/(m2.s)
134 | for spec in ['BC', 'OC', 'PM2.5', 'PMcoarse', ]:
135 | f_post = Nio.open_file(ent_dir+'/merged/'+spec+'.nc')
136 | # lon=f_post.variables['lon'][:]
137 | # lat=f_post.variables['lat'][:]
138 | section = [(f_post.variables[sec][:, :]*1e6)/(ll_area(lat, 0.25)*30*24*3600)
139 | for sec in ['act', 'idt', 'pwr', 'rdt', 'tpt', ]]
140 | f_post.close()
141 | sections = [meic2wrf(lon_inp, lat_inp, lon, lat, emis,)
142 | for emis in section]
143 | c = [sec2zt(i, j, k) for i, j, k in zip(sections, sec_z_d, sec_t_d)]
144 | c = sum(c)
145 | meic_spec_emis.append(c)
146 |
147 | # meic emission to RADM2 chemistry scheme:
148 |
149 | wrf_spec_emis = [
150 | np.zeros(meic_spec_emis[0][:].shape, dtype='float32')]*31
151 |
152 | wrf_spec_emis[0] = meic_spec_emis[0] # wrf: CO
153 | wrf_spec_emis[1] = meic_spec_emis[2] # wrf: NH3
154 | wrf_spec_emis[2] = meic_spec_emis[3]*0.9 # wrf: NO
155 | wrf_spec_emis[3] = meic_spec_emis[3]*0.1 # wrf: NO2
156 | wrf_spec_emis[4] = meic_spec_emis[4]*0.9 # wrf: SO2
157 | wrf_spec_emis[5] = meic_spec_emis[5] # wrf: ALD
158 | wrf_spec_emis[6] = meic_spec_emis[6] # wrf: CSL
159 | wrf_spec_emis[7] = meic_spec_emis[7] # wrf: ETH
160 | wrf_spec_emis[8] = meic_spec_emis[9] # wrf: HC3
161 | wrf_spec_emis[9] = meic_spec_emis[10] # wrf: HC5
162 | wrf_spec_emis[10] = meic_spec_emis[11] # wrf: HC8
163 | wrf_spec_emis[11] = meic_spec_emis[12] # wrf: HCHO
164 | wrf_spec_emis[12] = meic_spec_emis[13] # wrf: ISO
165 | wrf_spec_emis[13] = meic_spec_emis[14] # wrf: KET
166 | wrf_spec_emis[14] = meic_spec_emis[20]*1.1 # wrf: OL2
167 | wrf_spec_emis[15] = meic_spec_emis[21]*1.1 # wrf: OLI
168 | wrf_spec_emis[16] = meic_spec_emis[22]*1.1 # wrf: OLT
169 | wrf_spec_emis[17] = meic_spec_emis[24] # wrf: ORA2
170 | wrf_spec_emis[18] = meic_spec_emis[25]*1.1 # wrf: TOL
171 | wrf_spec_emis[19] = meic_spec_emis[26]*1.1 # wrf: XYL
172 | wrf_spec_emis[20] = meic_spec_emis[27]*0.2 # wrf: ECi
173 | wrf_spec_emis[21] = meic_spec_emis[27]*0.8 # wrf: ECj
174 | wrf_spec_emis[22] = meic_spec_emis[28]*0.2 # wrf: ORGi
175 | wrf_spec_emis[23] = meic_spec_emis[28]*0.8 # wrf: ORGj
176 | wrf_spec_emis[24] = meic_spec_emis[29] - \
177 | meic_spec_emis[28]-meic_spec_emis[27]*0.2 # wrf: PM25i
178 | wrf_spec_emis[25] = meic_spec_emis[29] - \
179 | meic_spec_emis[28]-meic_spec_emis[27]*0.8 # wrf: PM25j
180 | wrf_spec_emis[26] = meic_spec_emis[30]*0.8 # wrf: PM10
181 | wrf_spec_emis[27] = np.zeros(
182 | meic_spec_emis[0][:].shape, dtype='float32') # wrf: SO4i
183 | wrf_spec_emis[28] = np.zeros(
184 | meic_spec_emis[0][:].shape, dtype='float32') # wrf: SO4j
185 | wrf_spec_emis[29] = np.zeros(
186 | meic_spec_emis[0][:].shape, dtype='float32') # wrf: NO3i
187 | wrf_spec_emis[30] = np.zeros(
188 | meic_spec_emis[0][:].shape, dtype='float32') # wrf: NO3j
189 |
190 | #生成00和12两个时次
191 | for ihour in [0,12]:
192 | # generate wrfchemi_00z_d01 anthropogenic emission data for wrf-chem model run:
193 | if os.path.exists(ent_dir+'/merged/'+'wrfchemi_'+str(ihour).zfill(2)+'z_'+ent_inp.split('_')[-1]):
194 | os.remove(ent_dir+'/merged/'+'wrfchemi_'+str(ihour).zfill(2)+'z_' + ent_inp.split('_')[-1])
195 | f_chem = Nio.open_file(ent_dir+'/merged/'+'wrfchemi_'+str(ihour).zfill(2)+'z_'+ent_inp.split('_')[-1], 'c', format='nc')
196 | f_chem.create_dimension('Time', None)
197 | f_chem.create_dimension('emissions_zdim', wrf_spec_emis[0].shape[1])
198 | f_chem.create_dimension('south_north', wrf_spec_emis[0].shape[2])
199 | f_chem.create_dimension('west_east', wrf_spec_emis[0].shape[3])
200 | f_chem.create_dimension('DateStrLen', 19)
201 |
202 | f_chem.create_variable('Times', 'S1', ('Time', 'DateStrLen'),)
203 | for i, time in enumerate([time_inp+'_'+str(ii).zfill(2)+':00:00' for ii in range(ihour,ihour+12)]):
204 | f_chem.variables['Times'][i] = list(time) # split the string to char
205 | for ll, LL in zip([lon_inp, lat_inp], ['XLONG', 'XLAT']):
206 | f_chem.create_variable(LL, 'f', ('south_north', 'west_east',),)
207 | f_chem.variables[LL][:] = ll
208 |
209 | radm_gas = ['E_CO', 'E_NH3', 'E_NO', 'E_NO2', 'E_SO2', 'E_ALD', 'E_CSL', 'E_ETH', 'E_HC3', 'E_HC5', 'E_HC8', 'E_HCHO', 'E_ISO', 'E_KET',
210 | 'E_OL2', 'E_OLI', 'E_OLT', 'E_ORA2', 'E_TOL', 'E_XYL', ]
211 | radm_aerosol = ['E_ECI', 'E_ECJ', 'E_ORGI', 'E_ORGJ', 'E_PM25I',
212 | 'E_PM25J', 'E_PM_10', 'E_SO4I', 'E_SO4J', 'E_NO3I', 'E_NO3J', ]
213 |
214 | for gas in radm_gas:
215 | f_chem.create_variable(gas, 'f', ('Time', 'emissions_zdim', 'south_north', 'west_east',))
216 | f_chem.variables[gas].FieldType = np.int16(104)
217 | f_chem.variables[gas].MemoryOrder = 'XYZ'
218 | f_chem.variables[gas].description = 'EMISSIONS'
219 | f_chem.variables[gas].units = 'mol km^-2 hr^-1'
220 | f_chem.variables[gas].stagger = 'Z'
221 | # f_chem.variables[gas].ordinates = 'XLONG XLAT'
222 | for aerosol in radm_aerosol:
223 | f_chem.create_variable(aerosol, 'f', ('Time', 'emissions_zdim', 'south_north', 'west_east',))
224 | f_chem.variables[aerosol].FieldType = np.int16(104)
225 | f_chem.variables[aerosol].MemoryOrder = 'XYZ'
226 | f_chem.variables[aerosol].description = 'EMISSIONS'
227 | f_chem.variables[aerosol].units = 'ug/m3 m/s'
228 | f_chem.variables[aerosol].stagger = 'Z'
229 | # f_chem.variables[aerosol].ordinates = 'XLONG XLAT'
230 |
231 | radm_spec = ['E_CO', 'E_NH3', 'E_NO', 'E_NO2', 'E_SO2', 'E_ALD', 'E_CSL', 'E_ETH', 'E_HC3', 'E_HC5', 'E_HC8', 'E_HCHO', 'E_ISO', 'E_KET',
232 | 'E_OL2', 'E_OLI', 'E_OLT', 'E_ORA2', 'E_TOL', 'E_XYL', 'E_ECI', 'E_ECJ', 'E_ORGI', 'E_ORGJ', 'E_PM25I', 'E_PM25J', 'E_PM_10', 'E_SO4I',
233 | 'E_SO4J', 'E_NO3I', 'E_NO3J', ]
234 |
235 | for i, spec in enumerate(radm_spec):
236 | # dimension need to be matched with the variable defination
237 | #f_chem.variables[spec][:] = wrf_spec_emis[i][ihour:ihour+12, :, :, :]
238 | chem_spec_input=wrf_spec_emis[i][ihour:ihour+12, :, :, :]
239 | chem_spec_input_new = chem_spec_input.astype(np.float32)
240 | f_chem.variables[spec].assign_value(chem_spec_input_new)
241 | f_chem.close()
242 | #rename,delete suffix .nc
243 | if not os.path.exists(save_dir): os.makedirs(save_dir)
244 | shutil.move(ent_dir+'/merged/'+'wrfchemi_'+str(ihour).zfill(2)+'z_'+ent_inp.split('_')[-1]+'.nc',
245 | save_dir+'/'+'wrfchemi_'+str(ihour).zfill(2)+'z_'+ent_inp.split('_')[-1])
246 |
247 |
248 | if __name__ == '__main__':
249 | ent_dir = "/home/em/桌面/test/201601/" #请设置为自己的排放源数据所在目录的路径
250 | ent_inp = "/home/em/桌面/test/meic2wrf/wrfinput_d01" #请设置为自己的wrfinput文件所在路径
251 | save_dir = "/home/em/桌面/test/meic2wrf/ssssaaaa" #请设置生成的wrfchemi文件保存目录路径
252 | merge_meic_dept(ent_dir)
253 | itp_dis(ent_inp,ent_dir,save_dir)
254 |
--------------------------------------------------------------------------------
/namelist.input:
--------------------------------------------------------------------------------
1 | &time_control
2 | run_days = 0,
3 | run_hours = 0,
4 | run_minutes = 0,
5 | run_seconds = 0,
6 | start_year = 2020,
7 | start_month = 06,
8 | start_day = 01,
9 | start_hour = 12,
10 | start_minute = 00,
11 | start_second = 00,
12 | end_year = 2020,
13 | end_month = 07,
14 | end_day = 01,
15 | end_hour = 12,
16 | end_minute = 00,
17 | end_second = 00,
18 | interval_seconds = 21600,
19 | input_from_file = .true.,
20 | history_interval = 180,
21 | frames_per_outfile = 24,
22 | restart = .false.,
23 | restart_interval = 5000,
24 | io_form_history = 2,
25 | io_form_restart = 2,
26 | io_form_input = 2,
27 | io_form_boundary = 2,
28 | debug_level = 0,
29 | /
30 |
31 | &domains
32 | time_step = 54,
33 | time_step_fract_num = 0,
34 | time_step_fract_den = 1,
35 | max_dom = 1,
36 | s_we = 1,
37 | e_we = 120,
38 | s_sn = 1,
39 | e_sn = 100,
40 | s_vert = 1,
41 | e_vert = 35,
42 | p_top_requested = 5000,
43 | num_metgrid_levels = 38,
44 | dx = 9000,
45 | dy = 9000,
46 | grid_id = 1,
47 | parent_id = 1,
48 | i_parent_start = 1,
49 | j_parent_start = 1,
50 | parent_grid_ratio = 1,
51 | parent_time_step_ratio = 1,
52 | feedback = 1,
53 | smooth_option = 0,
54 | /
55 |
56 | &physics
57 | physics_suite = 'CONUS'
58 | mp_physics = 10,
59 | cu_physics = 3,
60 | ra_lw_physics = 4,
61 | ra_sw_physics = 4,
62 | bl_pbl_physics = -1,
63 | sf_sfclay_physics = -1,
64 | sf_surface_physics = -1,
65 | radt = 30,
66 | bldt = 0,
67 | cudt = 5,
68 | icloud = 1,
69 | num_land_cat = 21,
70 | sf_urban_physics = 0,
71 |
72 | progn = 1, 1, 1,
73 | naer = 1e9, 1e9, 1e9,
74 | mp_zero_out = 2,
75 | mp_zero_out_thresh = 1.e-8,
76 | cu_diag = 1,
77 | cugd_avedx = 1,
78 | isfflx = 1,
79 | ifsnow = 1,
80 | surface_input_source = 1,
81 | num_soil_layers = 4,
82 | maxiens = 1,
83 | maxens = 3,
84 | maxens2 = 3,
85 | maxens3 = 16,
86 | ensdim = 144,
87 | sst_update = 0,
88 | cu_rad_feedback = .true., .true., .true.,
89 | /
90 |
91 | &fdda
92 | /
93 |
94 | &dynamics
95 | w_damping = 0,
96 | diff_opt = 1,
97 | km_opt = 4,
98 | diff_6th_opt = 0, 0, 0,
99 | diff_6th_factor = 0.12, 0.12, 0.12,
100 | base_temp = 290.,
101 | damp_opt = 0,
102 | zdamp = 5000., 5000., 5000.,
103 | dampcoef = 0.01, 0.01, 0.01,
104 | khdif = 0, 0, 0,
105 | kvdif = 0, 0, 0,
106 | non_hydrostatic = .true., .true., .true.,
107 | tke_adv_opt = 1, 1, 1,
108 | moist_adv_opt = 2, 2, 2,
109 | scalar_adv_opt = 2, 2, 2,
110 | chem_adv_opt = 2, 2, 2,
111 | /
112 |
113 | &bdy_control
114 | spec_bdy_width = 5,
115 | spec_zone = 1,
116 | relax_zone = 4,
117 | specified = .true., .false., .false.,
118 | nested = .false., .true., .true.,
119 | /
120 |
121 | &grib2
122 | /
123 |
124 | &chem
125 | kemit = 11,
126 | chem_opt = 10, 10, 10,
127 | bioemdt = 6., 2., 0.666666666,
128 | photdt = 30, 30, 30,
129 | chemdt = 6., 2., 0.666666666,
130 | io_style_emissions = 1,
131 | emiss_inpt_opt = 101, 101, 101,
132 | emiss_opt = 4, 4, 4,
133 | chem_in_opt = 0, 0, 0,
134 | phot_opt = 2, 2, 2,
135 | gas_drydep_opt = 1, 1, 1,
136 | aer_drydep_opt = 1, 1, 1,
137 | bio_emiss_opt = 3, 3, 3,
138 | dust_opt = 3,
139 | dmsemis_opt = 0,
140 | seas_opt = 2,
141 | gas_bc_opt = 1, 1, 1,
142 | gas_ic_opt = 1, 1, 1,
143 | aer_bc_opt = 1, 1, 1,
144 | aer_ic_opt = 1, 1, 1,
145 | gaschem_onoff = 1, 1, 1,
146 | aerchem_onoff = 1, 1, 1,
147 | wetscav_onoff = 1, 1, 1,
148 | cldchem_onoff = 1, 1, 1,
149 | vertmix_onoff = 1, 1, 1,
150 | chem_conv_tr = 1,
151 | biomass_burn_opt = 0, 0, 0,
152 | plumerisefire_frq = 30, 30, 30,
153 | aer_ra_feedback = 1, 1, 1,
154 | have_bcs_chem = .true., .false., .false.,
155 | aer_op_opt = 1,
156 | opt_pars_out = 1,
157 | ne_area = 300,
158 | /
159 |
160 | &namelist_quilt
161 | nio_tasks_per_group = 0,
162 | nio_groups = 1,
163 | /
164 |
--------------------------------------------------------------------------------
/wrfinput_d01:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jinfan0931/meic2wrf/edeaa7f75667bc22bdc0694e32cbcbb6d6972c2f/wrfinput_d01
--------------------------------------------------------------------------------