Skip to content

Commit

Permalink
Merge pull request #51 from GAD-DIMNT-CPTEC/issuefix_27
Browse files Browse the repository at this point in the history
Issuefix 27
  • Loading branch information
cfbastarz authored Aug 20, 2024
2 parents d19eeac + dbb33b1 commit 7241bf4
Show file tree
Hide file tree
Showing 64 changed files with 9,181 additions and 215 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# readDiag

# readDiag

readDiag is a Python package that provides a class to read and plot the [Gridpoint Statistical Interpolation](https://dtcenter.org/community-code/gridpoint-statistical-interpolation-gsi) diagnostics files. It can be used to retrieve and investigate important information from the data assimilation process:

![image](https://user-images.githubusercontent.com/6088258/183511751-21032794-b38c-44c0-8719-103ed1b98547.png)
![uv_GSI_3 7](https://github.com/viezelc/readDiag/assets/105943057/a4b19dca-2012-4a27-991c-e326185c39a6)

## Installation

Expand Down
907 changes: 906 additions & 1 deletion docs/en/usage.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/hov7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/kxcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/pcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/statc1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/statc2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/statc3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/statc4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/statc5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/statc6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/time_series_amsua-n19_CH6__TotalObs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/ts1.png
Binary file added docs/imgs/ts2.png
Binary file added docs/imgs/ts3.png
Binary file added docs/imgs/ts4.png
Binary file added docs/imgs/ts5.png
Binary file added docs/imgs/ts6.png
Binary file added docs/imgs/ts7.png
Binary file added docs/imgs/ts8.png
Binary file modified docs/imgs/uv_254_242_221_220_257_258_281_280_ptmap.png
Binary file modified docs/imgs/uv_obs_plot.png
Binary file added docs/imgs/uv_pcount.png
Binary file modified docs/imgs/uv_ps_t_pvmap.png
Binary file added docs/imgs/vcount.png
Binary file added docs/imgs/vcount2.png
928 changes: 928 additions & 0 deletions docs/pt/uso.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: readDiag
name: readDiag.issuefix_27
channels:
- conda-forge
- pyviz
Expand Down
1,101 changes: 964 additions & 137 deletions gsidiag/__main__.py

Large diffs are not rendered by default.

109 changes: 47 additions & 62 deletions gsidiag/datasources.py
Original file line number Diff line number Diff line change
@@ -1,78 +1,63 @@
#!/usr/bin/env python
#-----------------------------------------------------------------------------#
# Group on Data Assimilation Development - GDAD/CPTEC/INPE #
#-----------------------------------------------------------------------------#
#BOP
#
# !SCRIPT:
#
# !DESCRIPTION:
#
# !CALLING SEQUENCE:
#
# !REVISION HISTORY:
# 24 Apr 2018 - J. G. de Mattos - Initial Version
#
# !REMARKS:
#
#EOP
#-----------------------------------------------------------------------------#
#BOC

import csv
import yaml
from os import path

def getVarInfo(kx,var,feature):

class dataSourcesInfo:
"""
A class to parse and store information from a YAML file containing observations data.
Attributes:
tab (dict): A dictionary to store the parsed observations data.
"""
def __init__(self):
"""
The constructor for dataSourcesInfo class. Reads from a YAML file and initializes the 'tab' attribute.
"""
yaml_file = path.join(path.dirname(__file__), 'table.yml')

with open(yaml_file, 'r') as file:
self.data = yaml.safe_load(file)

self.tab = {}
for observation in self.data['observations']:
kx = observation['kx']
self.tab[kx] = {}
for detail in observation['details']:
var = detail['var']
self.tab[kx][var] = detail


def getVarInfo(kx, var, feature):
"""
Retrieves information for a specified feature based on the kx and variable.
Args:
kx (int): The kx value to look up.
var (str): The variable to look up.
feature (str): The specific feature to retrieve information about.
Returns:
The value of the requested feature if found, otherwise None.
"""
dataInfo = dataSourcesInfo()

#
# verify if request exist
#
# verify if request exists
if kx in dataInfo.tab:
if var in dataInfo.tab[kx]:
if feature in dataInfo.tab[kx][var]:
return dataInfo.tab[kx][var][feature]
else:
print('Invalid Feature request:',feature)
print('try use:')
print('Invalid Feature request:', feature)
print('Try using one of:')
for item in dataInfo.tab[kx][var]:
print('\t*',item)
print('\t*', item)
else:
print('Variable',var,'doesn\'t exist in kx',kx)
print('try use:')
print('Variable', var, 'doesn\'t exist in kx', kx)
print('Try using one of:')
for item in dataInfo.tab[kx]:
print('\t*',item)
print('\t*', item)
else:
print('Invalid kx request:', kx)
print('try request:')
print('Try using one of:')
for item in dataInfo.tab:
print('\t*',item)


class dataSourcesInfo:

def __init__(self):

tableFile = path.join(path.dirname(__file__), 'table')

with open(tableFile) as csv_data:
reader = csv.reader(csv_data,skipinitialspace=True,delimiter=';')
# eliminate blank rows if they exist
rows = [row for row in reader if row]
# rows.remove([''])
headings = rows[0] # get headings
self.tab = {}
for row in rows[1:]:
kx = int(row[0])
dic = {row[1]:dict(zip(headings[2::],row[2::]))}
if kx in self.tab:
self.tab[kx].update(dic)
else:
self.tab.update({kx:dic})



#EOC
#-----------------------------------------------------------------------------#
print('\t*', item)

47 changes: 40 additions & 7 deletions gsidiag/table
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,48 @@
252; uv; SATWND; JMA IR e VIS acima de 850 Himawari; #6b6ecf; 8; 1
253; uv; SATWND; EUMETSAT IR e VIS acima de 850; #d6616b; 8; 1
254; uv; SATWND; EUMETSAT WV todo níveis top e deep (METEOSAT); #575738; s; 1
255; uv; SATWND; WIND Report - NESDIS picture triplet cloud drift; #575738; s; 1
257; uv; SATWND; MODIS IR (onda longa) todos niveis (AQUA/TERRA); #dbdb8d; *; 1
258; uv; SATWND; MODIS WV (todos niveis) TOP (AQUA/TERRA); #9edae5; p; 1
259; uv; SATWND; MODIS WV (todos niveis) DEEP (AQUA/TERRA); #108590; o; 1
260; uv; SATWND; VIIRS IR (longa onda) der. nuvem (NPP); #8BDEE7; o; -1
290; uv; ASCATW; Non-superobed Scatterometer Winds Over Ocean (ASCAT); #e7ba52; x; -1
3; gps; GPS; GPS-INFO; #297df1; 8; -1
4; gps; GPS; GPS-INFO; #fe6f22; s; -1
740; gps; GPS; GPS-INFO; #42b7a3; *; -1
745; gps; GPS; GPS-INFO; #de57fb; o; -1
744; gps; GPS; GPS-INFO; #f1d34d; p; -1
741; gps; GPS; GPS-INFO; #d61d14; P; -1
722; gps; GPS; GPS-INFO; #2e8e24; x; -1
3; gps; GPS; Sensor RO GRASS in the MetOp-B satellite; #297df1; 8; 1
4; gps; GPS; Sensor RO GRASS in the MetOp-A satellite; #fe6f22; s; 1
5; gps; GPS; Sensor RO GRASS in the MetOp-C satellite; #fe6f22; x; 1
41; gps; GPS; RO data from CHAMP satellite; #fe6f22; x; -1
42; gps; GPS; RO data from TerraSAR-X satellite; #fe6f22; x; 1
43; gps; GPS; RO data from TanDEM-X satellite; #fe6f22; x; 1
44; gps; GPS; RO Data from PAZ satellite; #575738; s; 1
66; gps; GPS; GPS-INFO; #2e8e24; x; -1
265; gps; GPS; GPS-INFO; #2e8e24; x; 1
266; gps; GPS; GPS-INFO; #2e8e24; x; -1
267; gps; GPS; GPS-INFO; #2e8e24; x; -1
268; gps; GPS; GPS-INFO; #2e8e24; x; -1
269; gps; GPS; GPS-INFO; #2e8e24; x; 1
440; gps; GPS; RO Data from Megha-Tropiques satellite; #fe6f22; x; -1
421; gps; GPS; RO data from Oceansat-2 satellite; #fe6f22; x; -1
722; gps; GPS; Sensor RO Data from GRACE-A satellite; #fe6f22; x; 1
723; gps; GPS; Sensor RO data from GRACE-B satellite; #fe6f22; x; 1
724; gps; GPS; Constelation COSMIC-2A Satelitte: P1; #d6616b; 8; -1
725; gps; GPS; Constelation COSMIC-2A Satelitte: P2; #de57fb; o; -1
726; gps; GPS; Constelation COSMIC-2A Satelitte: P3; #f1d34d; p; -1
727; gps; GPS; Constelation COSMIC-2A Satelitte: P4; #d61d14; P; -1
728; gps; GPS; Constelation COSMIC-2A Satelitte: P5; #2e8e24; x; -1
729; gps; GPS; Constelation COSMIC-2A Satelitte: P6; #e7969c; s; -1
740; gps; GPS; Constelation COSMIC-1 Satelitte: FM1; #42b7a3; *; 1
741; gps; GPS; Constelation COSMIC-1 Satelitte: FM2; #de57fb; o; 1
742; gps; GPS; Constelation COSMIC-1 Satelitte: FM3; #f1d34d; p; 1
743; gps; GPS; Constelation COSMIC-1 Satelitte: FM4; #d61d14; P; 1
744; gps; GPS; Constelation COSMIC-1 Satelitte: FM5; #2e8e24; x; 1
745; gps; GPS; Constelation COSMIC-1 Satelitte: FM6; #2e8e24; x; 1
750; gps; GPS; Constelation COSMIC-2B Satelitte: E1; #42b7a3; *; 1
751; gps; GPS; Constelation COSMIC-2B Satelitte: E2; #de57fb; o; 1
752; gps; GPS; Constelation COSMIC-2B Satelitte: E3; #f1d34d; p; 1
753; gps; GPS; Constelation COSMIC-2B Satelitte: E4; #d61d14; s; 1
754; gps; GPS; Constelation COSMIC-2B Satelitte: E4; #2e8e24; x; 1
755; gps; GPS; Constelation COSMIC-2B Satelitte: E5; #e7969c; s; 1
786; gps; GPS; RO data from C/NOFS satellite; #875BAE; s; 1
820; gps; GPS; RO data from SAC-C satellite; #297df1; 8; 1
821; gps; GPS; RO Data from SAC-D satellite; #297df1; 8; -1
825; gps; GPS; RO data from KOMPSAT-5 satellite; #297df1; 8; 1
Loading

0 comments on commit 7241bf4

Please sign in to comment.