Notes: 27

How to plot MODIS cloud re and tau LUT (Nakajima and King's diagram) using python ?

An example of how to plot MODIS cloud re and tau LUT (Nakajima and King's plot) in python using matplotlib: [TOC] ### How to get and read the Data Note: the LUTs are available [here](https://modis-atmosphere.gsfc.nasa.gov/products/cloud/luts) from pyhdf.SD import SD, SDC from scipy import interpolate import matplotlib.pyplot as plt import numpy as np import math import matplotlib.patches as mpatches import matplotlib.cm as cm file = SD('./MODIS_C6_LUTS/examples/oc

How to get all the eMAS granule names from the ORACLES campaign using python 3 ?

Example of how to get all the (MODIS Airborne Simulator) eMAS granule names from the ORACLES campaign using python: [TOC] ### Get ORACLES campaign days First step, let's download, using python, the json file at the root of the eMAS ORACLES campaign available [here](https://ladsweb.modaps.eosdis.nasa.gov/archive/MAS_eMAS/ORACLES/): import urllib.request, json ladsweb_url = 'https://ladsweb.modaps.eosdis.nasa.gov/archive/MAS_eMAS/ORACLES.json' with urllib.request.urlopen(lads

How to create a json file with the names and attributes of a VIIRS L2 CLDPROP netcdf file using python 3 ?

Example of python 3 code to save in a json file the names and attributes of a VIIRS L2 CLDPROP netcdf file. [TOC] Note: the json file created can be found [here](/Files/viirs-cldprop-l2-001-names-attributes/) ### Read the file import netCDF4 import numpy as np import json import pprint f = netCDF4.Dataset('CLDPROP_L2_VIIRS_SNPP.A2018046.1436.001.2019068074007.nc') ### Get all group names group_dic = f.groups.keys() ### Get names and attributes in each group

How to download a VIIRS L2 CLDPROP netcdf file from ladsweb using python ?

Example of python script to download on your local machine a VIIRS L2 CLDPROP netcdf granule file from [ladsweb](https://ladsweb.modaps.eosdis.nasa.gov/search/) using python. [TOC] Lets consider the following data for example: year = 2018 month = 2 day = 15 hour = 14 minute = 36 Note: VIIRS granules are every 6 minutes ### Convert day to count of days First step we need to get the count of days: from datetime import date d0 = date(year, 1, 1) d1 = date(year

How to read a VIIRS L2 CLDPROP netcdf file using python ?

An example of how to read a VIIRS L2 CLDPROP netcdf file using python 3: [TOC] ### Download a VIIRS L2 CLDPROP netcdf file To download a VIIRS L2 CLDPROP netcdf file, a solution is to go on [LAADS DAAC](https://ladsweb.modaps.eosdis.nasa.gov/search/order/2/CLDPROP_L2_VIIRS_SNPP--5110/2019-01-01/DB/World). Example of granule selected randomly that will be used hereafter: CLDPROP_L2_VIIRS_SNPP.A2019001.1742.001.2019062201640.nc ### Read a netCDF file with python To read the C

How to homogenize with the latitude a MODIS-2B-CLDCLASS-lidar sample ?

Example of how to homogenize with the latitude a MODIS-2B-CLDCLASS-lidar random sample [TOC] ### Example for a month of data input files can be downloaded here: - [sample 0](/Files/2008-01-sample-00-modis-caliop-cldclass-lidar/) - [sample 1](/Files/2008-01-sample-01-modis-caliop-cldclass-lidar-1/) [images:2008-01-sample-homogenization-02;2008-01-sample-homogenization-06 dim:1*2 size:100 caption:Colocated (1month) MODIS and 2B-CLDCLASS-lidar sample homogenization with python ]

Get the latitude and longitude of a 2B-CLDCLASS-lidar granule with python

Example of python code to read the latitude and longitude of a 2B-CLDCLASS-lidar granule using python #!/usr/bin/env python from pyhdf.SD import SD, SDC from pyhdf.HDF import * from pyhdf.VS import * import pprint file_path = '' file_name = '2008183012329_11573_CS_2B-CLDCLASS-LIDAR_GRANULE_P_R04_E02.hdf' # Read HDF Files (VD data) Latitude & Longitude f = HDF(file_path+file_name, SDC.READ) vs = f.vstart() Latitude = vs.attach('Latitude') Longitude = vs.at

Aqua MODIS C6 multilayer clouds evaluation using CloudSat CPR and CALIPSO CALIOP products

The goal of this project is to evaluate the Aqua MODIS Collection 6 (C6 hereafter) through comparisons with CloudSat and CALIOP products. Multilayer cloud scenes are common in the atmosphere and remain an important source of uncertainties in the cloud optical products retrievals, since those type of cloud scenes are still challenging to detect and to be modeled for satellite remote sensing with passive sensors. While the combination of active sensors such as the radar CPR and the lidar CALIOP h

Extract date and time from a CloudSat 2B GEOPROF granule using python

Example on how to extract the date (MMDDYYYY) and time from a CloudSat 2B GEOPROF granule using python import calendar #----------------------------------------------------------------------------------------# # Convert day of year to MM DD YYYY format def JulianDate_to_MMDDYYY(y,jd): month = 1 day = 0 while jd - calendar.monthrange(y,month)[1] > 0 and month <= 12: jd = jd - calendar.monthrange(y,month)[1] month = month + 1 return month,jd,y #------------------------------

How to read CloudSat 2B GEOPROF GRANULE HDF4 file using python and pyhdf ?

Simple example about how to read a CloudSat 2B GEOPROF GRANULE HDF4 file using python 3 and the pyhdf library (Note: to install python and pyhdf see the following [article](/Articles/Setup-a-python-workspace-to-start-working-with-satellite-data/)). For example, let's consider the following CloudSat HDF file : "2008025010959_09272_CS_2B-GEOPROF_GRANULE_P_R04_E02.hdf": ### Import python libraries First import all python libraries needed to read the file from pyhdf.SD import SD, SDC

Read polder/parasol L2 data using python 3 and parasolascii

#### With python os module Run parasol ascii using python os module: #!/usr/bin/env python import os filename = 'P3L2TRGB071037KL' command = 'parasolascii -c ' + filename + ' cc > ' + filename + '.ascii' os.system(command) to save polder/parasol data in an ascii file. #### With python subprocess module To read a polder/parasol file, it is not necessary to first save the data in an ascii file, one can use the python subprocess module instead, illustration: #!/usr/bin/env python im

How to access icare server through ssh and compile a fortran code

[Icare](http://www.icare.univ-lille1.fr/) "Data and Services Center's initial emphasis is the production and distribution of remote sensing data derived from Earth observation missions from CNES, NASA, and EUMETSAT. Note: to access icare server through ssh protocol, you need to [register](http://www.icare.univ-lille1.fr/register/account) first and provide a fixed ip address: username: xxxxx password: xxxxx fixed ip address: xxxxx #### How to access icare server through ssh Comm

Get all MODIS C6 MYD04 SDS names and attributes with python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to get all MODIS C6 MYD04 SDS names and attributes in python 2.7. All SDS infos (nd: number of dimensions, t: type, na: number of attributes): Id | name | nd | sds_dimension | t | na ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Longitude | 2 | [203, 135] | 5 | 10 1 | Latitude | 2 | [203, 135] | 5 | 10 2 | Scan_Start_Time | 2 | [203, 135] | 6 | 10

Print all MODIS C6 MYD03 SDS names and attributes in python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to print all MODIS C6 MYD03 SDS names and attributes in python 2.7. All SDS infos (nd: number of dimensions, t: type, na: number of attributes): Id | name | nd | dimension | t | na ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Latitude | 2 | [2030, 1354] | 5 | 3 1 | Longitude | 2 | [2030, 1354] | 5 | 3 2 | Scan Offset | 2 | [4060, 2708] | 20 | 4 3

Print all CALIOP v4 05kmCLay SDS names and attributes in python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to print all CALIOP v4 05kmCLay SDS names and attributes in python 2.7. All SDS infos (nd: number of dimensions, t: type, na: number of attributes): Id | name | nd | dimension | t | na ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Profile_ID | 2 | [3744, 2] | 24 | 3 1 | Latitude | 2 | [3744, 3] | 5 | 3 2 | Longitude | 2 | [3744, 3] | 5 | 3 3 | Pr

Print all MODIS C6 MYD08 M3 SDS names and attributes in python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to print all MODIS C6 MYD08 SDS names and attributes. All SDS infos (nd: number of dimensions, t: type, na: number of attributes): Id | name | nd | dimension | t | na ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Solar_Zenith_Mean_Mean | 2 | [180, 360] | 22 | 13 1 | Solar_Zenith_Mean_Std | 2 | [180, 360] | 22 | 13 2 | Solar_Zenith_Mean_Min | 2 | [180,

Setup a python workspace to start working with satellite data

Python basic workspace installation to work with satellite data (MODIS, CALIOP, etc) ### Install anaconda python distribution To install python and an ensemble of very useful python libraries go to [Anaconda](https://www.continuum.io/download) python distribution. Click on graphical installer python 3.+ version and then double click on the package. [images:conda-01;conda-02 dim:1*2 size:100 caption:Setup a python workspace to start working with satellite data (1/2)] Open the terminal and ch

Convert MODIS day-of-year (julian date) to yyyymmdd date format using python

Simple exemple on how to convert MODIS day-of-year (also called julian date even if the definition of julian date is not exactly the same thing) to MM/DD/YYYY date format using python import calendar def JulianDate_to_MMDDYYY(y,jd): month = 1 day = 0 while jd - calendar.monthrange(y,month)[1] > 0 and month <= 12: jd = jd - calendar.monthrange(y,month)[1] month = month + 1 print month,jd,y JulianDate_to_MMDDYYY(2008,167) Results: 6 15 2008 Checking the code (inverse op

Create MODIS C6 L2 Cloud Effective Radius histograms with python

There are several different ways to create an histogram of MODIS C6 L2 Cloud Effective Radius and filter the data. #### Read SDS data and import needed modules To download a MODIS granule from NASA lads server using python and ftp, go [here](/Codes/Download-MODIS-granule-HDF-files-from-lads-using-ftp-and-python/). To learn how to read an HDF file with python go [here](/Articles/How-to-read-a-MODIS-HDF-file-using-python-/) #!/usr/bin/env python from pyhdf.SD import SD, SDC import numpy

Print all MODIS C5 MYD06 SDS names and attributes in python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to print all MODIS C5 MYD06 SDS names and attributes. All SDS infos: Id | Name | Nb_Dim | Dim | Type | Nb_attributes ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Latitude | 2 | [408, 270] | 5 | 10 1 | Longitude | 2 | [408, 270] | 5 | 10 2 | Scan_Start_Time | 2 | [408, 270] | 6 | 10 3 | Solar_Zenith | 2 | [408, 270] | 22 | 10 4 | Solar

Print all CALIOP v4 01kmCLay SDS names and attributes in python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to print all CALIOP v4 01kmCLay SDS names and attributes. All SDS infos: Id | Name | Nb_Dim | Dim | Type | Nb_attributes ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Profile_ID | 2 | [21120, 1] | 24 | 3 1 | Latitude | 2 | [21120, 1] | 5 | 3 2 | Longitude | 2 | [21120, 1] | 5 | 3 3 | Profile_Time | 2 | [21120, 1] | 6 | 3 4 | Profile_UT

Print all CALIOP v3 01kmCLay SDS names and attributes in python 2.7

Outputs of a code (see bottom of the page) written in python 2.7 to print all CALIOP v3 01kmCLay SDS names and attributes. All SDS infos: Id | Name | Nb_Dim | Dim | Type | Nb_attributes ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Profile_ID | 2 | [21120, 1] | 24 | 3 1 | Latitude | 2 | [21120, 1] | 5 | 3 2 | Longitude | 2 | [21120, 1] | 5 | 3 3 | Profile_Time | 2 | [21120, 1] | 6 | 3 4 | Profile_UT

Print all MODIS C6 MYD06 SDS names and attributes using python

Outputs of a code (see bottom of the page) written in python 2.7 to print all MODIS C6 MYD06 SDS names and attributes. All SDS infos: Id | Name | Nb_Dim | Dim | Type | Nb_attributes ------------- | ------------- | ------------- | ------------- | ------------- | ------------- 0 | Latitude | 2 | [408, 270] | 5 | 10 1 | Longitude | 2 | [408, 270] | 5 | 10 2 | Scan_Start_Time | 2 | [408, 270] | 6 | 10 3 | Solar_Zenith | 2 | [408, 270] | 22 | 10 4 | Solar

Create a tree directory (YYYY-MM-DD) using python

Problem: I want to create a simple tree directory to store data with the following structure: 2008/ ./2008/2008_01_01/ ./2008/2008_01_02/ ./2008/2008_01_03/ ./2008/2008_01_04/ ./2008/2008_01_05/ ./2008/2008_01_06/ ./2008/2008_01_07/ ./2008/2008_01_08/ ./2008/2008_01_09/ ./2008/2008_01_10/ ... ... ./2008/2008_12_28/ ./2008/2008_12_29/ ./2008/2008_12_30/ ./2008/2008_12_31/ Soluce: create a python

Extract hours and minutes from caliop or modis file name using python

##### CALIOP Example: how to extract CALIOP granule hours and minutes from file name using python and [Regular Expression](https://docs.python.org/2/howto/regex.html): >>> import re >>> name = 'CAL_LID_L2_01kmCLay-ValStage1-V3-01.2008-01-08T13-55-27ZD.hdf' >>> x = re.compile("T(.*)-(.*)-(.*)Z") >>> obj = x.search(name) >>> obj.group(1) '13' >>> obj.group(2) '55' >>> ##### MODIS For MODIS it is more easy and fast ! just need to use split: >>> name = '

About


More information and options about the notebook can be found in the following dropdown menus:

Search


Use the following form to retrieve notes: