Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusBahbah committed Jan 18, 2023
2 parents 2ed2daf + 59b3346 commit 7cfa58e
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 6 deletions.
110 changes: 109 additions & 1 deletion docs/Examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,112 @@
================
Examples
================
lars lars

Several examples of how to use the carra2py modules and methods, and the utility scripts.
All the examples assume that the user has installed the package correctly, has activated the python environemt and is in the correct folder (/user/carra2py).


carra2py.AVHRR()
================

These examples are executed in a python console, the chosen date is 6th of May, 1994

**First import the carra2py package**
``import carra2py``

**and then input the date in the carra2py.AVHRR() module**
``avhrr = carra2py.AVHRR("19940506")``

How to get the raw data
------------------------

**get the data in EPSG:4326 using the get_data() method**
``rawdata = avhrr.get_data()``

**or get the data in EPSG:3413 using the get_data() method**
``rawdata = avhrr.get_data(polar=True)``

How to process data
--------------------
the default settings is set to process for all regions with a resolution of 2500 meters.
Note that the region names have the same spelling as in the table in the introduction section.

**Process with default settings**
``output = avhrr.proc()``

**Process for Greenland, Iceland and AlaskaYukon, with a 1000 m resolution**
``output = avhrr.proc(area = ["Greenland","Iceland","AlaskaYukon"],res=1000)``

**Process with rawdata from user, see "carra2py Modules and Methods" for input specifications**
``output = avhrr.proc(raw_data=rawdata)``

How to export data
--------------------
the default export settings is set to process for all regions with a resolution of 2500 meters.

**Export as tif with default settings**
``avhrr.export_to_tif()``

**Export as csv with default settings**
``avhrr.export_to_csv()``

**Export as netcdf with default settings**
``avhrr.export_to_nc()``

**Export user defined processed data as tif**
``avhrr.export_to_tif(output=output)``

**Export user defined processed data as netcdf in specfic folder**
``avhrr.export_to_nc(output=output,path="home/carra2py/john/statoil")``

multiexec.py
================

These examples are executed as command lines in a terminal, in your carra2py environment.
The default settings is set to process for all regions with a resolution of 2500 meters using 4 CPU cores and then export as tif files.
Please note, the user must input a start and end date for the processing.
These examples are all exectued with the time period 1st of January, 1982 - 31th of December, 2022.

How to process several dates
-----------------------------
**Process with default settings**
``python multiexec.py -st 19820101 -en 20221231``

**Process with 1000 meter resolution**
``python multiexec.py -st 19820101 -en 20221231 -re 1000``

How to process specific areas
------------------------------
**Process for Svalbard, NorthernArcticCanada and SevernayaZemlya**
``python multiexec.py -st 19820101 -en 20221231 -ar [Svalbard,NorthernArcticCanada,SevernayaZemlya]``

**Process for Greenland and Iceland with 1000 meter resolution**
``python multiexec.py -st 19820101 -en 20221231 -ar [Greenland,Iceland] -re 1000``

How to change output format
-----------------------------

**Process with default settings and then export as netcdf files**
``python multiexec.py -st 19820101 -en 20221231 -o nc``

**Process with default settings and then export as csv files**
``python multiexec.py -st 19820101 -en 20221231 -o csv``

How to change the number of cores used
--------------------------------------

**Process using 8 cores**
``python multiexec.py -st 19820101 -en 20221231 -c 8``

**Process using 1 core**
``python multiexec.py -st 19820101 -en 20221231 -c 1``


Example with all arguments
--------------------------------------

**Process using 6 cores, for Norway and NovayaZemlya, with a 5000 meter resolution, and then export as netcdf**
``python multiexec.py -st 19820101 -en 20221231 -ar [Norway,NovayaZemlya] -c 6 -re 5000 -o nc``



31 changes: 31 additions & 0 deletions docs/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Installation
**Clone the repository:**
``git clone [email protected]:RasmusBahbah/carra2py.git``

**Or download from https://github.com/RasmusBahbah/carra2py:**

**Change into the top-level directory:**
``cd carra2py``

Expand All @@ -27,3 +29,32 @@ Dependencies
================

Python 3.5 or up


Processing Regions
================

The latest carra2py version can process 9 different Regions:

+----------------------+-------------+
| Region | area [km^2] |
+======================+=============+
| Greenland | 1,744,666 |
+----------------------+-------------+
| Norway | 34,018 |
+----------------------+-------------+
| Svalbard | 32,506 |
+----------------------+-------------+
| Iceland | 11,489 |
+----------------------+-------------+
| NorthernArcticCanada | 100,691 |
+----------------------+-------------+
| SouthernArcticCanada | 40,970 |
+----------------------+-------------+
| AlaskaYukon | 96,909 |
+----------------------+-------------+
| NovayaZemlya | 21,506 |
+----------------------+-------------+
| SevernayaZemlya | 15,842 |
+----------------------+-------------+

23 changes: 22 additions & 1 deletion docs/Processing scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,25 @@
Processing Scripts
================

hkllh
Description of utility scripts for carra2py.


multiexec.py:
================

An executable script used for processing and exporting albedo data over multiple dates in a defined time period. It is also possible to use multiple CPU cores to speed the process.

Arguments:
----------------

**-st: the start date of the process period in the format "yyyymmdd"**

**-en: the end date of the process period in the format "yyyymmdd"**

**-re: the wanted ouput resolution in meters, there are three choices [1000,2500,5000], default is set to 2500**

**-ar: the wanted areas to process, default is set to process for all areas**

**-o: the wanted output format, there are three choices ["tif","csv","nc"], the default is set to "tif"**

**-c: number of CPU cores the user want to use. The default is set to 4**
7 changes: 3 additions & 4 deletions docs/carra2py methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description of the carra2py modules and its methods.
class carra2py.AVHRR(date):
================

Parameter: date: str
Attributes: date: str
----------------

the processed date, only in 'yyyymmdd' format
Expand Down Expand Up @@ -84,8 +84,7 @@ Export the processed data to tif files in ESPG:3413
AVHRR.export_to_csv(output=None, path='default')
~~~~~~~~~~~~~~~~

Export the processed data to csv files in ESPG:3413, the format will be

Export the processed data to csv files in ESPG:3413, the files will include three columns "x", "y" and "albedo" with length m*n

**Parameter: output: dict**

Expand All @@ -104,7 +103,7 @@ Export the processed data to csv files in ESPG:3413, the format will be
AVHRR.export_to_nc(output=None, path='default')
~~~~~~~~~~~~~~~~

Export the processed data to netcdf4 files in ESPG:3413, the format will be
Export the processed data to netcdf4 files in ESPG:3413, the files will include three variables "x", "y" and "albedo" with shape (m,n)


**Parameter: output: dict**
Expand Down

0 comments on commit 7cfa58e

Please sign in to comment.