forked from josephhardinee/PyDSD
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a configuration parser, and converted dsd moments and radar mom…
…ents to use the new meta data fields (josephhardinee#38)
- Loading branch information
1 parent
e5ae077
commit a40f923
Showing
5 changed files
with
153 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
PyDisdrometer is a Python package to process disdrometer files. It currently is capable of reading several different types of disdrometers and calculating both important moment parameters, as well as radar derived parameters. It currently supports OTT Parsivel disdrometers and Joss Waldvogel Disdrometers. It is currently in alpha so functionality is limited but being expanded quickly. | ||
|
||
Author: Joseph C. Hardin | ||
Author: Joseph C. Hardin, Nick Guy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import numpy as np | ||
import unittest | ||
from ..utility import configuration | ||
|
||
from .. import DropSizeDistribution | ||
|
||
class testConfiguration(unittest.TestCase): | ||
''' Unit tests for Configuration Class''' | ||
|
||
def setUp(self): | ||
self.config = configuration.Configuration() | ||
|
||
def test_config_loads_and_has_keys(self): | ||
self.assertIsNotNone(self.config) | ||
self.assertTrue(len(self.config.metadata.keys()) > 0 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import json | ||
from copy import copy | ||
import os | ||
|
||
|
||
|
||
class Configuration(object): | ||
''' Class to store PyDisdrometer configuration options | ||
Attributes: | ||
----------- | ||
''' | ||
config_dir = os.path.dirname(os.path.abspath(__file__)) | ||
metadata_config_file = os.path.join(config_dir, 'metadata.json') | ||
|
||
def __init__(self): | ||
self.metadata = self.load_metadata_config() | ||
|
||
def load_metadata_config(self): | ||
''' Load the metadata configuration file and return the dictionary''' | ||
return json.load(open(self.metadata_config_file)) | ||
|
||
|
||
def fill_in_metadata(self, field, data): | ||
metadata = self.metadata[field].copy() | ||
metadata['data'] = copy(data) | ||
return metadata | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"D0": | ||
{ | ||
"standard_name": "median_drop_diameter", | ||
"units": "mm", | ||
"long_name": "Median Drop Diameter" | ||
}, | ||
"Dmax": | ||
{ | ||
"standard_name": "maximum_drop_diameter", | ||
"units": "mm", | ||
"long_name" :"Maximum Drop Diameter" | ||
}, | ||
"Dm": | ||
{ | ||
"standard_name": "mean_drop_diameter", | ||
"units": "mm", | ||
"long_name" :"Mean Drop Diameter" | ||
}, | ||
"Nw": | ||
{ | ||
"standard_name": "normalized_intercept_parameter", | ||
"units": "?", | ||
"long_name" :"Normalized Intercept Parameter of a Normalized Gaussian Distribution" | ||
}, | ||
"Nt": | ||
{ | ||
"standard_name": "total_droplet_concentration", | ||
"units": "m^-1", | ||
"long_name" :"Total Droplet Concentration" | ||
}, | ||
"N0": | ||
{ | ||
"standard_name": "intercept_parameter", | ||
"units": "?", | ||
"long_name" :"Intercept Parameter of Modeled Drop Size Distribution" | ||
}, | ||
"W": | ||
{ | ||
"standard_name": "water_mass", | ||
"units": "g/m^3", | ||
"long_name" :"Water Mass of Drop Size Distribution" | ||
}, | ||
"mu": | ||
{ | ||
"standard_name": "shape_parameter", | ||
"units": " ", | ||
"long_name" :"Shape Parameter of Modeled Drop Size Distribution" | ||
}, | ||
"rain_rate": | ||
{ | ||
"standard_name": "rain_rate", | ||
"units": "mm/h", | ||
"long_name" :"Instantaneous Rainfall Rate of Water Flux" | ||
}, | ||
"Zh": | ||
{ | ||
"standard_name": "horizontal_reflectivity", | ||
"units": "dBZ", | ||
"long_name" :"Estimated Horizontal Radar Reflectivity from Drop Size Distribution" | ||
}, | ||
"Zdr": | ||
{ | ||
"standard_name": "differential_reflectivity", | ||
"units": "dBZ", | ||
"long_name" :"Estimated Differential Radar Reflectivity (H, V) from Drop Size Distribution" | ||
}, | ||
"Kdp": | ||
{ | ||
"standard_name": "specific_differential_phase", | ||
"units": "deg", | ||
"long_name" :"Specific Differential Phase from Drop Size Distribution" | ||
}, | ||
"Ai": | ||
{ | ||
"standard_name": "specific_attenuation", | ||
"units": "dB/km", | ||
"long_name": "Specific Attenuation" | ||
}, | ||
"Adr": | ||
{ | ||
"standard_name": "specific_differential_attenuation", | ||
"units": "dB/km", | ||
"long_name": "Specific Differential Attenuation" | ||
} | ||
} | ||
|
||
|