diff --git a/database/03-tables/sen4cap/agricultural_practice.sql b/database/03-tables/sen4cap/agricultural_practice.sql new file mode 100644 index 00000000..23689b2c --- /dev/null +++ b/database/03-tables/sen4cap/agricultural_practice.sql @@ -0,0 +1,4 @@ +create table agricultural_practice( + id int not null primary key, + name text not null +); diff --git a/database/03-tables/sen4cap/product_details_l4a.sql b/database/03-tables/sen4cap/product_details_l4a.sql new file mode 100644 index 00000000..f8cab80d --- /dev/null +++ b/database/03-tables/sen4cap/product_details_l4a.sql @@ -0,0 +1,10 @@ +create table product_details_l4a( + product_id int not null references product(id), + "NewID" int not null, + "CT_decl" int, + "CT_pred_1" int, + "CT_conf_1" real, + "CT_pred_2" int, + "CT_conf_2" real, + constraint product_details_l4a_pkey primary key(product_id, "NewID") +); diff --git a/database/03-tables/sen4cap/product_details_l4c.sql b/database/03-tables/sen4cap/product_details_l4c.sql new file mode 100644 index 00000000..e1df1aa4 --- /dev/null +++ b/database/03-tables/sen4cap/product_details_l4c.sql @@ -0,0 +1,37 @@ +create table product_details_l4c( + product_id int not null references product(id), + "NewID" int not null, + practice_id int not null references agricultural_practice(id), + orig_id text not null, + country text not null, + year int not null, + main_crop text not null, + veg_start text not null, + h_start text not null, + h_end text not null, + practice text not null, + p_type text not null, + p_start text not null, + p_end text not null, + l_week text not null, + m1 text not null, + m2 text not null, + m3 text not null, + m4 text not null, + m5 text not null, + h_week text not null, + h_w_start text not null, + h_w_end text not null, + h_w_s1 text not null, + m6 text not null, + m7 text not null, + m8 text not null, + m9 text not null, + m10 text not null, + c_index text not null, + s1_pix text not null, + s1_gaps text not null, + h_s1_gaps text not null, + p_s1_gaps text not null, + constraint product_details_l4c_pkey primary key(product_id, "NewID") +); diff --git a/database/07-data/sen4cap/01.config_category.sql b/database/07-data/sen4cap/01.config_category.sql index 0acb6fda..f182508c 100644 --- a/database/07-data/sen4cap/01.config_category.sql +++ b/database/07-data/sen4cap/01.config_category.sql @@ -12,6 +12,4 @@ INSERT INTO config_category VALUES (16, 'Demmaccs', 13, false); INSERT INTO config_category VALUES (17, 'Site', 14, false); INSERT INTO config_category VALUES (19, 'L4B Grassland Mowing', 15, true); INSERT INTO config_category VALUES (20, 'L4B Grassland Mowing', 16, true); - - - +INSERT INTO config_category VALUES (21, 'LPIS', 17, true); diff --git a/database/07-data/sen4cap/09.config.sql b/database/07-data/sen4cap/09.config.sql index 25503615..ea8dde19 100644 --- a/database/07-data/sen4cap/09.config.sql +++ b/database/07-data/sen4cap/09.config.sql @@ -147,6 +147,8 @@ INSERT INTO config(key, site_id, value, last_updated) VALUES ('processor.s4c_l4c INSERT INTO config(key, site_id, value, last_updated) VALUES ('processor.s4c_l4b.config_path', NULL, '/usr/share/sen2agri/S4C_L4B_Configurations/S4C_L4B_Config.cfg', '2019-02-18 15:27:41.861613+02'); INSERT INTO config(key, site_id, value, last_updated) VALUES ('processor.s4c_l4c.config_path', NULL, '/usr/share/sen2agri/S4C_L4C_Configurations/S4C_L4C_Config_NLD.cfg', '2019-02-18 15:27:41.861613+02'); +INSERT INTO config(key, site_id, value, last_updated) VALUES ('processor.lpis.path', NULL, '/mnt/archive/lpis/{site}', '2019-06-11 16:15:00.0+02'); + INSERT INTO config(key, site_id, value, last_updated) VALUES ('resources.working-mem', NULL, '1024', '2015-09-08 11:03:21.87284+03'); INSERT INTO config(key, site_id, value, last_updated) VALUES ('s1.enabled', NULL, 'false', '2017-10-24 14:56:57.501918+02'); diff --git a/database/07-data/sen4cap/10.config_metadata.sql b/database/07-data/sen4cap/10.config_metadata.sql index e0c63d97..2148eee5 100644 --- a/database/07-data/sen4cap/10.config_metadata.sql +++ b/database/07-data/sen4cap/10.config_metadata.sql @@ -146,6 +146,7 @@ INSERT INTO config_metadata VALUES ('processor.s4c_l4c.input_ndvi', 'The list of INSERT INTO config_metadata VALUES ('processor.s4c_l4b.config_path', 'The default configuration files for all L4B processors', 'file', FALSE, 19); INSERT INTO config_metadata VALUES ('processor.s4c_l4c.config_path', 'The default configuration files for all L4C processors', 'file', FALSE, 20); +INSERT INTO config_metadata VALUES ('processor.lpis.path', 'The path to the pre-processed LPIS products', 'string', false, 21); INSERT INTO config_metadata VALUES ('resources.working-mem', 'OTB applications working memory (MB)', 'int', true, 14); diff --git a/database/07-data/sen4cap/agricultural_practice.sql b/database/07-data/sen4cap/agricultural_practice.sql new file mode 100644 index 00000000..4f5b9165 --- /dev/null +++ b/database/07-data/sen4cap/agricultural_practice.sql @@ -0,0 +1,6 @@ +insert into agricultural_practice +values + (1, 'NA'), + (2, 'CatchCrop'), + (3, 'NFC'), + (4, 'Fallow'); diff --git a/licenses/NumPy/LICENSE.txt b/licenses/NumPy/LICENSE.txt new file mode 100644 index 00000000..5eae3201 --- /dev/null +++ b/licenses/NumPy/LICENSE.txt @@ -0,0 +1,30 @@ +Copyright (c) 2005-2019, NumPy Developers. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the NumPy Developers nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/licenses/RStudio/COPYING b/licenses/RStudio/COPYING new file mode 100644 index 00000000..e04b1f80 --- /dev/null +++ b/licenses/RStudio/COPYING @@ -0,0 +1,672 @@ + +Unless you have received this program directly from RStudio pursuant to +the terms of a commercial license agreement with RStudio, then RStudio is +licensed to you under the AGPLv3, the terms of which are included below. +Details on obtaining the source code for this distribution are included +in the file SOURCE. + +RStudio includes other open source software whose license terms can be found +in the file NOTICE. RStudio for Windows is bundled with binary copies of +several utilities, whose license terms can be found in the file SOURCE. + + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. \ No newline at end of file diff --git a/licenses/SciPy/LICENSE.txt b/licenses/SciPy/LICENSE.txt new file mode 100644 index 00000000..5a0a660d --- /dev/null +++ b/licenses/SciPy/LICENSE.txt @@ -0,0 +1,30 @@ +Copyright (c) 2001-2002 Enthought, Inc. 2003-2019, SciPy Developers. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/licenses/caret/GPL-2 b/licenses/caret/GPL-2 new file mode 100644 index 00000000..3912109b --- /dev/null +++ b/licenses/caret/GPL-2 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/licenses/caret/GPL-3 b/licenses/caret/GPL-3 new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/licenses/caret/GPL-3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/licenses/dplyer/LICENSE b/licenses/dplyer/LICENSE new file mode 100644 index 00000000..338a6b11 --- /dev/null +++ b/licenses/dplyer/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2013-2015 +COPYRIGHT HOLDER: RStudio diff --git a/licenses/dplyer/MIT b/licenses/dplyer/MIT new file mode 100644 index 00000000..c0c840fe --- /dev/null +++ b/licenses/dplyer/MIT @@ -0,0 +1,32 @@ +Based on http://opensource.org/licenses/MIT + +This is a template. Complete and ship as file LICENSE the following 2 +lines (only) + +YEAR: +COPYRIGHT HOLDER: + +and specify as + +License: MIT + file LICENSE + +Copyright (c) , + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/licenses/gsubfn/GPL-2 b/licenses/gsubfn/GPL-2 new file mode 100644 index 00000000..3912109b --- /dev/null +++ b/licenses/gsubfn/GPL-2 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/licenses/gsubfn/GPL-3 b/licenses/gsubfn/GPL-3 new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/licenses/gsubfn/GPL-3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/licenses/matplotlib/LICENSE b/licenses/matplotlib/LICENSE new file mode 100644 index 00000000..ec51537d --- /dev/null +++ b/licenses/matplotlib/LICENSE @@ -0,0 +1,99 @@ +License agreement for matplotlib versions 1.3.0 and later +========================================================= + +1. This LICENSE AGREEMENT is between the Matplotlib Development Team +("MDT"), and the Individual or Organization ("Licensee") accessing and +otherwise using matplotlib software in source or binary form and its +associated documentation. + +2. Subject to the terms and conditions of this License Agreement, MDT +hereby grants Licensee a nonexclusive, royalty-free, world-wide license +to reproduce, analyze, test, perform and/or display publicly, prepare +derivative works, distribute, and otherwise use matplotlib +alone or in any derivative version, provided, however, that MDT's +License Agreement and MDT's notice of copyright, i.e., "Copyright (c) +2012- Matplotlib Development Team; All Rights Reserved" are retained in +matplotlib alone or in any derivative version prepared by +Licensee. + +3. In the event Licensee prepares a derivative work that is based on or +incorporates matplotlib or any part thereof, and wants to +make the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to matplotlib . + +4. MDT is making matplotlib available to Licensee on an "AS +IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB +WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. + +5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB + FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR +LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING +MATPLOTLIB , OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF +THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between MDT and +Licensee. This License Agreement does not grant permission to use MDT +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using matplotlib , +Licensee agrees to be bound by the terms and conditions of this License +Agreement. + +License agreement for matplotlib versions prior to 1.3.0 +======================================================== + +1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the +Individual or Organization ("Licensee") accessing and otherwise using +matplotlib software in source or binary form and its associated +documentation. + +2. Subject to the terms and conditions of this License Agreement, JDH +hereby grants Licensee a nonexclusive, royalty-free, world-wide license +to reproduce, analyze, test, perform and/or display publicly, prepare +derivative works, distribute, and otherwise use matplotlib +alone or in any derivative version, provided, however, that JDH's +License Agreement and JDH's notice of copyright, i.e., "Copyright (c) +2002-2011 John D. Hunter; All Rights Reserved" are retained in +matplotlib alone or in any derivative version prepared by +Licensee. + +3. In the event Licensee prepares a derivative work that is based on or +incorporates matplotlib or any part thereof, and wants to +make the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to matplotlib. + +4. JDH is making matplotlib available to Licensee on an "AS +IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB +WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. + +5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB + FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR +LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING +MATPLOTLIB , OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF +THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between JDH and +Licensee. This License Agreement does not grant permission to use JDH +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using matplotlib, +Licensee agrees to be bound by the terms and conditions of this License +Agreement. \ No newline at end of file diff --git a/licenses/pandas/LICENSE b/licenses/pandas/LICENSE new file mode 100644 index 00000000..924de262 --- /dev/null +++ b/licenses/pandas/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2008-2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/licenses/ranger/GPL-3 b/licenses/ranger/GPL-3 new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/licenses/ranger/GPL-3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/licenses/readr/GPL-2 b/licenses/readr/GPL-2 new file mode 100644 index 00000000..3912109b --- /dev/null +++ b/licenses/readr/GPL-2 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/licenses/readr/GPL-3 b/licenses/readr/GPL-3 new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/licenses/readr/GPL-3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/licenses/readr/LICENSE b/licenses/readr/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/licenses/readr/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/licenses/select2/LICENSE.md b/licenses/select2/LICENSE.md new file mode 100644 index 00000000..8cb8a2b1 --- /dev/null +++ b/licenses/select2/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/licenses/smotefamily/GPL-3 b/licenses/smotefamily/GPL-3 new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/licenses/smotefamily/GPL-3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/scripts/crop-diversification.py b/scripts/crop-diversification.py new file mode 100755 index 00000000..195d874f --- /dev/null +++ b/scripts/crop-diversification.py @@ -0,0 +1,445 @@ +#!/usr/bin/python + +import argparse +import csv + + +def main(): + parser = argparse.ArgumentParser(description="Crop type diversification script") + parser.add_argument('-i', '--input', help="classification result CSV") + parser.add_argument('-l', '--lut', help="LUT CSV") + parser.add_argument('-o', '--output', help="output CSV") + + args = parser.parse_args() + + input_csv = args.input + input_lut = args.lut + output_csv = args.output + parcel_id_field = 'NewID' + holding_id_field = 'HoldID' + crop_divers_field_decl = 'CTnumDIV' + crop_divers_field_pred_1 = 'CTnumDIV_pred_1' + area_field = 'Area_meters' + conf_threshold = 2.0 + + aggDict = {} + cat = {} + cropdiv = {} + debug = {} + + output_fields_int = ['nb_types_c', 'NewID', 'HoldID', 'CT_decl', 'CT_pred_1', 'CT_pred_2', 'Ori_crop', crop_divers_field_decl, crop_divers_field_pred_1, 'nb_parcels_nc', 'LC', 'S2pix', 'S1pix'] + output_fields_float = [area_field, 'area_eaa_c', 'area_tal_c', 'area_tempGrass_c', 'area_permGrass_c', 'area_llf_c', 'area_cwater_c', 'area_remAl_ex2_c', 'area_remAl_ex3_c', 'area_mainCrop_c', 'area_2mainCrop_c', 'area_nc', 'CT_conf_1', 'CT_conf_2'] + output_fields_str = [] + output_fields = ['NewID', 'Classif_r', 'CD_cat', 'CD_diagn', 'Area_meters'] + db_fields = ['nb_types_c', 'area_eaa_c', 'area_tal_c', 'area_tempGrass_c', 'area_permGrass_c', 'area_llf_c', 'area_cwater_c', 'area_remAl_ex2_c', 'area_remAl_ex3_c', 'area_mainCrop_c', 'area_2mainCrop_c', 'nb_parcels_nc', 'area_nc'] + agri_fields = ['HoldID', 'CD_cat', 'CD_diagn'] + + # -------------------------------------------------------------------------------- + # Create the lists of CTnumDIV in the different categories: Eligible Agriculture Area (EAA), Arable Land (AL), Permanent Grassland (PGrass), Temporary Grassland (TGrass), Land Lying Fallow (Fallow) and Crop Under Water (Cwater) + + eaa_codes = set() + tal_codes = set() + permGrass_codes = set() + tempGrass_codes = set() + llf_codes = set() + cwater_codes = set() + + with open(input_lut) as l_in: + lut_in = csv.DictReader(l_in, delimiter=';') + + for row in lut_in: + if row['EAA'] == '1': + eaa_codes.add(str(row['CTnumDIV'])) + if row['AL'] == '1': + tal_codes.add(str(row['CTnumDIV'])) + if row['PGrass'] == '1': + permGrass_codes.add(str(row['CTnumDIV'])) + if row['TGrass'] == '1': + tempGrass_codes.add(str(row['CTnumDIV'])) + if row['Fallow'] == '1': + llf_codes.add(str(row['CTnumDIV'])) + if row['Cwater'] == '1': + cwater_codes.add(str(row['CTnumDIV'])) + + # -------------------------------------------------------------------------------- + # Import data file + + with open(input_csv) as f_in: + csv_in = csv.DictReader(f_in, delimiter=',') + + # -------------------------------------------------------------------------------- + # Create column with results of the classification "Classif_r" + + for row in csv_in: + agri = row[holding_id_field] + fid = row[parcel_id_field] + out = dict(row) + if agri not in aggDict: + aggDict[agri] = {} + debug[agri] = {} + if row['CT_pred_1'] != 'NA' and row['CT_pred_1'] != '': + if row['CT_decl'] == row['CT_pred_1'] or row['CT_decl'] == row['CT_pred_2']: + out['Classif_r'] = 'Classified_conform' + elif float(row['CT_conf_1']) >= conf_threshold: + out['Classif_r'] = 'Classified_not_conform_prediction_used' + else: + out['Classif_r'] = 'Classified_not_conform' + elif row['GeomValid'] == '0' or row['Duplic'] == '0' or row['Overlap'] == '1': + out['Classif_r'] = 'Not_classified_geometry' + elif row['LC'] == '' or row['LC'] == '0' or row['LC'] == '5' or row['LC'] == 'NA': + out['Classif_r'] = 'Not_classified_land_cover' + elif row['S2Pix'] == '' or int(row['S2Pix']) <= 2: + out['Classif_r'] = 'Not_classified_minS2pix' + elif row['S1Pix'] == '' or int(row['S1Pix']) == 0: + out['Classif_r'] = 'Not_classified_noS1pix' + else: + out['Classif_r'] = 'Not_classified_undefined' + aggDict[agri][fid] = out + + # -------------------------------------------------------------------------------- + # Summarized factors by holding + + for agri in aggDict: + area_eaa_c = 0. + area_tal_c = 0. + area_tempGrass_c = 0. + area_permGrass_c = 0. + area_llf_c = 0. + area_cwater_c = 0. + area_remAl_ex2_c = 0. + area_remAl_ex3_c = 0. + types_c = set() + nb_parcels_nc = 0. + area_mainCrop_c = 0. + area_2mainCrop_c = 0. + area_nc = 0. + areas_dict = {} + + for (fid, row) in aggDict[agri].items(): + if row['Classif_r'] == 'Classified_conform': + if row[crop_divers_field_decl] == '': + cType = str(row[crop_divers_field_decl]) + else: + cType = str(int(row[crop_divers_field_decl])) + elif row['Classif_r'] == 'Classified_not_conform_prediction_used': + if row[crop_divers_field_decl] == '': + cType = str(row[crop_divers_field_pred_1]) + else: + cType = str(int(row[crop_divers_field_pred_1])) + else: + if row[crop_divers_field_decl] == '': + cType = str(row[crop_divers_field_decl]) + else: + cType = str(int(row[crop_divers_field_decl])) + area = float(row[area_field]) + if row['Classif_r'] == 'Classified_conform' or row['Classif_r'] == 'Classified_not_conform_prediction_used': + if cType in eaa_codes: + area_eaa_c += area + if cType in tal_codes: + area_tal_c += area + types_c.add(cType) + areas_dict[cType] = area if cType not in areas_dict else area + areas_dict[cType] + if cType in tempGrass_codes: + area_tempGrass_c += area + if cType in permGrass_codes: + area_permGrass_c += area + if cType in llf_codes: + area_llf_c += area + if cType in cwater_codes: + area_cwater_c += area + elif cType in eaa_codes: + area_nc += area + nb_parcels_nc += 1 + + nb_types_c = len(types_c) + area_remAl_ex2_c = area_tal_c - area_tempGrass_c - area_llf_c + area_remAl_ex3_c = area_tal_c - area_tempGrass_c - area_cwater_c + + areas = list(areas_dict.values()) + areas.sort(reverse=True) + + area_mainCrop_c = 0. if len(areas) == 0 else areas[0] + area_2mainCrop_c = 0. if len(areas) == 0 or len(areas) == 1 else areas[1] + + # -------------------------------------------------------------------------------- + # Define the crop diversification category "CD_cat" + + cat[agri] = 'Exemption_or_Category1_2_or_3' + + if area_nc == 0: + + if area_tal_c < 100000: + cat[agri] = 'Exemption1' + + elif area_tempGrass_c + area_llf_c > 0.75 * area_tal_c and area_remAl_ex2_c <= 300000: + cat[agri] = 'Exemption2' + + elif area_permGrass_c + area_tempGrass_c + area_cwater_c > 0.75 * area_eaa_c and area_remAl_ex3_c <= 300000: + cat[agri] = 'Exemption3' + + elif area_cwater_c == area_tal_c: + cat[agri] = 'Exemption4' + + elif area_tempGrass_c + area_llf_c > 0.75 * area_tal_c: + cat[agri] = 'Category3' + + elif area_tal_c > 100000 and area_tal_c <= 300000: + cat[agri] = 'Category1' + + elif area_tal_c > 300000: + cat[agri] = 'Category2' + + elif area_nc != 0: + + if area_tal_c + area_nc < 100000: + cat[agri] = 'Exemption1' + + elif area_tempGrass_c + area_llf_c > 0.75 * (area_tal_c + area_nc) and area_remAl_ex2_c + area_nc <= 300000: + cat[agri] = 'Exemption2' + + elif area_permGrass_c + area_tempGrass_c + area_cwater_c > 0.75 * (area_eaa_c + area_nc) and area_remAl_ex3_c + area_nc <= 300000: + cat[agri] = 'Exemption3' + + elif area_tal_c < 100000 or (area_tempGrass_c + area_llf_c > 0.75 * area_tal_c and area_remAl_ex2_c <= 300000) or (area_permGrass_c + area_tempGrass_c + area_cwater_c > 0.75 * area_eaa_c and area_remAl_ex3_c <= 300000) or (area_cwater_c == area_tal_c): + + if area_tempGrass_c + area_llf_c > 0.75 * area_tal_c: + + if area_tempGrass_c + area_llf_c > 0.75 * (area_tal_c + area_nc): + cat[agri] = 'Exemption_or_Category3' + + elif area_tal_c + area_nc >= 100000 and area_tal_c + area_nc < 300000: + cat[agri] = 'Exemption_or_Category1_or_3' + + elif area_tal_c >= 300000: + cat[agri] = 'Exemption_or_Category2_or_3' + + elif area_tal_c + area_nc >= 300000: + cat[agri] = 'Exemption_or_Category1_2_or_3' + + elif area_tempGrass_c + area_llf_c + area_nc <= 0.75 * (area_tal_c + area_nc): + + if area_tal_c + area_nc >= 100000 and area_tal_c + area_nc < 300000: + cat[agri] = 'Exemption_or_Category1' + + elif area_tal_c >= 300000: + cat[agri] = 'Exemption_or_Category2' + + elif area_tal_c + area_nc >= 300000: + cat[agri] = 'Exemption_or_Category1_or_2' + + elif area_tal_c + area_nc >= 100000 and area_tal_c + area_nc < 300000: + cat[agri] = 'Exemption_or_Category1_or_3' + + elif area_tal_c >= 300000: + cat[agri] = 'Exemption_or_Category2_or_3' + + elif area_tal_c + area_nc >= 300000: + cat[agri] = 'Exemption_or_Category1_2_or_3' + + elif area_tal_c > 100000 and ((area_tempGrass_c + area_llf_c + area_nc <= 0.75 * (area_tal_c + area_nc)) or (area_tempGrass_c + area_llf_c + area_nc > 0.75 * (area_tal_c + area_nc) and area_remAl_ex2_c > 300000) or (area_tempGrass_c + area_llf_c > 0.75 * (area_tal_c + area_nc) and area_remAl_ex2_c + area_nc > 300000) or (area_tempGrass_c + area_llf_c > 0.75 * area_tal_c and area_remAl_ex2_c > 300000)) and ((area_permGrass_c + area_tempGrass_c + area_cwater_c + area_nc <= 0.75 * (area_eaa_c + area_nc)) or (area_permGrass_c + area_tempGrass_c + area_cwater_c > 0.75 * area_eaa_c and area_remAl_ex3_c > 300000) or (area_permGrass_c + area_tempGrass_c + area_cwater_c + area_nc > 0.75 * (area_eaa_c + area_nc) and area_remAl_ex3_c > 300000)) and (area_cwater_c != area_tal_c): + + if area_tempGrass_c + area_llf_c > 0.75 * area_tal_c: + + if area_tempGrass_c + area_llf_c > 0.75 * (area_tal_c + area_nc): + cat[agri] = 'Category3' + + elif area_tal_c + area_nc >= 100000 and area_tal_c + area_nc < 300000: + cat[agri] = 'Category1_or_3' + + elif area_tal_c >= 300000: + cat[agri] = 'Category2_or_3' + + elif area_tal_c + area_nc >= 300000: + cat[agri] = 'Category1_2_or_3' + + elif area_tempGrass_c + area_llf_c + area_nc <= 0.75 * (area_tal_c + area_nc): + + if area_tal_c + area_nc >= 100000 and area_tal_c + area_nc < 300000: + cat[agri] = 'Category1' + + elif area_tal_c >= 300000: + cat[agri] = 'Category2' + + elif area_tal_c + area_nc >= 300000: + cat[agri] = 'Category1_or_2' + + elif area_tal_c + area_nc >= 100000 and area_tal_c + area_nc < 300000: + cat[agri] = 'Category1_or_3' + + elif area_tal_c >= 300000: + cat[agri] = 'Category2_or_3' + + elif area_tal_c + area_nc >= 300000: + cat[agri] = 'Category1_2_or_3' + + # -------------------------------------------------------------------------------- + # Check crop diversification rules "CD_diagn" + + if cat[agri] == 'Exemption1' or cat[agri] == 'Exemption2' or cat[agri] == 'Exemption3' or cat[agri] == 'Exemption4': + cropdiv[agri] = 'Not_required' + + elif cat[agri] == 'Category1': + if nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc): + cropdiv[agri] = 'Compliant' + elif nb_types_c + nb_parcels_nc < 2 or area_mainCrop_c > 0.75*(area_tal_c + area_nc): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Category2': + if nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc): + cropdiv[agri] = 'Compliant' + elif nb_types_c + nb_parcels_nc < 3 or area_mainCrop_c > 0.75*(area_tal_c + area_nc) or area_mainCrop_c + area_2mainCrop_c > 0.95 * (area_tal_c + area_nc): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Category3': + if area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc): + cropdiv[agri] = 'Compliant' + elif area_mainCrop_c > 0.75*(area_remAl_ex2_c + area_nc): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Category1_or_2': + if (nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc)) and (nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc)): + cropdiv[agri] = 'Compliant' + elif (nb_types_c + nb_parcels_nc < 2 or area_mainCrop_c > 0.75*(area_tal_c + area_nc)) and (nb_types_c + nb_parcels_nc < 3 or area_mainCrop_c > 0.75*(area_tal_c + area_nc) or area_mainCrop_c + area_2mainCrop_c > 0.95 * (area_tal_c + area_nc)): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Category1_or_3': + if (nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc)) and (area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Compliant' + elif (nb_types_c + nb_parcels_nc < 2 or area_mainCrop_c > 0.75*(area_tal_c + area_nc)) and (area_mainCrop_c > 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Category2_or_3': + if (nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc)) and (area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Compliant' + elif (nb_types_c + nb_parcels_nc < 3 or area_mainCrop_c > 0.75*(area_tal_c + area_nc) or area_mainCrop_c + area_2mainCrop_c > 0.95 * (area_tal_c + area_nc)) and (area_mainCrop_c > 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Category1_2_or_3': + if (nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc)) and (nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc)) and (area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Compliant' + elif (nb_types_c + nb_parcels_nc < 2 or area_mainCrop_c > 0.75*(area_tal_c + area_nc)) and (nb_types_c + nb_parcels_nc < 3 or area_mainCrop_c > 0.75*(area_tal_c + area_nc) or area_mainCrop_c + area_2mainCrop_c > 0.95 * (area_tal_c + area_nc)) and (area_mainCrop_c > 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Not_compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Exemption_or_Category1_or_2': + if (nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc)) and (nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc)): + cropdiv[agri] = 'Compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Exemption_or_Category1_or_3': + if (nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc)) and (area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Exemption_or_Category2_or_3': + if (nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc)) and (area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Exemption_or_Category1_2_or_3': + if (nb_types_c >= 2 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc)) and (nb_types_c >= 3 and area_mainCrop_c + area_nc <= 0.75*(area_tal_c + area_nc) and area_mainCrop_c + area_2mainCrop_c + area_nc <= 0.95 * (area_tal_c + area_nc)) and (area_mainCrop_c + area_nc <= 0.75*(area_remAl_ex2_c + area_nc)): + cropdiv[agri] = 'Compliant' + else: + cropdiv[agri] = 'Missing_info' + + elif cat[agri] == 'Undefined': + cropdiv[agri] = 'Missing_info' + + else: + cropdiv[agri] = 'Missing_info' + + # -------------------------------------------------------------------------------- + # Debug factors + + debug[agri]['nb_types_c'] = nb_types_c + debug[agri]['area_eaa_c'] = area_eaa_c + debug[agri]['area_tal_c'] = area_tal_c + debug[agri]['area_tempGrass_c'] = area_tempGrass_c + debug[agri]['area_permGrass_c'] = area_permGrass_c + debug[agri]['area_llf_c'] = area_llf_c + debug[agri]['area_remAl_ex2_c'] = area_remAl_ex2_c + debug[agri]['area_remAl_ex3_c'] = area_remAl_ex3_c + debug[agri]['area_mainCrop_c'] = area_mainCrop_c + debug[agri]['area_2mainCrop_c'] = area_2mainCrop_c + debug[agri]['nb_parcels_nc'] = nb_parcels_nc + debug[agri]['area_nc'] = area_nc + debug[agri]['area_cwater_c'] = area_cwater_c + + # -------------------------------------------------------------------------------- + # Write outputs + + with open(output_csv, 'w') as f_out, open(output_csv.replace('.csv', '_holding.csv'), 'w') as f_out_holding: + csv_out = csv.DictWriter(f_out, fieldnames=output_fields) + csv_out.writeheader() + csv_out_holding = csv.DictWriter(f_out_holding, fieldnames=agri_fields + db_fields) + csv_out_holding.writeheader() + + for agri in aggDict: + for fid in aggDict[agri]: + row = aggDict[agri][fid] + newrow = {} + for field in output_fields: + if field in output_fields_int: + if row[field] == '': + newrow[field] = 0 + else: + newrow[field] = int(float(row[field])) + elif field in output_fields_float: + if row[field] == '': + newrow[field] = 0 + else: + newrow[field] = float(row[field]) + elif field in output_fields_str: + newrow[field] = str(row[field]) + newrow['Classif_r'] = row['Classif_r'] + newrow['CD_cat'] = cat[agri] + newrow['CD_diagn'] = cropdiv[agri] + csv_out.writerow(newrow) + + for field in db_fields: + newrow[field] = debug[agri][field] + + for agri in aggDict: + firstKey = aggDict[agri].keys()[0] + row = aggDict[agri][firstKey] + newrow = {} + for field in agri_fields: + if field in output_fields_int: + if row[field] == '': + newrow[field] = 0 + else: + newrow[field] = int(float(row[field])) + elif field in output_fields_float: + if row[field] == '': + newrow[field] = 0.0 + else: + newrow[field] = float(row[field]) + elif field in output_fields_str: + newrow[field] = str(row[field]) + newrow['CD_cat'] = cat[agri] + newrow['CD_diagn'] = cropdiv[agri] + for field in db_fields: + newrow[field] = debug[agri][field] + csv_out_holding.writerow(newrow) + + print('done') + + +if __name__ == "__main__": + main() diff --git a/scripts/crop-type-parcels.py b/scripts/crop-type-parcels.py index 5a1d3db1..bb51fbb1 100755 --- a/scripts/crop-type-parcels.py +++ b/scripts/crop-type-parcels.py @@ -11,6 +11,9 @@ import os import os.path from osgeo import ogr +from osgeo import osr +from osgeo import gdal +from gdal import gdalconst import pipes import psycopg2 from psycopg2.sql import SQL, Literal @@ -139,23 +142,30 @@ def get_season_dates(start_date, end_date): def get_tile_hdr(tile, path): pat = "*_SSC_*_{}_*.HDR".format(tile) entries = glob(os.path.join(path, pat)) - if len(entries) == 0: - print("No HDR found for tile {} in {}".format(tile, path)) - return None - hdr = entries[0] - entries = glob(os.path.join(path, "*_SSC_*_{}_*.DBL.DIR/*.TIF".format(tile))) - for raster_type in ["FRE", "CLD", "MSK", "QLT"]: - for res in ["R1", "R2"]: - pat = "_{}_{}.DBL.TIF".format(raster_type, res) - ok = False - for entry in entries: - if entry.endswith(pat): - ok = True - break - if not ok: - print("No {} raster found for tile {} in {}".format(pat, tile, path)) - return None - return hdr + if len(entries) > 0: + hdr = entries[0] + entries = glob(os.path.join(path, "*_SSC_*_{}_*.DBL.DIR/*.TIF".format(tile))) + for raster_type in ["FRE", "CLD", "MSK", "QLT"]: + for res in ["R1", "R2"]: + pat = "_{}_{}.DBL.TIF".format(raster_type, res) + ok = False + for entry in entries: + if entry.endswith(pat): + ok = True + break + if not ok: + print("No {} raster found for tile {} in {}".format(pat, tile, path)) + return None + return hdr + + pat = "*_T{}_*/*_MTD_ALL.xml".format(tile) + entries = glob(os.path.join(path, pat)) + if len(entries) > 0: + hdr = entries[0] + return hdr + + print("No HDR found for tile {} in {}".format(tile, path)) + return None def date_to_epoch_days(dt): @@ -227,7 +237,7 @@ def extract_optical_features(path, satellite_id, tile, products, ref, dates_file command += ["-pixsize", resolution] command += ["-mission", satellite] command += ["-ref", ref] -# command += ["-rededge", "true"] + command += ["-rededge", "true"] command += ["-dates", dates_file] command += ["-outmean", mean] command += ["-outdev", dev] @@ -600,6 +610,7 @@ def get_tile_footprints(conn, site_id): query = SQL( """ select shape_tiles_s2.tile_id, + shape_tiles_s2.epsg_code, ST_AsBinary(shape_tiles_s2.geog) as geog from shape_tiles_s2 where shape_tiles_s2.tile_id in ( @@ -618,10 +629,10 @@ def get_tile_footprints(conn, site_id): conn.commit() tiles = {} - for (tile_id, geog) in results: + for (tile_id, epsg_code, geog) in results: geog = bytes(geog) geog = ogr.CreateGeometryFromWkb(geog) - tiles[tile_id] = geog + tiles[tile_id] = (geog, epsg_code) return tiles @@ -705,13 +716,17 @@ def get_statistics_invocation(input, ref): class WeeklyComposite(object): - def __init__(self, output, tile_ref, xmin, xmax, ymin, ymax, inputs): + def __init__(self, output, temp, tile_ref, xmin, xmax, ymin, ymax, tile_epsg_code, tile_srs, tile_extent, inputs): self.output = output + self.temp = temp self.tile_ref = tile_ref self.xmin = xmin self.xmax = xmax self.ymin = ymin self.ymax = ymax + self.tile_epsg_code = tile_epsg_code + self.tile_srs = tile_srs + self.tile_extent = tile_extent self.inputs = inputs def run(self): @@ -727,17 +742,33 @@ def run(self): command = [] command += ["otbcli", "Composite"] command += ["-progress", "false"] - command += ["-out", self.output] - command += ["-ref", self.tile_ref] - command += ["-srcwin.ulx", self.xmin] - command += ["-srcwin.uly", self.ymax] - command += ["-srcwin.lrx", self.xmax] - command += ["-srcwin.lry", self.ymin] + command += ["-out", self.temp] + command += ["-outputs.ulx", self.xmin] + command += ["-outputs.uly", self.ymax] + command += ["-outputs.lrx", self.xmax] + command += ["-outputs.lry", self.ymin] + command += ["-outputs.spacingx", 20] + command += ["-outputs.spacingy", -20] command += ["-il"] + self.inputs command += ["-bv", 0] command += ["-opt.gridspacing", 240] run_command(command, env) + (xmin, ymax) = self.tile_extent[0] + (xmax, ymin) = self.tile_extent[2] + + command = [] + command += ["gdalwarp", "-q"] + command += ["-r", "cubic"] + command += ["-t_srs", "EPSG:{}".format(self.tile_epsg_code)] + command += ["-tr", 20, 20] + command += ["-te", xmin, ymin, xmax, ymax] + command += [self.temp] + command += [self.output] + run_command(command) + + os.remove(self.temp) + command = [] command += ["optimize_gtiff.py"] command += ["--no-data", 0] @@ -882,22 +913,79 @@ def run(self): run_command(command, env) +def get_projection(file): + ds = gdal.Open(file, gdalconst.GA_ReadOnly) + srs = osr.SpatialReference() + srs.ImportFromWkt(ds.GetProjectionRef()) + return srs + + +def get_extent(raster): + gt = raster.GetGeoTransform() + (cols, rows) = raster.RasterXSize, raster.RasterYSize + + extent = [] + + x = gt[0] + y = gt[3] + extent.append((x, y)) + + x = gt[0] + rows * gt[2] + y = gt[3] + rows * gt[5] + extent.append((x, y)) + + x = gt[0] + cols * gt[1] + rows * gt[2] + y = gt[3] + cols * gt[4] + rows * gt[5] + extent.append((x, y)) + + x = gt[0] + cols * gt[1] + y = gt[3] + cols * gt[4] + extent.append((x, y)) + + return extent + + def process_radar(config, conn, pool): tiles = get_tile_footprints(conn, config.site_id) products = get_radar_products(config, conn, config.site_id) groups = defaultdict(list) + input_srs = None for product in products: if config.tiles is not None and product.tile_id not in config.tiles: continue if not os.path.exists(product.path): print("product {} does not exist".format(product.path)) continue + + if input_srs is None: + input_srs = get_projection(product.path) + group = RadarGroup(product.year, product.month, product.week, product.tile_id, product.orbit_type_id, product.polarization, product.product_type) groups[group].append(product) + wgs84_srs = osr.SpatialReference() + wgs84_srs.ImportFromEPSG(4326) + + transform = osr.CoordinateTransformation(wgs84_srs, input_srs) + tiles_input_srs = {} + for (tile_id, (geog, epsg_code)) in tiles.items(): + geom = geog.Clone() + geom.Transform(transform) + tiles_input_srs[tile_id] = geom + groups = sorted(list(groups.items())) ref_map = get_lpis_map(config.lpis_path, 20) + ref_srs_map = {} + ref_extent_map = {} + for (tile_id, path) in ref_map.items(): + ds = gdal.Open(path, gdalconst.GA_ReadOnly) + + ref_extent_map[tile_id] = get_extent(ds) + + tile_srs = osr.SpatialReference() + tile_srs.ImportFromWkt(ds.GetProjection()) + ref_srs_map[tile_id] = tile_srs weekly_composites = [] backscatter_groups = defaultdict(list) @@ -911,15 +999,17 @@ def process_radar(config, conn, pool): hdrs.append(product.path) tile_ref = ref_map.get(group.tile_id) - if tile_ref is None: + tile_srs = ref_srs_map.get(group.tile_id) + tile_extent = ref_extent_map.get(group.tile_id) + if tile_ref is None or tile_srs is None or tile_extent is None: continue output = os.path.join(config.path, group.format(config.site_id)) + temp = os.path.splitext(output)[0] + "_TMP.tif" - geog = tiles[group.tile_id] - (xmin, xmax, ymin, ymax) = geog.GetEnvelope() - - composite = WeeklyComposite(output, tile_ref, xmin, xmax, ymin, ymax, hdrs) + epsg_code = tiles[group.tile_id][1] + (xmin, xmax, ymin, ymax) = tiles_input_srs[group.tile_id].GetEnvelope() + composite = WeeklyComposite(output, temp, tile_ref, xmin, xmax, ymin, ymax, epsg_code, tile_srs, tile_extent, hdrs) weekly_composites.append(composite) if group.product_type == PRODUCT_TYPE_ID_BCK: @@ -1038,8 +1128,7 @@ def generate_headers(date_file, headers_mean, headers_dev): dt = epoch_days_to_date(days) dates.append(dt) - # bands = ["b3", "b4", "b8", "b11", "b5", "b6", "b7", "b8a", "ndvi", "ndwi", "brightness"] - bands = ["b3", "b4", "b8", "b11", "ndvi", "ndwi", "brightness"] + bands = ["b3", "b4", "b8", "b11", "b5", "b6", "b7", "b8a", "ndvi", "ndwi", "brightness"] with open(headers_mean, "w") as file: file.write("NewID") diff --git a/scripts/crop-type-wrapper.py b/scripts/crop-type-wrapper.py index 8b1a89d3..f1185707 100755 --- a/scripts/crop-type-wrapper.py +++ b/scripts/crop-type-wrapper.py @@ -99,13 +99,19 @@ def main(): parser.add_argument('--out-path', default='.', help="output path") parser.add_argument('--working-path', default='.', help="working path") parser.add_argument('--tiles', default=None, nargs="+", help="tile filter") - parser.add_argument('--training-ratio', type=float, help="training/total samples ratio", default=0.5) - parser.add_argument('--num-trees', type=int, help="number of RF trees", default=300) - parser.add_argument('--sample-size', type=float, help="sample size", default=0.2) - parser.add_argument('--count-threshold', type=int, help="count threshold", default=1000) - parser.add_argument('--count-min', type=int, help="minimum count", default=10) + parser.add_argument('--lc', help="LC classes to assess", default='1234') + parser.add_argument('--min-s2-pix', type=int, help="minimum number of S2 pixels", default=3) + parser.add_argument('--min-s1-pix', type=int, help="minimum number of S1 pixels", default=1) + parser.add_argument('--best-s2-pix', type=int, help="minimum number of S2 pixels for parcels to use in training", default=10) + parser.add_argument('--pa-min', type=int, help="minimum parcels to assess a crop type", default=30) + parser.add_argument('--pa-train-h', type=int, help="upper threshold for parcel counts by crop type", default=4000) + parser.add_argument('--pa-train-l', type=int, help="lower threshold for parcel counts by crop type", default=1100) + parser.add_argument('--sample-ratio-h', type=int, help="training ratio for common crop types", default=0.25) + parser.add_argument('--sample-ratio-l', type=int, help="training ratio for uncommon crop types", default=0.75) parser.add_argument('--smote-target', type=int, help="target sample count for SMOTE", default=1000) parser.add_argument('--smote-k', type=int, help="number of SMOTE neighbours", default=5) + parser.add_argument('--num-trees', type=int, help="number of RF trees", default=300) + parser.add_argument('--min-node-size', type=int, help="minimum node size", default=10) args = parser.parse_args() @@ -190,14 +196,22 @@ def main(): command += [os.path.join(args.working_path, "features/optical-features.csv")] command += [os.path.join(args.working_path, "features/sar-temporal.csv")] command += [os.path.join(lpis_path, "parcels.csv")] - command += [args.training_ratio] + command += ["CTnumL4A"] + command += [args.lc] + command += ["Area_meters"] + command += [args.min_s2_pix] + command += [args.min_s1_pix] + command += [args.pa_min] + command += [args.best_s2_pix] + command += [args.pa_train_h] + command += [args.pa_train_l] + command += [args.sample_ratio_h] + command += [args.sample_ratio_l] command += ["Smote"] - command += [args.num_trees] - command += [args.sample_size] - command += [args.count_threshold] - command += [args.count_min] command += [args.smote_target] command += [args.smote_k] + command += [args.num_trees] + command += [args.min_node_size] run_command(command) diff --git a/scripts/data-preparation.py b/scripts/data-preparation.py index b8bbfa9b..888e1ee6 100755 --- a/scripts/data-preparation.py +++ b/scripts/data-preparation.py @@ -23,6 +23,10 @@ from ConfigParser import ConfigParser +PRODUCT_TYPE_LPIS = 14 +PROCESSOR_LPIS = 8 + + class Config(object): def __init__(self, args): parser = ConfigParser() @@ -35,7 +39,6 @@ def __init__(self, args): self.password = parser.get("Database", "Password") self.site_id = args.site_id - self.path = args.path self.tiles = args.tiles @@ -112,6 +115,7 @@ def prepare_lpis(conn, lpis_table, lut_table, tiles): with conn.cursor() as cursor: lpis_pkey_name = Identifier("{}_pkey".format(lpis_table)) lut_pkey_name = Identifier("{}_pkey".format(lut_table)) + lut_key_name = Identifier("{}_ori_crop_key".format(lut_table)) idx_name = Identifier("idx_{}_wkb_geometry".format(lpis_table)) lpis_table_str = Literal(lpis_table) lpis_table = Identifier(lpis_table) @@ -121,9 +125,14 @@ def prepare_lpis(conn, lpis_table, lut_table, tiles): """ alter table {} drop column ogc_fid, - add constraint {} primary key(ori_crop) + alter column ctnum type int using ctnum :: int, + alter column ctnum set not null, + alter column lc type int using lc :: int, + alter column lc set not null, + add constraint {} primary key(ctnum), + add constraint {} unique(ori_crop) """ - ).format(lut_table, lut_pkey_name) + ).format(lut_table, lut_pkey_name, lut_key_name) print(query.as_string(conn)) cursor.execute(query) conn.commit() @@ -147,7 +156,7 @@ def prepare_lpis(conn, lpis_table, lut_table, tiles): from ( select ogc_fid, row_number() over (order by ogc_fid) as new_id, - row_number() over (order by ori_hold) as hold_id + dense_rank() over (order by ori_hold) as hold_id from {} ) t where t.ogc_fid = {}.ogc_fid @@ -157,7 +166,6 @@ def prepare_lpis(conn, lpis_table, lut_table, tiles): cursor.execute(query) conn.commit() - lpis_pkey_name = Identifier("{}_pkey".format(lpis_table)) query = SQL( """ alter table {} @@ -294,25 +302,25 @@ def prepare_lpis(conn, lpis_table, lut_table, tiles): if col_type != 'text': query = SQL( """ - update {} - set "CTnum" = {}.ctnum :: int, - "CT" = {}.ct, - "LC" = {}.lc :: int - from {} - where {}.ori_crop = {}.ori_crop :: text + update {} lpis + set "CTnum" = lut.ctnum, + "CT" = lut.ct, + "LC" = lut.lc + from {} lut + where lut.ori_crop = lpis.ori_crop :: text """ - ).format(lpis_table, lut_table, lut_table, lut_table, lut_table, lut_table, lpis_table) + ).format(lpis_table, lut_table) else: query = SQL( """ - update {} - set "CTnum" = {}.ctnum :: int, - "CT" = {}.ct, - "LC" = {}.lc :: int - from {} - where {}.ori_crop = {}.ori_crop + update {} lpis + set "CTnum" = lut.ctnum, + "CT" = lut.ct, + "LC" = lut.lc + from {} lut + where lut.ori_crop = lpis.ori_crop """ - ).format(lpis_table, lut_table, lut_table, lut_table, lut_table, lut_table, lpis_table) + ).format(lpis_table, lut_table) print(query.as_string(conn)) cursor.execute(query) @@ -380,6 +388,26 @@ def get_site_tiles(conn, site_id): return result +def get_lpis_path(conn, site_id): + with conn.cursor() as cursor: + query = SQL( + """ + select value + from sp_get_parameters('processor.lpis.path') + where site_id is null or site_id = {} + order by site_id + """ + ) + query = query.format(Literal(site_id)) + print(query.as_string(conn)) + cursor.execute(query) + + path = cursor.fetchone()[0] + conn.commit() + + return path + + def read_counts_csv(path): counts = {} @@ -407,7 +435,6 @@ def main(): parser = argparse.ArgumentParser(description="Crops and recompresses S1 L2A products") parser.add_argument('-c', '--config-file', default='/etc/sen2agri/sen2agri.conf', help="configuration file location") parser.add_argument('-s', '--site-id', type=int, help="site ID to filter by") - parser.add_argument('-p', '--path', default='.', help="working path") parser.add_argument('-y', '--year', help="year") parser.add_argument('--force', help="overwrite field", action='store_true') parser.add_argument('--tiles', nargs='+', help="tile filter") @@ -430,9 +457,42 @@ def main(): with psycopg2.connect(host=config.host, port=config.port, dbname=config.dbname, user=config.user, password=config.password) as conn: site_name = get_site_name(conn, config.site_id) year = args.year or date.today().year + dt = date(year, 1, 1) lpis_table = "decl_{}_{}".format(site_name, year) lut_table = "lut_{}_{}".format(site_name, year) + lpis_path = get_lpis_path(conn, config.site_id) + lpis_path = lpis_path.replace('{site}', site_name) + try: + os.makedirs(lpis_path) + except OSError: + pass + + print("Clearing existing data...") + with conn.cursor() as cursor: + sql = SQL( + """ + delete from product + where site_id = {} + and product_type_id = {} + and created_timestamp = {} + """ + ) + sql = sql.format(Literal(config.site_id), Literal(PRODUCT_TYPE_LPIS), Literal(dt)) + print(sql.as_string(conn)) + cursor.execute(sql) + conn.commit() + + sql = SQL( + """ + drop table if exists {}, {} + """ + ) + sql = sql.format(Identifier(lpis_table), Identifier(lut_table)) + print(sql.as_string(conn)) + cursor.execute(sql) + conn.commit() + print("Importing LPIS...") commands = [] commands.append(get_import_table_command(pg_path, args.input, "-lco", "UNLOGGED=YES", "-lco", "SPATIAL_INDEX=OFF", "-nlt", "MULTIPOLYGON", "-nln", lpis_table)) @@ -464,7 +524,7 @@ def main(): satellite = "S1" output = "{}_{}_{}.tif".format(base, tile.tile_id, satellite) - output = os.path.join(args.path, output) + output = os.path.join(lpis_path, output) zone_srs = osr.SpatialReference() zone_srs.ImportFromEPSG(tile.epsg_code) @@ -481,7 +541,8 @@ def main(): select {}, ST_Buffer(ST_Transform({}, epsg_code), {}) from {}, transformed where ST_Intersects({}, transformed.geom); - """) + """ + ) sql = sql.format(Literal(schema), Literal(lpis_table), Literal(column), Literal(tile.tile_id), Identifier(field), Identifier(column), Literal(int(-resolution / 2)), @@ -500,17 +561,17 @@ def main(): class_counts_20m = [] for tile in tiles: output = "{}_{}_S2.tif".format(base, tile.tile_id) - output = os.path.join(args.path, output) + output = os.path.join(lpis_path, output) counts = "counts_{}.csv".format(tile.tile_id) - counts = os.path.join(args.path, counts) + counts = os.path.join(lpis_path, counts) class_counts.append(counts) output_20m = "{}_{}_S1.tif".format(base, tile.tile_id) - output_20m = os.path.join(args.path, output_20m) + output_20m = os.path.join(lpis_path, output_20m) counts_20m = "counts_{}_20m.csv".format(tile.tile_id) - counts_20m = os.path.join(args.path, counts_20m) + counts_20m = os.path.join(lpis_path, counts_20m) class_counts_20m.append(counts_20m) compute_class_counts = ComputeClassCountsCommand(output, counts) @@ -523,10 +584,10 @@ def main(): print("Merging pixel counts...") commands = [] counts = "counts.csv" - counts = os.path.join(args.path, counts) + counts = os.path.join(lpis_path, counts) counts_20m = "counts_20m.csv" - counts_20m = os.path.join(args.path, counts_20m) + counts_20m = os.path.join(lpis_path, counts_20m) merge_class_counts = MergeClassCountsCommand(class_counts, counts) commands.append(merge_class_counts) @@ -551,7 +612,8 @@ def main(): set "S2Pix" = %s, "S1Pix" = %s where {} = %s - """) + """ + ) sql = sql.format(Identifier(lpis_table), Identifier(field)) sql = sql.as_string(conn) @@ -560,6 +622,60 @@ def main(): psycopg2.extras.execute_batch(cursor, sql, args, page_size=1000) conn.commit() + sql = SQL( + """ + update {} + set "S2Pix" = coalesce("S2Pix", 0), + "S1Pix" = coalesce("S1Pix", 0) + where "S2Pix" is null or "S1Pix" is null; + """ + ) + sql = sql.format(Identifier(lpis_table)) + print(sql.as_string(conn)) + cursor.execute(sql) + conn.commit() + + sql = SQL( + """ + alter table {} + alter column "S2Pix" set not null, + alter column "S1Pix" set not null; + """ + ) + sql = sql.format(Identifier(lpis_table)) + print(sql.as_string(conn)) + cursor.execute(sql) + conn.commit() + + tiles = [t.tile_id for t in tiles] + sql = SQL( + """ + insert into product(product_type_id, processor_id, site_id, name, full_path, created_timestamp, tiles) + values({}, {}, {}, {}, {}, {}, {}) + """ + ) + name = os.path.basename(lpis_path) + sql = sql.format(Literal(PRODUCT_TYPE_LPIS), Literal(PROCESSOR_LPIS), Literal(config.site_id), Literal(name), Literal(lpis_path), Literal(dt), Literal(tiles)) + print(sql.as_string(conn)) + cursor.execute(sql) + conn.commit() + + command = [] + command += ["export-lpis.py"] + command += ["-s", config.site_id] + command += ["-p", lpis_path] + run_command(command) + + output = "parcels.csv" + output = os.path.join(lpis_path, output) + + command = [] + command += ["extract-parcels.py"] + command += ["-s", config.site_id] + command += ["-y", year] + command += [output] + run_command(command) + if __name__ == "__main__": main() diff --git a/scripts/export-lpis.py b/scripts/export-lpis.py index 7f8415cc..1d009b49 100755 --- a/scripts/export-lpis.py +++ b/scripts/export-lpis.py @@ -4,6 +4,8 @@ import argparse from datetime import date import multiprocessing.dummy +import os.path +from osgeo import osr import pipes import psycopg2 from psycopg2.sql import SQL, Literal, Identifier @@ -80,12 +82,18 @@ def get_site_epsg_codes(conn, site_id): result = [] for (epsg_code, ) in rows: - print(epsg_code) result.append(epsg_code) return result +def get_esri_wkt(epsg_code): + srs = osr.SpatialReference() + srs.ImportFromEPSG(epsg_code) + srs.MorphToESRI() + return srs.ExportToWkt() + + def main(): parser = argparse.ArgumentParser(description="Crops and recompresses S1 L2A products") parser.add_argument('-c', '--config-file', default='/etc/sen2agri/sen2agri.conf', help="configuration file location") @@ -110,17 +118,32 @@ def main(): commands = [] - gpkg_name = "{}.gpkg".format(lpis_table) + csv = "{}.csv".format(lpis_table) + csv = os.path.join(args.path, csv) + command = [] command += ["ogr2ogr"] - command += [gpkg_name] + command += [csv] command += [pg_path, lpis_table] commands.append(command) epsg_codes = get_site_epsg_codes(conn, config.site_id) + epsg_codes.append(3035) + for epsg_code in epsg_codes: + wkt = get_esri_wkt(epsg_code) + for buf in [5, 10]: + if buf == 2 and epsg_code == 3035: + continue + output = "{}_{}_buf_{}m.shp".format(lpis_table, epsg_code, buf) + output = os.path.join(args.path, output) + prj = "{}_{}_buf_{}m.prj".format(lpis_table, epsg_code, buf) + prj = os.path.join(args.path, prj) + + with open(prj, 'wb') as f: + f.write(wkt) sql = SQL( """ diff --git a/scripts/export-product.py b/scripts/export-product.py new file mode 100755 index 00000000..a61bf6dc --- /dev/null +++ b/scripts/export-product.py @@ -0,0 +1,227 @@ +#!/usr/bin/env python +from __future__ import print_function + +import argparse +import csv +from collections import defaultdict +from datetime import date +from glob import glob +import multiprocessing.dummy +import os +import os.path +from osgeo import osr +from osgeo import ogr +import pipes +import psycopg2 +from psycopg2.sql import SQL, Literal, Identifier +import psycopg2.extras +import subprocess +import sys + + +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser + + +PRODUCT_TYPE_CROP_TYPE = 4 +PRODUCT_TYPE_AGRICULTURAL_PRACTICES = 6 + +PRACTICE_NA = 1 +PRACTICE_CATCH_CROP = 2 +PRACTICE_NFC = 3 +PRACTICE_FALLOW = 4 + + +def get_practice_name(practice_id): + if practice_id == PRACTICE_NA: + return "NA" + elif practice_id == PRACTICE_CATCH_CROP: + return "CatchCrop" + elif practice_id == PRACTICE_NFC: + return "NFC" + elif practice_id == PRACTICE_FALLOW: + return "Fallow" + else: + return None + + +class Config(object): + def __init__(self, args): + parser = ConfigParser() + parser.read([args.config_file]) + + self.host = parser.get("Database", "HostName") + self.port = int(parser.get("Database", "Port", vars={"Port": "5432"})) + self.dbname = parser.get("Database", "DatabaseName") + self.user = parser.get("Database", "UserName") + self.password = parser.get("Database", "Password") + + +def get_product_info(conn, product_id): + with conn.cursor() as cursor: + query = SQL( + """ + select + product_type_id, + created_timestamp, + short_name + from product + inner join site on site.id = product.site_id + where product.id = {} + """ + ) + query = query.format(Literal(product_id)) + print(query.as_string(conn)) + + cursor.execute(query) + row = cursor.fetchone() + conn.commit() + return row + + +def get_export_table_command(destination, source, *options): + command = [] + command += ["ogr2ogr"] + command += options + command += [destination, source] + return command + + +def run_command(args, env=None): + args = list(map(str, args)) + cmd_line = " ".join(map(pipes.quote, args)) + print(cmd_line) + subprocess.call(args, env=env) + + +def export_crop_type(conn, pg_path, product_id, lpis_table, path): + query = SQL( + """ + select + lpis.*, + ct."CT_decl", + ct."CT_pred_1", + ct."CT_conf_1", + ct."CT_pred_2", + ct."CT_conf_2" + from {} lpis + left outer join product_details_l4a ct on (ct."NewID", ct.product_id) = (lpis."NewID", {}) + """ + ).format(Identifier(lpis_table), Literal(product_id)) + query = query.as_string(conn) + + name = os.path.splitext(os.path.basename(path))[0] + command = get_export_table_command(path, pg_path, "-nln", name, "-sql", query, "-gt", 100000) + run_command(command) + + +def export_agricultural_practices(conn, pg_path, product_id, lpis_table, path): + practices = [] + with conn.cursor() as cursor: + query = SQL( + """ + select distinct practice_id + from product_details_l4c + where product_id = {} + """ + ) + query = query.format(Literal(product_id)) + print(query.as_string(conn)) + + cursor.execute(query) + for row in cursor: + practices.append(row[0]) + conn.commit() + + for practice_id in practices: + query = SQL( + """ + select + lpis.*, + orig_id as "ORIG_ID", + country as "COUNTRY", + year as "YEAR", + main_crop as "MAIN_CROP", + veg_start as "VEG_START", + h_start as "H_START", + h_end as "H_END", + practice as "PRACTICE", + p_type as "P_TYPE", + p_start as "P_START", + p_end as "P_END", + l_week as "L_WEEK", + m1 as "M1", + m2 as "M2", + m3 as "M3", + m4 as "M4", + m5 as "M5", + h_week as "H_WEEK", + h_w_start as "H_W_START", + h_w_end as "H_W_END", + h_w_s1 as "H_W_S1", + m6 as "M6", + m7 as "M7", + m8 as "M8", + m9 as "M9", + m10 as "M10", + c_index as "C_INDEX", + s1_pix as "S1PIX", + s1_gaps as "S1GAPS", + h_s1_gaps as "H_S1GAPS", + p_s1_gaps as "P_S1GAPS" + from product_details_l4c ap + inner join {} lpis on lpis."NewID" = ap."NewID" + where (ap.product_id, ap.practice_id) = ({}, {}) + """ + ).format(Identifier(lpis_table), Literal(product_id), Literal(practice_id)) + query = query.as_string(conn) + + practice_name = get_practice_name(practice_id) + if not practice_name: + print("Unknown practice id {}".format(practice_id)) + sys.exit(1) + + (dir, name) = (os.path.dirname(path), os.path.basename(path)) + name = name.replace("PRACTICE", practice_name) + + file = os.path.join(dir, name) + table_name = os.path.splitext(name)[0].lower() + command = get_export_table_command(file, pg_path, "-nln", table_name, "-sql", query, "-gt", 100000) + run_command(command) + + +def main(): + parser = argparse.ArgumentParser(description="Exports product contents from the database") + parser.add_argument('-c', '--config-file', default='/etc/sen2agri/sen2agri.conf', help="configuration file location") + parser.add_argument('-p', '--product-id', type=int, help="product id") + parser.add_argument('output', help="output path") + + args = parser.parse_args() + + config = Config(args) + + pg_path = 'PG:dbname={} host={} port={} user={} password={}'.format(config.dbname, config.host, + config.port, config.user, config.password) + + with psycopg2.connect(host=config.host, port=config.port, dbname=config.dbname, user=config.user, password=config.password) as conn: + r = get_product_info(conn, args.product_id) + if r is None: + print("Invalid product id {}".format(args.product_id)) + return 1 + + (product_type, created_timestamp, site_short_name) = r + lpis_table = "decl_{}_{}".format(site_short_name, created_timestamp.year) + + if product_type == PRODUCT_TYPE_CROP_TYPE: + export_crop_type(conn, pg_path, args.product_id, lpis_table, args.output) + elif product_type == PRODUCT_TYPE_AGRICULTURAL_PRACTICES: + export_agricultural_practices(conn, pg_path, args.product_id, lpis_table, args.output) + else: + print("Unknown product type {}".format(product_type)) + return 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/extract-parcels.py b/scripts/extract-parcels.py index 7588fb3e..5424b02b 100755 --- a/scripts/extract-parcels.py +++ b/scripts/extract-parcels.py @@ -53,7 +53,7 @@ def save_to_csv(cursor, path): with open(path, 'wb') as csvfile: writer = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL) - writer.writerow(['NewID', 'AREA', 'CTnum', 'LC']) + writer.writerow(['NewID', 'Area_meters', 'S1Pix', 'S2Pix', 'CTnumL4A', 'LC']) for row in cursor: writer.writerow(row) @@ -62,15 +62,14 @@ def extract_parcels(config, args, lpis_table, lut_table, id, geom): with psycopg2.connect(host=config.host, port=config.port, dbname=config.dbname, user=config.user, password=config.password) as conn: q1 = """ select lpis."NewID", - lpis."Area_meters" as "AREA", - lut."ctnuml4a" as "CTnum", + lpis."Area_meters", + lpis."S1Pix", + lpis."S2Pix", + lut."ctnuml4a" as "CTnumL4A", lpis."LC" from {} lpis - inner join {} lut on lut.ctnum :: int = lpis."CTnum" - where lpis."LC" = any({}) - and lpis."S1Pix" >= {} - and lpis."S2Pix" >= {} - and "GeomValid" + inner join {} lut on lut.ctnum = lpis."CTnum" + where "GeomValid" and not "Duplic" and not "Overlap" order by "NewID" @@ -80,16 +79,15 @@ def extract_parcels(config, args, lpis_table, lut_table, id, geom): select ST_Transform(ST_GeomFromText({}, {}), Find_SRID('public', {}, 'wkb_geometry')) as geom ) select lpis."NewID", - lpis."Area_meters" as "AREA", - lut."ctnuml4a" as "CTnum", + lpis."Area_meters", + lpis."S1Pix", + lpis."S2Pix", + lut."ctnuml4a" as "CTnumL4A", lpis."LC" from stratum inner join {} lpis on lpis.wkb_geometry && stratum.geom and ST_Relate(lpis.wkb_geometry, stratum.geom, '2********') - inner join {} lut on lut.ctnum :: int = lpis."CTnum" - where lpis."LC" = any({}) - and lpis."S1Pix" >= {} - and lpis."S2Pix" >= {} - and "GeomValid" + inner join {} lut on lut.ctnum = lpis."CTnum" + where "GeomValid" and not "Duplic" and not "Overlap" order by "NewID" @@ -98,7 +96,7 @@ def extract_parcels(config, args, lpis_table, lut_table, id, geom): with conn.cursor() as cursor: if args.strata is None: output = args.output - query = SQL(q1).format(Identifier(lpis_table), Identifier(lut_table), Literal(args.lc), Literal(args.min_s1_pix), Literal(args.min_s2_pix)) + query = SQL(q1).format(Identifier(lpis_table), Identifier(lut_table)) print(query.as_string(conn)) cursor.execute(query) @@ -109,7 +107,7 @@ def extract_parcels(config, args, lpis_table, lut_table, id, geom): basename = os.path.basename(args.output) split = os.path.splitext(basename) - query = SQL(q2).format(Literal(geom.ExportToWkt()), Literal(args.srid), Literal(lpis_table), Identifier(lpis_table), Identifier(lut_table), Literal(args.lc), Literal(args.min_s1_pix), Literal(args.min_s2_pix)) + query = SQL(q2).format(Literal(geom.ExportToWkt()), Literal(args.srid), Literal(lpis_table), Identifier(lpis_table), Identifier(lut_table)) print(query.as_string(conn)) @@ -124,9 +122,6 @@ def main(): parser.add_argument('-c', '--config-file', default='/etc/sen2agri/sen2agri.conf', help="configuration file location") parser.add_argument('-s', '--site-id', type=int, help="site ID to filter by") parser.add_argument('-y', '--year', help="year") - parser.add_argument('--lc', help="LC values", nargs='+', type=int, default=[1, 2, 3, 4]) - parser.add_argument('--min-s1-pix', help="minimum number of S1 pixels", type=int, default=1) - parser.add_argument('--min-s2-pix', help="minimum number of S2 pixels", type=int, default=3) parser.add_argument('--strata', help="strata definition") parser.add_argument('--srid', help="strata SRID") parser.add_argument('output', help="output file", default="parcels.csv") diff --git a/scripts/import-product-details.py b/scripts/import-product-details.py new file mode 100755 index 00000000..304d7c5f --- /dev/null +++ b/scripts/import-product-details.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python +from __future__ import print_function + +import argparse +import csv +from collections import defaultdict +from datetime import date +from glob import glob +import multiprocessing.dummy +import os +import os.path +from osgeo import osr +from osgeo import ogr +import pipes +import psycopg2 +from psycopg2.sql import SQL, Literal, Identifier +import psycopg2.extras +import subprocess +import sys + + +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser + + +PRODUCT_TYPE_CROP_TYPE = 4 +PRODUCT_TYPE_AGRICULTURAL_PRACTICES = 6 + +PRACTICE_NA = 1 +PRACTICE_CATCH_CROP = 2 +PRACTICE_NFC = 3 +PRACTICE_FALLOW = 4 + + +class Config(object): + def __init__(self, args): + parser = ConfigParser() + parser.read([args.config_file]) + + self.host = parser.get("Database", "HostName") + self.port = int(parser.get("Database", "Port", vars={"Port": "5432"})) + self.dbname = parser.get("Database", "DatabaseName") + self.user = parser.get("Database", "UserName") + self.password = parser.get("Database", "Password") + + +def get_product_info(conn, product_id): + with conn.cursor() as cursor: + query = SQL( + """ + select product_type_id, full_path + from product + where id = {} + """ + ) + query = query.format(Literal(product_id)) + print(query.as_string(conn)) + + cursor.execute(query) + row = cursor.fetchone() + conn.commit() + return row + + +def get_practice(name): + if name == "NA": + return PRACTICE_NA + elif name == "CatchCrop": + return PRACTICE_CATCH_CROP + elif name == "NFC": + return PRACTICE_NFC + elif name == "Fallow": + return PRACTICE_FALLOW + else: + return None + + +def get_import_table_command(destination, source, *options): + command = [] + command += ["ogr2ogr"] + command += options + command += [destination, source] + return command + + +def run_command(args, env=None): + args = list(map(str, args)) + cmd_line = " ".join(map(pipes.quote, args)) + print(cmd_line) + subprocess.call(args, env=env) + + +def drop_table(conn, name): + with conn.cursor() as cursor: + query = SQL( + """ + drop table if exists {} + """ + ).format(Identifier(name)) + print(query.as_string(conn)) + cursor.execute(query) + conn.commit() + + +def import_crop_type(conn, pg_path, product_id, path): + path = os.path.join(path, "VECTOR_DATA", "*.csv") + for file in glob(path): + table_name = "pd_ct_staging_{}".format(product_id) + + drop_table(conn, table_name) + + command = get_import_table_command(pg_path, file, "-nln", table_name, "-gt", 100000, "-lco", "UNLOGGED=YES", "-oo", "AUTODETECT_TYPE=YES") + run_command(command) + + with conn.cursor() as cursor: + query = SQL( + """ + insert into product_details_l4a( + product_id, + "NewID", + "CT_decl", + "CT_pred_1", + "CT_conf_1", + "CT_pred_2", + "CT_conf_2" + ) + select + {}, + newid, + ct_decl, + ct_pred_1, + ct_conf_1, + ct_pred_2, + ct_conf_2 + from {} + """ + ).format(Literal(product_id), Identifier(table_name)) + print(query.as_string(conn)) + cursor.execute(query) + conn.commit() + + drop_table(conn, table_name) + + +def import_agricultural_practices(conn, pg_path, product_id, path): + path = os.path.join(path, "VECTOR_DATA", "*.csv") + for file in glob(path): + practice = os.path.basename(file).split("_")[2] + practice_id = get_practice(practice) + + if not practice_id: + print("Unknown practice {}".format(practice)) + sys.exit(1) + + table_name = "pd_ap_staging_{}_{}".format(product_id, practice.lower()) + + drop_table(conn, table_name) + + command = get_import_table_command(pg_path, file, "-nln", table_name, "-gt", 100000, "-lco", "UNLOGGED=YES") + run_command(command) + + with conn.cursor() as cursor: + query = SQL( + """ + insert into product_details_l4c( + product_id, + "NewID", + practice_id, + orig_id, + country, + year, + main_crop, + veg_start, + h_start, + h_end, + practice, + p_type, + p_start, + p_end, + l_week, + m1, + m2, + m3, + m4, + m5, + h_week, + h_w_start, + h_w_end, + h_w_s1, + m6, + m7, + m8, + m9, + m10, + c_index, + s1_pix, + s1_gaps, + h_s1_gaps, + p_s1_gaps + ) + select + {}, + field_id :: int, + {}, + orig_id, + country, + year :: int, + main_crop, + veg_start, + h_start, + h_end, + practice, + p_type, + p_start, + p_end, + l_week, + m1, + m2, + m3, + m4, + m5, + h_week, + h_w_start, + h_w_end, + h_w_s1, + m6, + m7, + m8, + m9, + m10, + c_index, + s1pix, + s1gaps, + h_s1gaps, + p_s1gaps + from {} + """ + ).format(Literal(product_id), Literal(practice_id), Identifier(table_name)) + print(query.as_string(conn)) + cursor.execute(query) + conn.commit() + + drop_table(conn, table_name) + + +def main(): + parser = argparse.ArgumentParser(description="Imports product contents into the database") + parser.add_argument('-c', '--config-file', default='/etc/sen2agri/sen2agri.conf', help="configuration file location") + parser.add_argument('-p', '--product-id', type=int, help="product id") + + args = parser.parse_args() + + config = Config(args) + + pg_path = 'PG:dbname={} host={} port={} user={} password={}'.format(config.dbname, config.host, + config.port, config.user, config.password) + + with psycopg2.connect(host=config.host, port=config.port, dbname=config.dbname, user=config.user, password=config.password) as conn: + r = get_product_info(conn, args.product_id) + if r is None: + print("Invalid product id {}".format(args.product_id)) + return 1 + (product_type, path) = r + + if product_type == PRODUCT_TYPE_CROP_TYPE: + import_crop_type(conn, pg_path, args.product_id, path) + elif product_type == PRODUCT_TYPE_AGRICULTURAL_PRACTICES: + import_agricultural_practices(conn, pg_path, args.product_id, path) + else: + print("Unknown product type {}".format(product_type)) + return 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/merge-sar.py b/scripts/merge-sar.py index 939ac036..9aeca338 100755 --- a/scripts/merge-sar.py +++ b/scripts/merge-sar.py @@ -217,10 +217,6 @@ def main(): polarization = get_polarization(m.group(6)) type = get_type(m.group(7)) - # ignore absolute amplitudes for now - if type == TYPE_BACKSCATTER and polarization != POLARIZATION_RATIO: - continue - group = TileGroup(prefix, period_type, period, orbit_type, polarization, type, name) tile_groups[tile_id].append(group) all_groups.add(group) diff --git a/sen2agri-processors/CMakeLists.txt b/sen2agri-processors/CMakeLists.txt index e3041b93..2e43d164 100644 --- a/sen2agri-processors/CMakeLists.txt +++ b/sen2agri-processors/CMakeLists.txt @@ -41,6 +41,9 @@ install(FILES ../scripts/insert_l2a_product_to_db.py ../scripts/filter_site_download_tiles.py ../scripts/optimize_gtiff.py ../scripts/export-lpis.py + ../scripts/extract-parcels.py + ../scripts/import-product-details.py + ../scripts/export-product.py ../scripts/crop-type-parcels.py ../scripts/crop-type-wrapper.py ../scripts/data-preparation.py diff --git a/sen2agri-processors/Sen4CAP/CropType/classification/crop_type.R b/sen2agri-processors/Sen4CAP/CropType/classification/crop_type.R index b1f98235..4fdff912 100755 --- a/sen2agri-processors/Sen4CAP/CropType/classification/crop_type.R +++ b/sen2agri-processors/Sen4CAP/CropType/classification/crop_type.R @@ -1,4 +1,13 @@ #!/usr/bin/env Rscript +# +# requiredPackages = c("ranger","dplyr","e1071","caret","smotefamily","readr","gsubfn") +# +# for(p in requiredPackages){ +# if(!require(p,character.only = TRUE)) install.packages(p) +# library(p,character.only = TRUE) +# } +# + library(ranger) library(dplyr) library(e1071) @@ -7,8 +16,8 @@ library(smotefamily) library(readr) library(gsubfn) +## Implement variables -#Implement variables variable <- commandArgs(trailingOnly=TRUE) print(variable) workdir <- variable[1] #transform to numeric !! @@ -16,56 +25,59 @@ InputSAR <- variable[2] InputOpt <- variable[3] InputSAR_tempStats <- variable[4] Shape_filename <- variable[5] -training_ratio <- as.numeric(variable[6]) -samplingmethod <-variable[7] -numtrees <- as.numeric(variable[8]) -sample_size <- as.numeric(variable[9]) -count_thresh <- as.numeric(variable[10]) -count_min <- as.numeric(variable[11]) -smotesize <- as.numeric(variable[12]) -k <- as.numeric(variable[13]) +TARGET <- variable[6] +LC_monitored <- variable[7] +AreaDeclared <- variable[8] +S2pixMIN <- as.numeric(variable[9]) +S1pixMIN <- as.numeric(variable[10]) +PaMIN <- as.numeric(variable[11]) +S2pixBEST <- as.numeric(variable[12]) +PaCalibH <- as.numeric(variable[13]) +PaCalibL <- as.numeric(variable[14]) +Sample_ratioH <- as.numeric(variable[15]) +Sample_ratioL <- as.numeric(variable[16]) +samplingmethod <-variable[17] +smotesize <- as.numeric(variable[18]) +k <- as.numeric(variable[19]) +numtrees <- as.numeric(variable[20]) +min_node_size <- as.numeric(variable[21]) + +## Check if parameteres correctly defined: LC and samplingmethod + +if (!(LC_monitored %in% c(1,2,3,4,5,0,"All","123","1234"))) { + stop("Wrong argument: choose out of (1,2,3,4,5,0,'All','123','1234')", call.=FALSE) +} + +if(LC_monitored=="All") landcover=c(1,2,3,4,5) +if(LC_monitored=="1234") landcover=c(1,2,3,4) +if(LC_monitored=="123") landcover=c(1,2,3) +print(paste0("Monitored land cover classes are:",landcover)) if (!(samplingmethod %in% c("Random","Areaweighted","Overareaweighted","Overunderareaweighted","Smote","Fixunder"))) { stop('Wrong argument: choose out of "Random","Areaweighted","Overareaweighted","Overunderareaweighted","Smote","Fixunder"', call.=FALSE) } -# -# samplingmethod=c("Random","Areaweighted","Overareaweighted","Overunderareaweighted","Smote") -# samplingmethod=samplingmethod[1] -# #Random is a random sampling among the NewIDs in the calibration subset -# #Areaweighted is a weighted sampling among the calibration dataset based on the area of the whole dataset -# #Overareaweighted //Areaweighted + deleting classes below min and oversampling classes below threshold to threshold number -# #of records (or all the records if count 'sample_size' (>> function of threshold value) -# #Overunderareaweighted //Overareaweighted + undersampling classes above threshold to keep sample_size=sample_size -# #Smote sampling //Overareaweighted with additional artificial observations to ensure all classes reach the threshold value -# -#import features with NewID column as CSV -#import shapefile (nrow = nrow(Features)) as CSV -print("Importing shapefile...") -Shapefile=read_csv(Shape_filename, col_types = "idii") +## Import declaration dataset as csv - if (length(which(names(Shapefile) %in% c("AREA","CTnum","NewID")))!=3) { - stop('Wrong argument: Shapefile names do not contain "AREA","CTnum" and/or "NewID"', call.=FALSE) - } +print("Importing declaration dataset") + +Shapefile=read_csv(Shape_filename,col_types= cols_only(NewID = 'i',HoldID = 'i',GeomValid = 'l',Duplic = 'l',Overlap = 'l',Area_meters = 'd',ShapeInd = 'd',CTnum = 'i',CT = 'c',LC = 'i',S1Pix = 'i',S2Pix = 'i',CTnumL4A = 'i',CTL4A = 'c',CTnumDIV = 'i',CTDIV = 'c',EAA = 'l',AL = 'l',PGrass = 'l',TGrass = 'l',Fallow = 'l',Cwater = 'l')) -names(Shapefile)[which(names(Shapefile)=="CTnum")]="TARGET" +Shapefile$Trajectory <-0 +Shapefile$Purpose <-0 -#remove shapefile rows containing any NAs -#Shapefile[Shapefile==0] <- NA +names(Shapefile)[which(names(Shapefile)==TARGET)]="TARGET" +names(Shapefile)[which(names(Shapefile)==AreaDeclared)]="AreaDeclared" -#print(paste("Removed column from shapefile containing NAs:",Shapefile %>% select_if(~ any(is.na(.))) %>% names())) -#Shapefile = Shapefile %>% select_if(~ !any(is.na(.))) +## Join the optical and SAR data to declaration dataset -#join features and shapefile by "NewID" (RF Features (and no other variable) should start with XX) if (InputSAR==0 & InputOpt!=0) { print("Optical only") print("Importing Opt_Features...") ncol_Optcsv=system(paste("head -1",InputOpt,"| sed 's/[^,]//g' | wc -c"),intern=TRUE) Opt_features=read_csv(InputOpt,col_types=paste0("i",paste(rep("d",as.numeric(ncol_Optcsv)-1),collapse=""))) - Opt_features[Opt_features==0] <- NA - data_joined=inner_join(Shapefile,Opt_features,by="NewID") } else if (InputOpt==0 & InputSAR!=0) { @@ -73,15 +85,11 @@ if (InputSAR==0 & InputOpt!=0) { print("Importing SAR_Features...") SAR_features=read_csv(InputSAR) - SAR_features[SAR_features==0] <- NA - data_joined=inner_join(Shapefile,SAR_features,by="NewID") } else if (InputSAR!=0 & InputOpt!=0 & InputSAR_tempStats!=0){ -#} else if (InputSAR!=0 & InputOpt!=0){ -# print(mem_used()) - print("Optical, SAR and SAR_tempStats ") + print("Optical, SAR and SAR temporal features") print("Importing Opt_Features...") ncol_Optcsv=system(paste("head -1",InputOpt,"| sed 's/[^,]//g' | wc -c"),intern=TRUE) @@ -91,318 +99,191 @@ if (InputSAR==0 & InputOpt!=0) { ncol_SARcsv=system(paste("head -1",InputSAR,"| sed 's/[^,]//g' | wc -c"),intern=TRUE) SAR_features=read_csv(InputSAR,col_types=paste0("i",paste(rep("d",as.numeric(ncol_SARcsv)-1),collapse=""))) - print("Importing SAR Temporal Features...") + print("Importing SAR_Temporal_Features...") ncol_SARcsv=system(paste("head -1",InputSAR_tempStats,"| sed 's/[^,]//g' | wc -c"),intern=TRUE) SAR_tempStats=read_csv(InputSAR_tempStats,col_types=paste0("i",paste(rep("d",as.numeric(ncol_SARcsv)-1),collapse=""))) print("SAR, Optical and SAR temporal features imported successfully") - #print("SAR and Optical features imported successfully") - #print(length(which(Opt_features==0))) - #Opt_features[Opt_features==0] <- NA - #SAR_features[SAR_features==0] <- NA - #SAR_features[SAR_features<0] <- NA - #SAR_tempStats[SAR_tempStats==0] <- NA - #print("Null values replaced by NA in Optical, SAR, and SA temporal data") -#STEP ADDED for Czech site where some images are missing in the timeseries, resutling in features mostly full of NA... - - - #na_count <-sapply(SAR_features, function(y) sum(length(which(is.na(y))))) - #n_parcels=dim(SAR_features)[1] - #n_NA2rm=round(n_parcels*0.5,digits=0) - #n_na_col<-length(which(na_count > n_NA2rm )) - #print(paste("There are",n_na_col,"columns with more than",n_NA2rm,"NA")) - #print("...Removing these columns") - #if (n_na_col != 0){ - #SAR_features=SAR_features[-which(na_count > n_NA2rm)] - #} - - #na_count <-sapply(SAR_tempStats, function(y) sum(length(which(is.na(y))))) - #n_parcels=dim(SAR_tempStats)[1] - #n_NA2rm=round(n_parcels*0.5,digits=0) - #n_na_col<-length(which(na_count > n_NA2rm )) - #print(paste("There are",n_na_col,"columns with more than",n_NA2rm,"NA")) - #print("...Removing these columns") - #if (n_na_col != 0){ - #SAR_tempStats=SAR_tempStats[-which(na_count > n_NA2rm)] - #} - -print("by 1 ok") + data_joined=inner_join(Shapefile,SAR_features,by="NewID") -print("by 2 ok") + +print("join by 1 ok") + data_joined=inner_join(data_joined,Opt_features,by="NewID") -print("by 3 ok") + +print("join by 2 ok") + data_joined=inner_join(data_joined,SAR_tempStats,by="NewID") -print("by 4 ok") + +print("join by 3 ok") + } else if (InputSAR==0 & InputOpt==0){ print("Define SAR or Optical parameters") } data_joined=as.data.frame(data_joined) -print(dim(data_joined)) +print(paste('Dimensions before filtering:',dim(data_joined))) -##check column names i.e. "AREA", "TARGET", +## Filtering steps -# factorize "class" variable +# Filter out data with NAs -#data_joined$TARGET=factor(data_joined$TARGET) -print(paste('Dimensions after filtering by LC:',dim(data_joined))) data_joined=na.omit(data_joined) print(paste('Dimensions after removing NAs:',dim(data_joined))) -rm(SAR_features,Opt_features, SAR_tempStats) -# print(mem_used()) - -#define NewIDS corresponding to validation dataset -#example NL -#valid_ID=as.numeric(data_joined[which(data_joined$Teledetect=='J'|data_joined$NVWA_contr=='J'),"NewID"]) - -#sampling parameters -# sample_size=20000 -# set.seed(42) -# count_thresh=30 -# count_min=10 -# smotesize=50 #number of items to reach (originals + synthetics) for the smote algorithm -# k=5 #number of neighbours for smote algorithm -# -# #main Ranger forest parameters (no modifications allowed here) -# num.trees = 100 ##S2 = 100 #Ranger default=500 -# mtry = NULL ##variables to split (default = sqrt) -# importance = "impurity" ##corresponds to the Gini index -# write.forest = TRUE #required for prediction -# min.node.size = 10 #10 for proba, 1 for classif, 5 or 25 for S2 -# replace = TRUE #sample with replacement -# verbose = TRUE -# seed = 42 -# holdout = FALSE #could use 0 weighted cases for importance and prediction errors -# save.memory = FALSE - - -###Clean data set - -# SAR_features=read.csv("C:/Users/rvanbaalen/Desktop/Netherlands/SAR_features.csv") -# SAR_features=read.csv("/export/miro/rvanbaalen/03_Netherlands/SAR_features.csv") -# SHP_NL=shapefile("C:/Users/rvanbaalen/Desktop/Netherlands/Percelen_BBR_2017_Sen4CAP_tiled_31UFU_UTM_reclass_over5000_buffer15m_minus0.shp") -# SHP_NL=SHP_NL@data -# SHP_NL$NewID=as.numeric(SHP_NL$NewID) -# extract_df=data.frame(extract) -# colnames(extract_df)[1]="NewID" -# print(mem_used()) - -# create calibration and validation datasets -print('Internal validation') -set.seed(42) -trainindex=createDataPartition(data_joined$TARGET, times = 1, p = training_ratio, list = FALSE) -data_valid=data_joined[-trainindex,] -data_calib=data_joined[trainindex,] -print(dim(data_valid)) -print(dim(data_calib)) - -print(paste('Dimensions data_calib:',dim(data_calib))) -print(paste('Dimensions data_valid:',dim(data_valid))) - -if(sample_size==0) sample_size=nrow(data_calib) else sample_size=sample_size -if(sample_size>0 & sample_size<=1) sample_size=round(sample_size*nrow(data_joined)) else sample_size=sample_size -print(sample_size) - -# remove non-features columns -#print(names(data_calib)) -#data_calib_red <- data_calib[c(1, 5:ncol(data_calib), 3)] -data_calib_red <- data_calib %>% dplyr:: select(union(starts_with("NewID"),union(starts_with("XX"),starts_with("TARGET")))) -# print(mem_used()) - -#data=cbind(cid=data_calib$CROPDIVNUM,data) -#data=subset(data_calib,select=-c(X,NewID,fid)) - -##sample data - -#summarize stats for the all dataset and the calibration dataset - -if ( samplingmethod=="Random") { - set.seed(42) - sample_temp=sample_n(data_calib,sample_size) - sample_ID=as.numeric(sample_temp$NewID) - data_calib_red=data_calib_red[which(data_calib$NewID %in% sample_ID),] - - write.csv(sample_ID,paste0(workdir,paste("Calib_NewIDs",sample_size,format(Sys.time(), "%m%d-%H%M"),sep="_"),".csv")) - - - } else if ( samplingmethod=="Areaweighted") { - Sample_areaweighted=NA - - grp_data=group_by(data_joined,TARGET) - nrow=nrow(data_joined) - areatot=sum(as.numeric(data_joined$AREA),na.rm=TRUE) - Declarations_summary = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) - - grp_data=group_by(data_calib,TARGET) - nrow=nrow(data_calib) - areatot=sum(as.numeric(data_calib$AREA),na.rm=TRUE) - Declarations_summary_calib = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) - - Declarations_summary_join=left_join(Declarations_summary_calib,Declarations_summary,by="TARGET",suffix = c(".calib","")) - - - sample_size_area=round(sample_size*Declarations_summary_join$arearatio) - - sample_size_area_corr=ifelse(sample_size_areacount_min) - Declarations_summary_join=Declarations_summary_join[index,] +# Filter out small parcels - index_sample=which((Declarations_summary_join$arearatio*sample_size)= S2pixMIN & S1Pix >= S1pixMIN) +print(paste('Dimensions after filtering out small parcels:',dim(data_joined))) - index=union(index_sample,index_count) +# Filter out crop types with few parcels - index2=which((Declarations_summary_join$arearatio*sample_size)>Declarations_summary_join$count.calib) +dj2 <- count(data_joined,TARGET) +dj3 <- subset(dj2, n >= PaMIN) +ctlist <- dj3[, "TARGET", drop=TRUE] +print(paste('Crop types after filtering out crop types with few parcels:',ctlist)) +data_joined <- subset(data_joined, TARGET %in% ctlist) +print(paste('Dimensions after filtering out crop types with few parcels:',dim(data_joined))) +ctlist2 <- data_joined[, "NewID", drop=TRUE] - temp_area=sum(Declarations_summary_join$area[-index]) - temp_count=ifelse(Declarations_summary_join$count.calib[index]>count_thresh,count_thresh,Declarations_summary_join$count.calib[index]) - temp_size=sample_size-sum(temp_count) +## Selection of best parcels for calibration - factor=sum(Declarations_summary_join$area/temp_area) - sample_size_area_overunder=floor(temp_size*Declarations_summary_join$arearatio*factor) - sample_size_area_overunder[index]=temp_count - sample_size_area_overunder[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] +data_valid1 <- subset(data_joined, S2Pix < S2pixBEST) +print(paste('Dimensions of the first part of the validation dataset with parcels with S2Pix < S2pixBEST:',dim(data_valid1))) - sample_size_area=round(sample_size*Declarations_summary_join$arearatio) +data_calib <- subset(data_joined, S2Pix >= S2pixBEST) +print(paste('Dimensions after selecting best parcels (S2Pix >= S2pixBEST) for calibration:',dim(data_calib))) - sample_size_area_over=ifelse(sample_size_area>sample_size_area_overunder,sample_size_area,sample_size_area_overunder) - sample_size_area_over[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] +# Crop type strategy lists - sample_size_area_over=ifelse(sample_size_area_over>Declarations_summary_join$count.calib,Declarations_summary_join$count.calib,sample_size_area_over) +dc1 <- count(data_calib,TARGET) +print(dc1) - Sample_areaweighted=NA - for (i in 1:nrow(Declarations_summary_join)){ - set.seed(42) - temp=sample_n(data_calib[which(data_calib$TARGET==Declarations_summary_join$TARGET[i]),],sample_size_area_overunder[i]) - Sample_areaweighted=rbind(Sample_areaweighted,temp) - } +strategy1 <- subset(dc1, n >= PaCalibH) +strategy1list <- strategy1[, "TARGET", drop=TRUE] +print(paste("Crop types belonging to strategy 1:",strategy1list)) - sample_ID=as.numeric(Sample_areaweighted$NewID) - data_calib_red=data_calib_red[which(data_calib$NewID %in% sample_ID),] +strategy2 <- subset(dc1, n < PaCalibH & n >= PaCalibL ) +strategy2list <- strategy2[, "TARGET", drop=TRUE] +print(paste("Crop types belonging to strategy 2:",strategy2list)) - write.csv(sample_ID,paste0(workdir,paste("Calib_NewIDs",sample_size,format(Sys.time(), "%m%d-%H%M"),sep="_"),".csv")) +strategy3 <- subset(dc1, n < PaCalibL ) +strategy3list <- strategy3[, "TARGET", drop=TRUE] +print(paste("Crop types belonging to strategy 3:",strategy3list)) +# Strategy 1 +data_strategy1 <- subset(data_calib, TARGET %in% strategy1list) - } else if ( samplingmethod=="Overareaweighted") { - grp_data=group_by(data_joined,TARGET) - nrow=nrow(data_joined) - areatot=sum(as.numeric(data_joined$AREA),na.rm=TRUE) - Declarations_summary = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) +set.seed(42) +trainindex1=createDataPartition(data_strategy1$TARGET, times = 1, p = Sample_ratioH, list = FALSE) +data_strategy1_valid=data_strategy1[-trainindex1,] +data_strategy1_calib=data_strategy1[trainindex1,] - grp_data=group_by(data_calib,TARGET) - nrow=nrow(data_calib) - areatot=sum(as.numeric(data_calib$AREA),na.rm=TRUE) - Declarations_summary_calib = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) +print(paste('Dimensions data_strategy1_valid:',dim(data_strategy1_valid))) +print(paste('Dimensions data_strategy1_calib:',dim(data_strategy1_calib))) - Declarations_summary_join=left_join(Declarations_summary_calib,Declarations_summary,by="TARGET",suffix = c(".calib","")) +# Strategy 2 +data_strategy2 <- subset(data_calib, TARGET %in% strategy2list) - index=which(Declarations_summary_join$count.calib>count_min) - Declarations_summary_join=Declarations_summary_join[index,] +set.seed(42) +sample_temp <- data_strategy2 %>% + group_by(TARGET) %>% + sample_n(smotesize) - index_sample=which((Declarations_summary_join$arearatio*sample_size)Declarations_summary_join$count.calib) +# Strategy 3 - temp_area=sum(Declarations_summary_join$area[-index]) - temp_count=ifelse(Declarations_summary_join$count.calib[index]>count_thresh,count_thresh,Declarations_summary_join$count.calib[index]) - temp_size=sample_size-sum(temp_count) +data_strategy3 <- subset(data_calib, TARGET %in% strategy3list) +set.seed(42) +trainindex3=createDataPartition(data_strategy3$TARGET, times = 1, p = Sample_ratioL, list = FALSE) +data_strategy3_valid=data_strategy3[-trainindex3,] +data_strategy3_calib=data_strategy3[trainindex3,] - factor=sum(Declarations_summary_join$area/temp_area) - sample_size_area_overunder=floor(temp_size*Declarations_summary_join$arearatio*factor) - sample_size_area_overunder[index]=temp_count - sample_size_area_overunder[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] +print(paste('Dimensions data_strategy3_valid:',dim(data_strategy3_valid))) +print(paste('Dimensions data_strategy3_calib:',dim(data_strategy3_calib))) - sample_size_area=round(sample_size*Declarations_summary_join$arearatio) +## Compilation of the calibration and validation datasets - sample_size_area_over=ifelse(sample_size_area>sample_size_area_overunder,sample_size_area,sample_size_area_overunder) - sample_size_area_over[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] +data_valid_final=rbind(data_valid1,data_strategy1_valid,data_strategy2_valid,data_strategy3_valid) +data_calib_final=rbind(data_strategy1_calib,data_strategy2_calib,data_strategy3_calib) +data_joined=rbind(data_valid_final,data_calib_final) - sample_size_area_over=ifelse(sample_size_area_over>Declarations_summary_join$count.calib,Declarations_summary_join$count.calib,sample_size_area_over) +print(paste('Dimensions data_valid_final:',dim(data_valid_final))) +print(paste('Dimensions data_calib_final:',dim(data_calib_final))) +print(paste('Dimensions data_joined:',dim(data_joined))) - Sample_areaweighted=NA - for (i in 1:nrow(Declarations_summary_join)){ - set.seed(42) - temp=sample_n(data_calib[which(data_calib$TARGET==Declarations_summary_join$TARGET[i]),],sample_size_area_over[i]) - Sample_areaweighted=rbind(Sample_areaweighted,temp) - } +# ## Trajectory and pupose flags +# +# classif_ID=c(as.numeric(data_joined$NewID)) +# valid_ID=c(as.numeric(data_valid_final$NewID)) +# calib_ID=c(as.numeric(data_calib_final$NewID)) +# +# for (row in 1:nrow(Shapefile)) { +# if('NewID' %in% classif_ID) { +# Shapefile$Trajectory=1 +# if('NewID' %in% valid_ID) { +# Shapefile$Purpose=2 +# } else if('NewID' %in% calib_ID) { +# Shapefile$Purpose=1 +# } +# } else +# Shapefile$Trajectory=0 +# Shapefile$Purpose=0 +# } +# +# # Save declaration dataset with Trajectory and Purpose flags +# +# write.csv(Shapefile,paste0(workdir,"Declaration_dataset_purpose_trajectory.csv"), row.names = FALSE) - sample_ID=as.numeric(Sample_areaweighted$NewID) - data_calib_red=data_calib_red[which(data_calib$NewID %in% sample_ID),] +## Preparation of data_calib_final - write.csv(sample_ID,paste0(workdir,paste("Calib_NewIDs",sample_size,format(Sys.time(),"%m%d-%H%M"),sep="_"),".csv")) +data_calib_final_red <- data_calib_final %>% dplyr:: select(union(starts_with("NewID"),union(starts_with("XX"),starts_with("TARGET")))) +## SMOTE process +if (samplingmethod=="Smote") { - } else if ( samplingmethod=="Smote") { print("Starting Smote") grp_data=group_by(data_joined,TARGET) nrow=nrow(data_joined) - areatot=sum(as.numeric(data_joined$AREA),na.rm=TRUE) - Declarations_summary = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) + areatot=sum(as.numeric(data_joined$AreaDeclared),na.rm=TRUE) + Declarations_summary = summarise(grp_data, count=n(),area=sum(as.numeric(AreaDeclared)),arearatio=sum(as.numeric(AreaDeclared))/areatot, countratio=n()/nrow) - grp_data=group_by(data_calib,TARGET) - nrow=nrow(data_calib) - areatot=sum(as.numeric(data_calib$AREA),na.rm=TRUE) - Declarations_summary_calib = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) + grp_data=group_by(data_calib_final,TARGET) + nrow=nrow(data_calib_final) + areatot=sum(as.numeric(data_calib_final$AreaDeclared),na.rm=TRUE) + Declarations_summary_calib = summarise(grp_data, count=n(),area=sum(as.numeric(AreaDeclared)),arearatio=sum(as.numeric(AreaDeclared))/areatot, countratio=n()/nrow) Declarations_summary_join=left_join(Declarations_summary_calib,Declarations_summary,by="TARGET",suffix = c(".calib","")) - Smoted_data=NA - index=which(Declarations_summary_join$count.calib>count_min) - Declarations_summary_join=Declarations_summary_join[index,] for (i in 1:nrow(Declarations_summary_join)){ SMOTEd=NA Sample_areaweighted=NA + print(paste("Iteration",i,"on",nrow(Declarations_summary_join))) - data_calib_red$test=ifelse(data_calib$TARGET==Declarations_summary_join$TARGET[i],1,0) - dupsize=smotesize/length(which(data_calib$TARGET==Declarations_summary_join$TARGET[i])) - #dupsize=ifelse(dupsize<1,1,dupsize) - #nums <- sapply(data_calib_red, is.numeric) - # data_smote=data_calib_red[,which(nums)] - #data_smote <- data_calib_red %>% dplyr:: select(union(starts_with("X"),starts_with("test"))) - #data_smote = cbind(TARGET=data_calib[,"TARGET"],data_smote) - #data_smote = na.omit(data_calib_red) - #data_smote[,c("TARGET")]=as.numeric(as.character(data_smote[,c("TARGET")])) - #data_smote[,!(names(data_smote) %in% c("TARGET"))] - data_smote <- data_calib_red + data_calib_final_red$test=ifelse(data_calib_final$TARGET==Declarations_summary_join$TARGET[i],1,0) + nparcels=length(which(data_calib_final$TARGET==Declarations_summary_join$TARGET[i])) + dupsize=smotesize/length(which(data_calib_final$TARGET==Declarations_summary_join$TARGET[i])) + data_smote <- data_calib_final_red if ( dupsize>1) { @@ -410,315 +291,82 @@ if ( samplingmethod=="Random") { originals=SMOTEd$orig_P synthetics=SMOTEd$syn_data - rm(SMOTEd) - originals$SMOTE=1 - synthetics$SMOTE=0 - - synthetics$TARGET=Declarations_summary_join$TARGET[i] - originals$TARGET=Declarations_summary_join$TARGET[i] - Smoted_data=rbind(Smoted_data,originals,synthetics) - } else + synthetics2=sample_n(synthetics,(smotesize-nparcels)) - originals=data_smote[which(data_smote$TARGET==Declarations_summary_join$TARGET[i]),] - colnames(originals)[which(names(originals) == "test")] <- "class" - #originals$class=NA - #synthetics=NA originals$SMOTE=1 - #synthetics$SMOTE=0 - #synthetics$TARGET=originals$TARGET[1] - Smoted_data=rbind(Smoted_data,originals) - } - rm(data_smote) - - - grp_data=group_by(data_joined,TARGET) - nrow=nrow(data_joined) - areatot=sum(as.numeric(data_joined$AREA),na.rm=TRUE) - Declarations_summary = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) - - grp_data=group_by(data_calib,TARGET) - nrow=nrow(data_calib) - areatot=sum(as.numeric(data_calib$AREA),na.rm=TRUE) - Declarations_summary_calib = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) - - Declarations_summary_join=left_join(Declarations_summary_calib,Declarations_summary,by="TARGET",suffix = c(".calib","")) - - - index=which(Declarations_summary_join$count.calib>count_min) - Declarations_summary_join=Declarations_summary_join[index,] - - index_sample=which((Declarations_summary_join$arearatio*sample_size)Declarations_summary_join$count.calib) - - temp_area=sum(Declarations_summary_join$area[-index]) - temp_count=ifelse(Declarations_summary_join$count.calib[index]>count_thresh,count_thresh,Declarations_summary_join$count.calib[index]) - temp_size=sample_size-sum(temp_count) + synthetics2$SMOTE=0 + synthetics2$TARGET=Declarations_summary_join$TARGET[i] + originals$TARGET=Declarations_summary_join$TARGET[i] - factor=sum(Declarations_summary_join$area/temp_area) - sample_size_area_overunder=floor(temp_size*Declarations_summary_join$arearatio*factor) - sample_size_area_overunder[index]=temp_count - sample_size_area_overunder[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] - - sample_size_area=round(sample_size*Declarations_summary_join$arearatio) - - sample_size_area_over=ifelse(sample_size_area>sample_size_area_overunder,sample_size_area,sample_size_area_overunder) - sample_size_area_over[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] - - sample_size_area_over=ifelse(sample_size_area_over>Declarations_summary_join$count.calib,Declarations_summary_join$count.calib,sample_size_area_over) - - ###Test for undersampling - #sample_size_area_over=ifelse(sample_size_area_over>count_thresh*4,count_thresh*4,sample_size_area_over) - #sample_size_area_over=ifelse(Declarations_summary_join$count.calib>3*count_thresh,3*count_thresh,Declarations_summary_join$count.calib) - #print(sample_size_area_over) - - - Sample_areaweighted_originals=NA - for (i in 1:nrow(Declarations_summary_join)){ - set.seed(42) - temp=sample_n(Smoted_data[which(Smoted_data$TARGET==Declarations_summary_join$TARGET[i]& Smoted_data$SMOTE==1),],sample_size_area_over[i]) - Sample_areaweighted_originals=rbind(Sample_areaweighted_originals,temp) - } - - - - sample_size_diff=ifelse(sample_size_area_overcount_min) - Declarations_summary_join=Declarations_summary_join[index,] - - for (i in 1:nrow(Declarations_summary_join)){ - - SMOTEd=NA - Sample_areaweighted=NA - print(paste("Iteration",i,"on",nrow(Declarations_summary_join))) - data_calib_red$test=ifelse(data_calib$TARGET==Declarations_summary_join$TARGET[i],1,0) - dupsize=smotesize/length(which(data_calib$TARGET==Declarations_summary_join$TARGET[i])) - #dupsize=ifelse(dupsize<1,1,dupsize) - #nums <- sapply(data_calib_red, is.numeric) - # data_smote=data_calib_red[,which(nums)] - #data_smote <- data_calib_red %>% dplyr:: select(union(starts_with("X"),starts_with("test"))) - #data_smote = cbind(TARGET=data_calib[,"TARGET"],data_smote) - #data_smote = na.omit(data_calib_red) - #data_smote[,c("TARGET")]=as.numeric(as.character(data_smote[,c("TARGET")])) - #data_smote[,!(names(data_smote) %in% c("TARGET"))] - data_smote <- data_calib_red - - if ( dupsize>1) { - - SMOTEd=SMOTE(data_smote[,!(names(data_smote) %in% c("test","TARGET"))],as.numeric(data_smote[,c("test")]),K=k,dup_size=dupsize) - - originals=SMOTEd$orig_P - synthetics=SMOTEd$syn_data - rm(SMOTEd) - originals$SMOTE=1 - synthetics$SMOTE=0 + Smoted_data=rbind(Smoted_data,synthetics2) - synthetics$TARGET=Declarations_summary_join$TARGET[i] - originals$TARGET=Declarations_summary_join$TARGET[i] - Smoted_data=rbind(Smoted_data,originals,synthetics) } else - originals=data_smote[which(data_smote$TARGET==Declarations_summary_join$TARGET[i]),] + originals=data_smote[which(data_smote$TARGET==Declarations_summary_join$TARGET[i]),] colnames(originals)[which(names(originals) == "test")] <- "class" - #originals$class=NA - #synthetics=NA originals$SMOTE=1 - #synthetics$SMOTE=0 - #synthetics$TARGET=originals$TARGET[1] Smoted_data=rbind(Smoted_data,originals) - } - rm(data_smote) - - - grp_data=group_by(data_joined,TARGET) - nrow=nrow(data_joined) - areatot=sum(as.numeric(data_joined$AREA),na.rm=TRUE) - Declarations_summary = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) - - grp_data=group_by(data_/calib,TARGET) - nrow=nrow(data_calib) - areatot=sum(as.numeric(data_calib$AREA),na.rm=TRUE) - Declarations_summary_calib = summarise(grp_data, count=n(),area=sum(as.numeric(AREA)),arearatio=sum(as.numeric(AREA))/areatot, countratio=n()/nrow) - - Declarations_summary_join=left_join(Declarations_summary_calib,Declarations_summary,by="TARGET",suffix = c(".calib","")) - - - index=which(Declarations_summary_join$count.calib>count_min) - Declarations_summary_join=Declarations_summary_join[index,] - - index_sample=which((Declarations_summary_join$arearatio*sample_size)Declarations_summary_join$count.calib) - - temp_area=sum(as.numeric(Declarations_summary_join$area[-index])) - temp_count=ifelse(Declarations_summary_join$count.calib[index]>count_thresh,count_thresh,Declarations_summary_join$count.calib[index]) - temp_size=sample_size-sum(temp_count) - - - factor=sum(as.numeric(Declarations_summary_join$area)/temp_area) - sample_size_area_overunder=floor(temp_size*Declarations_summary_join$arearatio*factor) - sample_size_area_overunder[index]=temp_count - sample_size_area_overunder[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] - - sample_size_area=round(sample_size*Declarations_summary_join$arearatio) - - sample_size_area_over=ifelse(sample_size_area>sample_size_area_overunder,sample_size_area,sample_size_area_overunder) - sample_size_area_over[setdiff(index2,index)]=Declarations_summary_join$count.calib[setdiff(index2,index)] - - sample_size_area_over=ifelse(sample_size_area_over>Declarations_summary_join$count.calib,Declarations_summary_join$count.calib,sample_size_area_over) - - ##undersampling - sample_size_area_over=ifelse(sample_size_area_over>count_thresh,count_thresh,sample_size_area_over) - print(sample_size_area_over) - - - Sample_areaweighted_originals=NA - for (i in 1:nrow(Declarations_summary_join)){ - set.seed(42) - temp=sample_n(Smoted_data[which(Smoted_data$TARGET==Declarations_summary_join$TARGET[i]& Smoted_data$SMOTE==1),],sample_size_area_over[i]) - Sample_areaweighted_originals=rbind(Sample_areaweighted_originals,temp) } + print(paste('Dimensions Smoted_data before removing NAs:',dim(Smoted_data))) + Smoted_data=na.omit(Smoted_data) + print(paste('Dimensions Smoted_data after removing NAs:',dim(Smoted_data))) + write.csv(Smoted_data,paste0(workdir,"Smoted_data.csv"), row.names = FALSE) - sample_size_diff=ifelse(sample_size_area_over% dplyr:: select(starts_with("XX")) -data_predict_red_name = paste("Data_predict", sample_size, format(Sys.time(), "%m%d-%H%M"), sep="_") +data_predict_red_name = paste("Data_predict",format(Sys.time(),"%m%d-%H%M"),sep="_") saveRDS(data_predict_red, paste0(workdir,data_predict_red_name,".rds")) rm(data_joined, data_predict_red) gc() -# remove NULL and NA values (see above) -#data_calib_red=na.omit(data_calib_red) -#data_red=data_red[,-2] +# Preparation of the validation dataset -#validation set -#data_valid_red <- data_valid[c(-1, -2, -4)] -data_valid_red <- data_valid %>% dplyr:: select(union(starts_with("TARGET"),starts_with("XX"))) - -if(samplingmethod!="Random"){ - grp_data=group_by(data_valid_red,TARGET) - Declarations_summary = summarise(grp_data, count=n()) - index=Declarations_summary$TARGET[which(Declarations_summary$count>ceiling(count_min/3))] - data_valid_red=data_valid_red[which(data_valid_red$TARGET %in% index),] -} - -###classification -#data_model <- data_calib_red[c(ncol(data_calib_red), 2:(ncol(data_calib_red) - 3))] -data_model <- data_calib_red %>% dplyr:: select(union(starts_with("TARGET"),starts_with("XX"))) -rm(data_calib_red) +data_valid_final_red <- data_valid_final %>% dplyr:: select(union(starts_with("TARGET"),starts_with("XX"))) +print(paste('Dimensions sample for validation:',dim(data_valid_final_red))) +data_valid_final_red_name = paste("Data_valid_red",format(Sys.time(),"%m%d-%H%M"), sep="_") +saveRDS(data_valid_final_red, paste0(workdir, data_valid_final_red_name, ".rds")) +rm(data_valid_final_red) +gc() -#print(mem_used()) -grp_data=group_by(data_valid,TARGET) -areatot=sum(as.numeric(data_valid$AREA)) -Declarations_summary = summarise(grp_data, count=n(),arearatio=sum(as.numeric(AREA))/areatot) -rm(data_valid, grp_data) +# Preparation of the calibration dataset -#print(mem_used()) +data_model <- data_calib_final_red %>% dplyr:: select(union(starts_with("TARGET"),starts_with("XX"))) +data_model$TARGET <- as.factor(data_model$TARGET) +write.csv(data_model,paste0(workdir,"data_calib_final.csv"), row.names = FALSE) +rm(data_calib_final_red) print(paste('Dimensions sample for training:',dim(data_model))) -print(paste('Dimensions sample for validation:',dim(data_valid_red))) -data_valid_red_name = paste("Data_valid", sample_size, format(Sys.time(), "%m%d-%H%M"), sep="_") -saveRDS(data_valid_red, paste0(workdir, data_valid_red_name, ".rds")) -rm(data_valid_red) -gc() +# Model creation -# grp_data=group_by(data_model,TARGET) -# Declarations_summary = summarise(grp_data, count=n()) -# countmax=max(Declarations_summary$count) -# Declarations_summary$countweight=countmax/Declarations_summary$count -# -# weights=matrix(data=NA,nrow=nrow(data_model),ncol=1) -# for (i in 1:nrow(Declarations_summary)){ -# set.seed(42) -# weights[which(data_model$TARGET==Declarations_summary$TARGET[i])]=countmax/Declarations_summary$count[i] -# } - -##Launch model -print("... Start training using Ranger script") +print("Start training using Ranger script") start.time <- Sys.time() -Ranger_trees = ranger(TARGET ~ ., data = droplevels(data_model), write.forest = TRUE,probability = TRUE,num.trees = numtrees,mtry = NULL,importance = "impurity",min.node.size = 10,seed = 42) -#Ranger_trees = ranger(TARGET ~ ., data = droplevels(data_model), case.weights=weights, write.forest = TRUE,probability = TRUE,num.trees = numtrees,mtry = NULL,importance = "impurity",min.node.size = 10,seed = 42) + +Ranger_trees = ranger(TARGET ~ ., data = droplevels(data_model), write.forest = TRUE,probability = TRUE,num.trees = numtrees,mtry = NULL,importance = "impurity",min.node.size = min_node_size,seed = 42) end.time <- Sys.time() time.taken <- end.time - start.time @@ -729,53 +377,64 @@ Ranger_trees$time.taken=time.taken Ranger_trees$inputs=list(variable) print(Ranger_trees) +# Save model -#Save model -modelname=paste("Ranger",sample_size,format(Sys.time(), "%m%d-%H%M"),sep="_") +modelname=paste("Ranger",format(Sys.time(), "%m%d-%H%M"),sep="_") saveRDS(Ranger_trees, paste(workdir,modelname,".rds",sep="")) -###Prediction -data_valid_red <- readRDS(paste0(workdir, data_valid_red_name, ".rds")) +## Validation and confusion matrix + +print("Start validation and confusion matrix") + +# Prediction on validation + +data_valid_final_red <- readRDS(paste0(workdir, data_valid_final_red_name, ".rds")) +write.csv(data_valid_final_red,paste0(workdir,"data_valid_final.csv"), row.names = FALSE) start.time <- Sys.time() -predict_Ranger_trees=predict(Ranger_trees,data_valid_red) + +predict_Ranger_trees=predict(Ranger_trees,data_valid_final_red) + end.time <- Sys.time() time.taken <- end.time - start.time time.taken -#save predictions -predictname=paste("Predict_Ranger",sample_size,format(Sys.time(), "%m%d-%H%M"),sep="_") +# Save predictions + +predictname=paste("Predict_Ranger",format(Sys.time(), "%m%d-%H%M"),sep="_") print(paste(workdir,predictname,".rds",sep="")) saveRDS(predict_Ranger_trees, paste(workdir,predictname,".rds",sep="")) +# Work on predictions -###Validation and confusion matrix predictions=predict_Ranger_trees$predictions predict.max=apply(predictions, 1, max) predict.whichmax=apply(predictions, 1, which.max) +predict.class=colnames(predictions)[predict.whichmax] + +data_ref=factor(data_valid_final_red$TARGET) -predict.class=factor(colnames(predictions)[predict.whichmax]) -data_ref=factor(data_valid_red$TARGET) lvl = union(levels(predict.class), levels(data_ref)) + predict.class = factor(predict.class, levels = lvl) data_ref = factor(data_ref, levels = lvl) -#data_ref=data_ref[data_ref %in% levels(data_predict)] -#data_predict=data_predict[data_predict %in% levels(data_ref)] -#data_predict=data_predict[1:length(data_ref)] +print(paste("Number of predictions:",length(predict.class))) +print(paste("Number of reference:",length(data_ref))) + +# Confusion matrix and metrics Results_Ranger=confusionMatrix(predict.class,data_ref,mode="everything") -resultname=paste("Results_Ranger",sample_size,samplingmethod,count_thresh,numtrees,format(Sys.time(), "%m%d-%H%M"),sep="_") +resultname=paste("Results_Ranger",samplingmethod,numtrees,format(Sys.time(), "%m%d-%H%M"),sep="_") saveRDS(Results_Ranger, paste(workdir,resultname,".rds",sep="")) print(Results_Ranger$overall) -rm(data_valid_red) -gc() - -metrics_name=paste("Metrics",sample_size,samplingmethod,count_thresh,numtrees,format(Sys.time(), "%m%d-%H%M"),sep="_") +metrics_name=paste("Metrics",samplingmethod,numtrees,format(Sys.time(), "%m%d-%H%M"),sep="_") write.csv(t(Results_Ranger$overall), file = paste0(workdir, metrics_name, ".csv"), row.names = FALSE, quote = FALSE) +# Plot + df <- data.frame(x=factor(c("Overall accuracy","Kappa",names(Results_Ranger$byClass[,"F1"])),levels=(c("Overall accuracy","Kappa",names(Results_Ranger$byClass[order(Results_Ranger$byClass[,"Prevalence"],decreasing = TRUE),"F1"])))),y=c(Results_Ranger$overall[1],Results_Ranger$overall[2],Results_Ranger$byClass[,"F1"]),prevalence=c(Results_Ranger$overall[1],Results_Ranger$overall[2],Results_Ranger$byClass[,"Prevalence"])) index=which(df$prevalence!=0) df=df[index,] @@ -797,15 +456,22 @@ ggsave(paste(workdir,"Plot_",resultname,".png",sep=""),q,width = 13, height = 8) data_predict_red <- readRDS(paste0(workdir,data_predict_red_name,".rds")) -print("Start prediction...") +## Predictions + +print("Start prediction") + start.time <- Sys.time() + predict_Ranger_trees=predict(Ranger_trees,data_predict_red) + end.time <- Sys.time() time.taken <- end.time - start.time time.taken predictions=predict_Ranger_trees$predictions -print("after prediction") + +print("After prediction") + rm(Ranger_trees, data_predict_red) gc() @@ -821,10 +487,10 @@ predict.2class=colnames(predictions)[predict.which2max] predict.2class=ifelse(predict.class==predict.2class,colnames(predictions)[apply(predictions, 1, function(x) which(x==sort(x,partial=n-1)[n-1])[2])],predict.2class) -parcels_predict <- readRDS(paste0(workdir, parcels_predict_name, ".rds")) -Predict_classif=data.frame(parcels_predict$NewID,parcels_predict$AREA,parcels_predict$TARGET,predict.class,round(predict.max,digits=3),predict.2class,round(predict.2max,digits=3)) +Predict_classif=data.frame(parcels_predict$NewID,parcels_predict$AreaDeclared,parcels_predict$TARGET,predict.class,round(predict.max,digits=3),predict.2class,round(predict.2max,digits=3)) colnames(Predict_classif)=c("NewID",'Area','CT_decl','CT_pred_1','CT_conf_1','CT_pred_2','CT_conf_2') -#save predictions +# Save predictions + predictname=paste("Predict_classif",modelname,sep="_") write.csv(Predict_classif,paste0(workdir,predictname,".csv"), row.names = FALSE) diff --git a/sen2agri-services/pom.xml b/sen2agri-services/pom.xml index f9ee3e3e..1fc2ccbc 100644 --- a/sen2agri-services/pom.xml +++ b/sen2agri-services/pom.xml @@ -230,7 +230,7 @@ com.mchange c3p0 - 0.9.5.2 + 0.9.5.4